Bearsampp 2026.9.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

Class TplAppMariadb

This class provides methods to generate menu items and actions for managing MariaDB within the Bearsampp application. It includes functionalities for enabling/disabling MariaDB, switching versions, changing ports and root passwords, and managing services.

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

Member Function Documentation

◆ getActionChangeMariadbPort()

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.

Returns
string The generated action string for changing the MariaDB port. @global object $bearsamppBins Provides access to system binaries and their configurations.

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

323 {
324 global $bearsamppBins;
325
326 return TplApp::getActionRun(Action::CHANGE_PORT, array($bearsamppBins->getMariadb()->getName())) . PHP_EOL .
328 }
global $bearsamppBins
const CHANGE_PORT
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)

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

Here is the call graph for this function:

◆ getActionChangeMariadbRootPwd()

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.

Returns
string The generated action string for changing the MariaDB root password. @global object $bearsamppBins Provides access to system binaries and their configurations.

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

341 {
342 global $bearsamppBins;
343
344 return TplApp::getActionRun(Action::CHANGE_DB_ROOT_PWD, array($bearsamppBins->getMariadb()->getName())) . PHP_EOL .
346 }
const CHANGE_DB_ROOT_PWD

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

Here is the call graph for this function:

◆ getActionEnableMariadb()

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.

Parameters
int$enableThe enable flag (1 for enable, 0 for disable).
Returns
string The generated action string for enabling or disabling MariaDB. @global object $bearsamppBins Provides access to system binaries and their configurations.

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

174 {
175 global $bearsamppBins;
176
177 return TplApp::getActionRun(Action::ENABLE, array($bearsamppBins->getMariadb()->getName(), $enable)) . PHP_EOL .
179 }
const ENABLE

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

Here is the call graph for this function:

◆ getActionInstallMariadbService()

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 355 of file class.tpl.app.mariadb.php.

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

Here is the call graph for this function:

◆ getActionRemoveMariadbService()

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 368 of file class.tpl.app.mariadb.php.

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

Here is the call graph for this function:

◆ getActionSwitchMariadbVersion()

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.

Parameters
string$versionThe version to switch to.
Returns
string The generated action string for switching the MariaDB version. @global object $bearsamppBins Provides access to system binaries and their configurations.

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

194 {
195 global $bearsamppBins;
196
197 return TplApp::getActionRun(Action::SWITCH_VERSION, array($bearsamppBins->getMariadb()->getName(), $version)) . PHP_EOL .
199 }
const SWITCH_VERSION

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

Here is the call graph for this function:

◆ getMenuMariadb()

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.

Returns
string The generated MariaDB menu items and actions. @global object $bearsamppLang Provides language support for retrieving language-specific values. @global object $bearsamppTools Provides access to various tools and utilities.

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

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

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

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

Here is the call graph for this function:

◆ getMenuMariadbDebug()

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.

Returns
string The generated MariaDB debug menu items and actions. @global object $bearsamppLang Provides language support for retrieving language-specific values.

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

292 {
293 global $bearsamppLang;
294
299 ) . PHP_EOL .
304 ) . PHP_EOL .
309 ) . PHP_EOL;
310 }
const DEBUG_MARIADB
const DEBUG_MARIADB_VARIABLES
const DEBUG_MARIADB_SYNTAX_CHECK
const DEBUG_MARIADB_VERSION

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.

Here is the call graph for this function:

◆ getMenuMariadbService()

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.

Returns
string The generated MariaDB service menu items and actions. @global object $bearsamppBins Provides access to system binaries and their configurations.

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

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

214 {
216
217 $tplChangePort = TplApp::getActionMulti(
218 self::ACTION_CHANGE_PORT,
219 null,
221 false,
222 get_called_class()
223 );
224
225 $isInstalled = $bearsamppBins->getMariadb()->getService()->isInstalled();
226
227 $result = TplAestan::getItemActionServiceStart($bearsamppBins->getMariadb()->getService()->getName()) . PHP_EOL .
228 TplAestan::getItemActionServiceStop($bearsamppBins->getMariadb()->getService()->getName()) . PHP_EOL .
229 TplAestan::getItemActionServiceRestart($bearsamppBins->getMariadb()->getService()->getName()) . PHP_EOL .
230 TplAestan::getItemSeparator() . PHP_EOL .
233 array($bearsamppBins->getMariadb()->getName(), $bearsamppBins->getMariadb()->getPort()),
234 array(sprintf($bearsamppLang->getValue(Lang::MENU_CHECK_PORT), $bearsamppBins->getMariadb()->getPort()), TplAestan::GLYPH_LIGHT)
235 ) . PHP_EOL .
236 $tplChangePort[TplApp::SECTION_CALL] . PHP_EOL;
237
238 $tplChangeRootPwd = null;
239 if ($isInstalled) {
240 $tplChangeRootPwd = TplApp::getActionMulti(
241 self::ACTION_CHANGE_ROOT_PWD,
242 null,
244 !$isInstalled,
245 get_called_class()
246 );
247
248 $result .= $tplChangeRootPwd[TplApp::SECTION_CALL] . PHP_EOL;
249 }
250
251 if (!$isInstalled) {
252 $tplInstallService = TplApp::getActionMulti(
253 self::ACTION_INSTALL_SERVICE,
254 null,
256 $isInstalled,
257 get_called_class()
258 );
259
260 $result .= $tplInstallService[TplApp::SECTION_CALL] . PHP_EOL . PHP_EOL .
261 $tplInstallService[TplApp::SECTION_CONTENT] . PHP_EOL;
262 } else {
263 $tplRemoveService = TplApp::getActionMulti(
264 self::ACTION_REMOVE_SERVICE,
265 null,
267 !$isInstalled,
268 get_called_class()
269 );
270
271 $result .= $tplRemoveService[TplApp::SECTION_CALL] . PHP_EOL . PHP_EOL .
272 $tplRemoveService[TplApp::SECTION_CONTENT] . PHP_EOL;
273 }
274
275 $result .= $tplChangePort[TplApp::SECTION_CONTENT] . PHP_EOL .
276 ($tplChangeRootPwd != null ? $tplChangeRootPwd[TplApp::SECTION_CONTENT] . PHP_EOL : '');
277
278 return $result;
279 }
$result
const CHECK_PORT
const MENU_CHANGE_ROOT_PWD
const MENU_CHANGE_PORT
const MENU_INSTALL_SERVICE
const MENU_REMOVE_SERVICE
const MENU_CHECK_PORT
const GLYPH_SERVICE_REMOVE
static getItemActionServiceStop($service)
const GLYPH_SERVICE_INSTALL
static getItemActionServiceStart($service)
static getItemActionServiceRestart($service)

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.

Here is the call graph for this function:

◆ getMenuMariadbVersions()

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.

Returns
string The generated MariaDB versions menu items and actions. @global object $bearsamppBins Provides access to system binaries and their configurations.

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

137 {
138 global $bearsamppBins;
139 $items = '';
140 $actions = '';
141
142 foreach ($bearsamppBins->getMariadb()->getVersionList() as $version) {
143 $tplSwitchMariadbVersion = TplApp::getActionMulti(
144 self::ACTION_SWITCH_VERSION,
145 array($version),
146 array($version, $version == $bearsamppBins->getMariadb()->getVersion() ? TplAestan::GLYPH_CHECK : ''),
147 false,
148 get_called_class()
149 );
150
151 // Item
152 $items .= $tplSwitchMariadbVersion[TplApp::SECTION_CALL] . PHP_EOL;
153
154 // Action
155 $actions .= PHP_EOL . $tplSwitchMariadbVersion[TplApp::SECTION_CONTENT];
156 }
157
158 return $items . $actions;
159 }

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

Here is the call graph for this function:

◆ process()

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.

Returns
array The generated MariaDB menu. @global object $bearsamppBins Provides access to system binaries and their configurations.

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

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

43 {
45
46 return TplApp::getMenuEnable($bearsamppLang->getValue(Lang::MARIADB), self::MENU, get_called_class(), $bearsamppBins->getMariadb()->isEnable());
47 }
const MARIADB
static getMenuEnable($caption, $menu, $class, $enabled=true)

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

Referenced by TplApp\getSectionMenuLeft().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ ACTION_CHANGE_PORT

const ACTION_CHANGE_PORT = 'changeMariadbPort'

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

◆ ACTION_CHANGE_ROOT_PWD

const ACTION_CHANGE_ROOT_PWD = 'changeMariadbRootPwd'

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

◆ ACTION_ENABLE

const ACTION_ENABLE = 'enableMariadb'

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

◆ ACTION_INSTALL_SERVICE

const ACTION_INSTALL_SERVICE = 'installMariadbService'

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

◆ ACTION_REMOVE_SERVICE

const ACTION_REMOVE_SERVICE = 'removeMariadbService'

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

◆ ACTION_SWITCH_VERSION

const ACTION_SWITCH_VERSION = 'switchMariadbVersion'

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

◆ MENU

const MENU = 'mariadb'

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

◆ MENU_DEBUG

const MENU_DEBUG = 'mariadbDebug'

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

◆ MENU_SERVICE

const MENU_SERVICE = 'mariadbService'

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

◆ MENU_VERSIONS

const MENU_VERSIONS = 'mariadbVersions'

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


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