2024.8.23
Loading...
Searching...
No Matches
TplAppMariadb Class Reference

Static Public Member Functions

static getActionChangeMariadbPort ()
 
static getActionChangeMariadbRootPwd ()
 
static getActionEnableMariadb ($enable)
 
static getActionInstallMariadbService ()
 
static getActionRemoveMariadbService ()
 
static getActionSwitchMariadbVersion ($version)
 
static getMenuMariadb ()
 
static getMenuMariadbDebug ()
 
static getMenuMariadbService ()
 
static getMenuMariadbVersions ()
 
static process ()
 

Data Fields

const ACTION_CHANGE_PORT = 'changeMariadbPort'
 
const ACTION_CHANGE_ROOT_PWD = 'changeMariadbRootPwd'
 
const ACTION_ENABLE = 'enableMariadb'
 
const ACTION_INSTALL_SERVICE = 'installMariadbService'
 
const ACTION_REMOVE_SERVICE = 'removeMariadbService'
 
const ACTION_SWITCH_VERSION = 'switchMariadbVersion'
 
const MENU = 'mariadb'
 
const MENU_DEBUG = 'mariadbDebug'
 
const MENU_SERVICE = 'mariadbService'
 
const MENU_VERSIONS = 'mariadbVersions'
 

Detailed Description

Definition at line 10 of file class.tpl.app.mariadb.php.

Member Function Documentation

◆ getActionChangeMariadbPort()

static TplAppMariadb::getActionChangeMariadbPort ( )
static

Generates the action to change the MariaDB port.

This method creates the action string for changing the MariaDB port. It uses the global binaries object to retrieve the necessary values.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
string The generated action string for changing the MariaDB port.

Definition at line 295 of file class.tpl.app.mariadb.php.

296 {
297 global $bearsamppBins;
298
299 return TplApp::getActionRun(Action::CHANGE_PORT, array($bearsamppBins->getMariadb()->getName())) . PHP_EOL .
301 }
global $bearsamppBins
const CHANGE_PORT
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)

References $bearsamppBins, Action\CHANGE_PORT, TplAppReload\getActionReload(), and TplApp\getActionRun().

◆ getActionChangeMariadbRootPwd()

static TplAppMariadb::getActionChangeMariadbRootPwd ( )
static

Generates the action to change the MariaDB root password.

This method creates the action string for changing the MariaDB root password. It uses the global binaries object to retrieve the necessary values.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
string The generated action string for changing the MariaDB root password.

Definition at line 313 of file class.tpl.app.mariadb.php.

314 {
315 global $bearsamppBins;
316
317 return TplApp::getActionRun(Action::CHANGE_DB_ROOT_PWD, array($bearsamppBins->getMariadb()->getName())) . PHP_EOL .
319 }
const CHANGE_DB_ROOT_PWD

References $bearsamppBins, Action\CHANGE_DB_ROOT_PWD, TplAppReload\getActionReload(), and TplApp\getActionRun().

◆ getActionEnableMariadb()

static TplAppMariadb::getActionEnableMariadb ( $enable)
static

Generates the action to enable or disable MariaDB.

This method creates the action string for enabling or disabling MariaDB. It uses the global binaries object to retrieve the necessary values.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Parameters
int$enableThe enable flag (1 for enable, 0 for disable).
Returns
string The generated action string for enabling or disabling MariaDB.

Definition at line 158 of file class.tpl.app.mariadb.php.

159 {
160 global $bearsamppBins;
161
162 return TplApp::getActionRun(Action::ENABLE, array($bearsamppBins->getMariadb()->getName(), $enable)) . PHP_EOL .
164 }
const ENABLE

References $bearsamppBins, Action\ENABLE, TplAppReload\getActionReload(), and TplApp\getActionRun().

◆ getActionInstallMariadbService()

static TplAppMariadb::getActionInstallMariadbService ( )
static

Generates the action to install the MariaDB service.

This method creates the action string for installing the MariaDB service.

Returns
string The generated action string for installing the MariaDB service.

Definition at line 328 of file class.tpl.app.mariadb.php.

References TplAppReload\getActionReload(), TplApp\getActionRun(), ActionService\INSTALL, Action\SERVICE, and BinMariadb\SERVICE_NAME.

◆ getActionRemoveMariadbService()

static TplAppMariadb::getActionRemoveMariadbService ( )
static

Generates the action to remove the MariaDB service.

This method creates the action string for removing the MariaDB service.

Returns
string The generated action string for removing the MariaDB service.

Definition at line 341 of file class.tpl.app.mariadb.php.

References TplAppReload\getActionReload(), TplApp\getActionRun(), ActionService\REMOVE, Action\SERVICE, and BinMariadb\SERVICE_NAME.

◆ getActionSwitchMariadbVersion()

static TplAppMariadb::getActionSwitchMariadbVersion ( $version)
static

Generates the action to switch the MariaDB version.

This method creates the action string for switching the MariaDB version. It uses the global binaries object to retrieve the necessary values.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Parameters
string$versionThe version to switch to.
Returns
string The generated action string for switching the MariaDB version.

Definition at line 178 of file class.tpl.app.mariadb.php.

179 {
180 global $bearsamppBins;
181
182 return TplApp::getActionRun(Action::SWITCH_VERSION, array($bearsamppBins->getMariadb()->getName(), $version)) . PHP_EOL .
184 }
const SWITCH_VERSION

References $bearsamppBins, TplAppReload\getActionReload(), TplApp\getActionRun(), and Action\SWITCH_VERSION.

◆ getMenuMariadb()

static TplAppMariadb::getMenuMariadb ( )
static

Generates the MariaDB menu items and actions.

This method creates menu items and actions for managing MariaDB, including enabling/disabling, switching versions, managing services, and debugging. It uses the global language, binaries, and tools objects to retrieve the necessary values.

@global object $bearsamppBins Provides access to system binaries and their configurations. @global object $bearsamppLang Provides language support for retrieving language-specific values. @global object $bearsamppTools Provides access to various tools and utilities.

Returns
string The generated MariaDB menu items and actions.

Definition at line 55 of file class.tpl.app.mariadb.php.

56 {
57 global $bearsamppBins, $bearsamppLang, $bearsamppTools;
58 $resultItems = $resultActions = '';
59
60 $isEnabled = $bearsamppBins->getMariadb()->isEnable();
61
62 // Download
64 Util::getWebsiteUrl('module/mariadb', '#releases'),
65 false,
67 ) . PHP_EOL;
68
69 // Enable
70 $tplEnable = TplApp::getActionMulti(
71 self::ACTION_ENABLE, array($isEnabled ? Config::DISABLED : Config::ENABLED),
72 array($bearsamppLang->getValue(Lang::MENU_ENABLE), $isEnabled ? TplAestan::GLYPH_CHECK : ''),
73 false, get_called_class()
74 );
75 $resultItems .= $tplEnable[TplApp::SECTION_CALL] . PHP_EOL;
76 $resultActions .= $tplEnable[TplApp::SECTION_CONTENT] . PHP_EOL;
77
78 if ($isEnabled) {
79 $resultItems .= TplAestan::getItemSeparator() . PHP_EOL;
80
81 // Versions
82 $tplVersions = TplApp::getMenu($bearsamppLang->getValue(Lang::VERSIONS), self::MENU_VERSIONS, get_called_class());
83 $resultItems .= $tplVersions[TplApp::SECTION_CALL] . PHP_EOL;
84 $resultActions .= $tplVersions[TplApp::SECTION_CONTENT] . PHP_EOL;
85
86 // Service
87 $tplService = TplApp::getMenu($bearsamppLang->getValue(Lang::SERVICE), self::MENU_SERVICE, get_called_class());
88 $resultItems .= $tplService[TplApp::SECTION_CALL] . PHP_EOL;
89 $resultActions .= $tplService[TplApp::SECTION_CONTENT] . PHP_EOL;
90
91 // Debug
92 $tplDebug = TplApp::getMenu($bearsamppLang->getValue(Lang::DEBUG), self::MENU_DEBUG, get_called_class());
93 $resultItems .= $tplDebug[TplApp::SECTION_CALL] . PHP_EOL;
94 $resultActions .= $tplDebug[TplApp::SECTION_CONTENT];
95
96 // Console
97 $resultItems .= TplAestan::getItemConsoleZ(
100 $bearsamppTools->getConsoleZ()->getTabTitleMariadb()
101 ) . PHP_EOL;
102
103 // Conf
104 $resultItems .= TplAestan::getItemNotepad(basename($bearsamppBins->getMariadb()->getConf()), $bearsamppBins->getMariadb()->getConf()) . PHP_EOL;
105
106 // Errors log
107 $resultItems .= TplAestan::getItemNotepad($bearsamppLang->getValue(Lang::MENU_ERROR_LOGS), $bearsamppBins->getMariadb()->getErrorLog()) . PHP_EOL;
108 }
109
110 return $resultItems . PHP_EOL . $resultActions;
111 }
global $bearsamppLang
const DISABLED
const MENU_ERROR_LOGS
const VERSIONS
const DEBUG
const DOWNLOAD_MORE
const CONSOLE
const SERVICE
static getItemSeparator()
static getItemConsoleZ($caption, $glyph, $id=null, $title=null, $initDir=null, $command=null)
static getItemLink($caption, $link, $local=false, $glyph=self::GLYPH_WEB_PAGE)
static getItemNotepad($caption, $path)
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
const SECTION_CALL
const SECTION_CONTENT
static getMenu($caption, $menu, $class)
static getWebsiteUrl($path='', $fragment='', $utmSource=true)

References $bearsamppBins, $bearsamppLang, Lang\CONSOLE, Lang\DEBUG, Config\DISABLED, Lang\DOWNLOAD_MORE, Config\ENABLED, TplApp\getActionMulti(), TplAestan\getItemConsoleZ(), TplAestan\getItemLink(), TplAestan\getItemNotepad(), TplAestan\getItemSeparator(), TplApp\getMenu(), Util\getWebsiteUrl(), TplAestan\GLYPH_BROWSER, TplAestan\GLYPH_CHECK, TplAestan\GLYPH_CONSOLEZ, Lang\MENU_ENABLE, Lang\MENU_ERROR_LOGS, TplApp\SECTION_CALL, TplApp\SECTION_CONTENT, Lang\SERVICE, and Lang\VERSIONS.

◆ getMenuMariadbDebug()

static TplAppMariadb::getMenuMariadbDebug ( )
static

Generates the MariaDB debug menu items and actions.

This method creates menu items and actions for debugging MariaDB, including checking the version, variables, and syntax. It uses the global language object to retrieve the necessary values.

@global object $bearsamppLang Provides language support for retrieving language-specific values.

Returns
string The generated MariaDB debug menu items and actions.

Definition at line 267 of file class.tpl.app.mariadb.php.

References $bearsamppLang, BinMariadb\CMD_SYNTAX_CHECK, BinMariadb\CMD_VARIABLES, BinMariadb\CMD_VERSION, Action\DEBUG_MARIADB, Lang\DEBUG_MARIADB_SYNTAX_CHECK, Lang\DEBUG_MARIADB_VARIABLES, Lang\DEBUG_MARIADB_VERSION, TplApp\getActionRun(), and TplAestan\GLYPH_DEBUG.

◆ getMenuMariadbService()

static TplAppMariadb::getMenuMariadbService ( )
static

Generates the MariaDB service menu items and actions.

This method creates menu items and actions for managing the MariaDB service, including starting, stopping, restarting, changing the port, and changing the root password. It uses the global language and binaries objects to retrieve the necessary values.

@global object $bearsamppLang Provides language support for retrieving language-specific values. @global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
string The generated MariaDB service menu items and actions.

Definition at line 198 of file class.tpl.app.mariadb.php.

199 {
201
202 $tplChangePort = TplApp::getActionMulti(
203 self::ACTION_CHANGE_PORT, null,
205 false, get_called_class()
206 );
207
208 $isInstalled = $bearsamppBins->getMariadb()->getService()->isInstalled();
209
210 $result = TplAestan::getItemActionServiceStart($bearsamppBins->getMariadb()->getService()->getName()) . PHP_EOL .
211 TplAestan::getItemActionServiceStop($bearsamppBins->getMariadb()->getService()->getName()) . PHP_EOL .
212 TplAestan::getItemActionServiceRestart($bearsamppBins->getMariadb()->getService()->getName()) . PHP_EOL .
213 TplAestan::getItemSeparator() . PHP_EOL .
215 Action::CHECK_PORT, array($bearsamppBins->getMariadb()->getName(), $bearsamppBins->getMariadb()->getPort()),
216 array(sprintf($bearsamppLang->getValue(Lang::MENU_CHECK_PORT), $bearsamppBins->getMariadb()->getPort()), TplAestan::GLYPH_LIGHT)
217 ) . PHP_EOL .
218 $tplChangePort[TplApp::SECTION_CALL] . PHP_EOL;
219
220 $tplChangeRootPwd = null;
221 if ($isInstalled) {
222 $tplChangeRootPwd = TplApp::getActionMulti(
223 self::ACTION_CHANGE_ROOT_PWD, null,
225 !$isInstalled, get_called_class()
226 );
227
228 $result .= $tplChangeRootPwd[TplApp::SECTION_CALL] . PHP_EOL;
229 }
230
231 if (!$isInstalled) {
232 $tplInstallService = TplApp::getActionMulti(
233 self::ACTION_INSTALL_SERVICE, null,
235 $isInstalled, get_called_class()
236 );
237
238 $result .= $tplInstallService[TplApp::SECTION_CALL] . PHP_EOL . PHP_EOL .
239 $tplInstallService[TplApp::SECTION_CONTENT] . PHP_EOL;
240 } else {
241 $tplRemoveService = TplApp::getActionMulti(
242 self::ACTION_REMOVE_SERVICE, null,
244 !$isInstalled, get_called_class()
245 );
246
247 $result .= $tplRemoveService[TplApp::SECTION_CALL] . PHP_EOL . PHP_EOL .
248 $tplRemoveService[TplApp::SECTION_CONTENT] . PHP_EOL;
249 }
250
251 $result .= $tplChangePort[TplApp::SECTION_CONTENT] . PHP_EOL .
252 ($tplChangeRootPwd != null ? $tplChangeRootPwd[TplApp::SECTION_CONTENT] . PHP_EOL : '');
253
254 return $result;
255 }
$result
const CHECK_PORT
const MENU_INSTALL_SERVICE
const MENU_CHANGE_ROOT_PWD
const MENU_REMOVE_SERVICE
const MENU_CHECK_PORT
const MENU_CHANGE_PORT
const GLYPH_SERVICE_REMOVE
static getItemActionServiceStop($service)
static getItemActionServiceStart($service)
static getItemActionServiceRestart($service)
const GLYPH_SERVICE_INSTALL

References $bearsamppBins, $bearsamppLang, $result, Action\CHECK_PORT, TplApp\getActionMulti(), TplApp\getActionRun(), TplAestan\getItemActionServiceRestart(), TplAestan\getItemActionServiceStart(), TplAestan\getItemActionServiceStop(), TplAestan\getItemSeparator(), TplAestan\GLYPH_LIGHT, TplAestan\GLYPH_NETWORK, TplAestan\GLYPH_PASSWORD, TplAestan\GLYPH_SERVICE_INSTALL, TplAestan\GLYPH_SERVICE_REMOVE, Lang\MENU_CHANGE_PORT, Lang\MENU_CHANGE_ROOT_PWD, Lang\MENU_CHECK_PORT, Lang\MENU_INSTALL_SERVICE, Lang\MENU_REMOVE_SERVICE, TplApp\SECTION_CALL, and TplApp\SECTION_CONTENT.

◆ getMenuMariadbVersions()

static TplAppMariadb::getMenuMariadbVersions ( )
static

Generates the MariaDB versions menu items and actions.

This method creates menu items and actions for switching between different MariaDB versions. It uses the global binaries object to retrieve the available versions.

@global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
string The generated MariaDB versions menu items and actions.

Definition at line 123 of file class.tpl.app.mariadb.php.

124 {
125 global $bearsamppBins;
126 $items = '';
127 $actions = '';
128
129 foreach ($bearsamppBins->getMariadb()->getVersionList() as $version) {
130 $tplSwitchMariadbVersion = TplApp::getActionMulti(
131 self::ACTION_SWITCH_VERSION, array($version),
132 array($version, $version == $bearsamppBins->getMariadb()->getVersion() ? TplAestan::GLYPH_CHECK : ''),
133 false, get_called_class()
134 );
135
136 // Item
137 $items .= $tplSwitchMariadbVersion[TplApp::SECTION_CALL] . PHP_EOL;
138
139 // Action
140 $actions .= PHP_EOL . $tplSwitchMariadbVersion[TplApp::SECTION_CONTENT];
141 }
142
143 return $items . $actions;
144 }

References $bearsamppBins, TplApp\getActionMulti(), TplAestan\GLYPH_CHECK, TplApp\SECTION_CALL, and TplApp\SECTION_CONTENT.

◆ process()

static TplAppMariadb::process ( )
static

Processes the MariaDB menu.

This method generates the MariaDB menu and determines if MariaDB is enabled. It uses the global language and binaries objects to retrieve the necessary values.

@global object $bearsamppLang Provides language support for retrieving language-specific values. @global object $bearsamppBins Provides access to system binaries and their configurations.

Returns
array The generated MariaDB menu.

Definition at line 35 of file class.tpl.app.mariadb.php.

36 {
38
39 return TplApp::getMenuEnable($bearsamppLang->getValue(Lang::MARIADB), self::MENU, get_called_class(), $bearsamppBins->getMariadb()->isEnable());
40 }
const MARIADB
static getMenuEnable($caption, $menu, $class, $enabled=true)

References $bearsamppBins, $bearsamppLang, TplApp\getMenuEnable(), and Lang\MARIADB.

Referenced by TplApp\getSectionMenuLeft().

+ Here is the caller graph for this function:

Field Documentation

◆ ACTION_CHANGE_PORT

const TplAppMariadb::ACTION_CHANGE_PORT = 'changeMariadbPort'

Definition at line 19 of file class.tpl.app.mariadb.php.

◆ ACTION_CHANGE_ROOT_PWD

const TplAppMariadb::ACTION_CHANGE_ROOT_PWD = 'changeMariadbRootPwd'

Definition at line 20 of file class.tpl.app.mariadb.php.

◆ ACTION_ENABLE

const TplAppMariadb::ACTION_ENABLE = 'enableMariadb'

Definition at line 17 of file class.tpl.app.mariadb.php.

◆ ACTION_INSTALL_SERVICE

const TplAppMariadb::ACTION_INSTALL_SERVICE = 'installMariadbService'

Definition at line 21 of file class.tpl.app.mariadb.php.

◆ ACTION_REMOVE_SERVICE

const TplAppMariadb::ACTION_REMOVE_SERVICE = 'removeMariadbService'

Definition at line 22 of file class.tpl.app.mariadb.php.

◆ ACTION_SWITCH_VERSION

const TplAppMariadb::ACTION_SWITCH_VERSION = 'switchMariadbVersion'

Definition at line 18 of file class.tpl.app.mariadb.php.

◆ MENU

const TplAppMariadb::MENU = 'mariadb'

Definition at line 12 of file class.tpl.app.mariadb.php.

◆ MENU_DEBUG

const TplAppMariadb::MENU_DEBUG = 'mariadbDebug'

Definition at line 15 of file class.tpl.app.mariadb.php.

◆ MENU_SERVICE

const TplAppMariadb::MENU_SERVICE = 'mariadbService'

Definition at line 14 of file class.tpl.app.mariadb.php.

◆ MENU_VERSIONS

const TplAppMariadb::MENU_VERSIONS = 'mariadbVersions'

Definition at line 13 of file class.tpl.app.mariadb.php.


The documentation for this class was generated from the following file: