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

Static Public Member Functions

static getActionChangeMysqlPort ()
 
static getActionChangeMysqlRootPwd ()
 
static getActionEnableMysql ($enable)
 
static getActionInstallMysqlService ()
 
static getActionRemoveMysqlService ()
 
static getActionSwitchMysqlVersion ($version)
 
static getMenuMysql ()
 
static getMenuMysqlDebug ()
 
static getMenuMysqlService ()
 
static getMenuMysqlVersions ()
 
static process ()
 

Data Fields

const ACTION_CHANGE_PORT = 'changeMysqlPort'
 
const ACTION_CHANGE_ROOT_PWD = 'changeMysqlRootPwd'
 
const ACTION_ENABLE = 'enableMysql'
 
const ACTION_INSTALL_SERVICE = 'installMysqlService'
 
const ACTION_REMOVE_SERVICE = 'removeMysqlService'
 
const ACTION_SWITCH_VERSION = 'switchMysqlVersion'
 
const MENU = 'mysql'
 
const MENU_DEBUG = 'mysqlDebug'
 
const MENU_SERVICE = 'mysqlService'
 
const MENU_VERSIONS = 'mysqlVersions'
 

Detailed Description

Class TplAppMysql

This class provides methods to generate and manage menu items, actions, and sections related to MySQL within the Bearsampp application. It includes functionalities for enabling/disabling MySQL, switching versions, changing ports, managing services, and debugging.

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

Member Function Documentation

◆ getActionChangeMysqlPort()

static TplAppMysql::getActionChangeMysqlPort ( )
static

Generates the action to change MySQL port.

This method creates the action string for changing the MySQL port.

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

Returns
string The generated action string for changing MySQL port.

Definition at line 294 of file class.tpl.app.mysql.php.

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

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

◆ getActionChangeMysqlRootPwd()

static TplAppMysql::getActionChangeMysqlRootPwd ( )
static

Generates the action to change MySQL root password.

This method creates the action string for changing the MySQL root password.

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

Returns
string The generated action string for changing MySQL root password.

Definition at line 311 of file class.tpl.app.mysql.php.

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

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

◆ getActionEnableMysql()

static TplAppMysql::getActionEnableMysql ( $enable)
static

Generates the action to enable or disable MySQL.

This method creates the action string for enabling or disabling MySQL.

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

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

Definition at line 161 of file class.tpl.app.mysql.php.

162 {
163 global $bearsamppBins;
164
165 return TplApp::getActionRun(Action::ENABLE, array($bearsamppBins->getMysql()->getName(), $enable)) . PHP_EOL .
167 }
const ENABLE

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

◆ getActionInstallMysqlService()

static TplAppMysql::getActionInstallMysqlService ( )
static

Generates the action to install MySQL service.

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

Returns
string The generated action string for installing MySQL service.

Definition at line 326 of file class.tpl.app.mysql.php.

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

◆ getActionRemoveMysqlService()

static TplAppMysql::getActionRemoveMysqlService ( )
static

Generates the action to remove MySQL service.

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

Returns
string The generated action string for removing MySQL service.

Definition at line 339 of file class.tpl.app.mysql.php.

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

◆ getActionSwitchMysqlVersion()

static TplAppMysql::getActionSwitchMysqlVersion ( $version)
static

Generates the action to switch MySQL version.

This method creates the action string for switching to a different MySQL version.

@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 MySQL version.

Definition at line 179 of file class.tpl.app.mysql.php.

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

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

◆ getMenuMysql()

static TplAppMysql::getMenuMysql ( )
static

Generates the MySQL menu items and actions.

This method creates menu items and actions for MySQL, including download links, enabling/disabling, version switching, service management, debugging, and configuration file access.

@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 used in the application.

Returns
string The generated MySQL menu items and actions.

Definition at line 61 of file class.tpl.app.mysql.php.

62 {
63 global $bearsamppBins, $bearsamppLang, $bearsamppTools;
64 $resultItems = $resultActions = '';
65
66 $isEnabled = $bearsamppBins->getMysql()->isEnable();
67
68 // Download
70 Util::getWebsiteUrl('module/mysql', '#releases'),
71 false,
73 ) . PHP_EOL;
74
75 // Enable
76 $tplEnable = TplApp::getActionMulti(
77 self::ACTION_ENABLE, array($isEnabled ? Config::DISABLED : Config::ENABLED),
78 array($bearsamppLang->getValue(Lang::MENU_ENABLE), $isEnabled ? TplAestan::GLYPH_CHECK : ''),
79 false, get_called_class()
80 );
81 $resultItems .= $tplEnable[TplApp::SECTION_CALL] . PHP_EOL;
82 $resultActions .= $tplEnable[TplApp::SECTION_CONTENT] . PHP_EOL;
83
84 if ($isEnabled) {
85 $resultItems .= TplAestan::getItemSeparator() . PHP_EOL;
86
87 // Versions
88 $tplVersions = TplApp::getMenu($bearsamppLang->getValue(Lang::VERSIONS), self::MENU_VERSIONS, get_called_class());
89 $resultItems .= $tplVersions[TplApp::SECTION_CALL] . PHP_EOL;
90 $resultActions .= $tplVersions[TplApp::SECTION_CONTENT] . PHP_EOL;
91
92 // Service
93 $tplService = TplApp::getMenu($bearsamppLang->getValue(Lang::SERVICE), self::MENU_SERVICE, get_called_class());
94 $resultItems .= $tplService[TplApp::SECTION_CALL] . PHP_EOL;
95 $resultActions .= $tplService[TplApp::SECTION_CONTENT] . PHP_EOL;
96
97 // Debug
98 $tplDebug = TplApp::getMenu($bearsamppLang->getValue(Lang::DEBUG), self::MENU_DEBUG, get_called_class());
99 $resultItems .= $tplDebug[TplApp::SECTION_CALL] . PHP_EOL;
100 $resultActions .= $tplDebug[TplApp::SECTION_CONTENT];
101
102 // Console
103 $resultItems .= TplAestan::getItemConsoleZ(
104 $bearsamppLang->getValue(Lang::CONSOLE),
106 $bearsamppTools->getConsoleZ()->getTabTitleMysql()
107 ) . PHP_EOL;
108
109 // Conf
110 $resultItems .= TplAestan::getItemNotepad(basename($bearsamppBins->getMysql()->getConf()), $bearsamppBins->getMysql()->getConf()) . PHP_EOL;
111
112 // Errors log
113 $resultItems .= TplAestan::getItemNotepad($bearsamppLang->getValue(Lang::MENU_ERROR_LOGS), $bearsamppBins->getMysql()->getErrorLog()) . PHP_EOL;
114 }
115
116 return $resultItems . PHP_EOL . $resultActions;
117 }
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.

◆ getMenuMysqlDebug()

static TplAppMysql::getMenuMysqlDebug ( )
static

Generates the MySQL debug menu.

This method creates menu items and actions for debugging MySQL, including checking version, variables, and syntax.

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

Returns
string The generated MySQL debug menu items and actions.

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

268 {
269 global $bearsamppLang;
270
274 ) . PHP_EOL .
278 ) . PHP_EOL .
282 ) . PHP_EOL;
283 }
const DEBUG_MYSQL
const CMD_VARIABLES
const CMD_VERSION
const CMD_SYNTAX_CHECK
const DEBUG_MYSQL_VERSION
const DEBUG_MYSQL_VARIABLES
const DEBUG_MYSQL_SYNTAX_CHECK

References $bearsamppLang, BinMysql\CMD_SYNTAX_CHECK, BinMysql\CMD_VARIABLES, BinMysql\CMD_VERSION, Action\DEBUG_MYSQL, Lang\DEBUG_MYSQL_SYNTAX_CHECK, Lang\DEBUG_MYSQL_VARIABLES, Lang\DEBUG_MYSQL_VERSION, TplApp\getActionRun(), and TplAestan\GLYPH_DEBUG.

◆ getMenuMysqlService()

static TplAppMysql::getMenuMysqlService ( )
static

Generates the MySQL service menu.

This method creates menu items and actions for managing MySQL services, including starting, stopping, restarting, changing ports, and managing root passwords.

@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 MySQL service menu items and actions.

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

199 {
201
202 $tplChangePort = TplApp::getActionMulti(
203 self::ACTION_CHANGE_PORT, null,
205 false, get_called_class()
206 );
207
208 $isInstalled = $bearsamppBins->getMysql()->getService()->isInstalled();
209
210 $result = TplAestan::getItemActionServiceStart($bearsamppBins->getMysql()->getService()->getName()) . PHP_EOL .
211 TplAestan::getItemActionServiceStop($bearsamppBins->getMysql()->getService()->getName()) . PHP_EOL .
212 TplAestan::getItemActionServiceRestart($bearsamppBins->getMysql()->getService()->getName()) . PHP_EOL .
213 TplAestan::getItemSeparator() . PHP_EOL .
215 Action::CHECK_PORT, array($bearsamppBins->getMysql()->getName(), $bearsamppBins->getMysql()->getPort()),
216 array(sprintf($bearsamppLang->getValue(Lang::MENU_CHECK_PORT), $bearsamppBins->getMysql()->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.

◆ getMenuMysqlVersions()

static TplAppMysql::getMenuMysqlVersions ( )
static

Generates the MySQL versions menu.

This method creates menu items and actions for switching between different MySQL versions.

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

Returns
string The generated MySQL versions menu items and actions.

Definition at line 128 of file class.tpl.app.mysql.php.

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

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

◆ process()

static TplAppMysql::process ( )
static

Processes and generates the MySQL menu.

This method generates the MySQL menu and determines if MySQL is enabled.

@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 MySQL menu.

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

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

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

Referenced by TplApp\getSectionMenuLeft().

+ Here is the caller graph for this function:

Field Documentation

◆ ACTION_CHANGE_PORT

const TplAppMysql::ACTION_CHANGE_PORT = 'changeMysqlPort'

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

◆ ACTION_CHANGE_ROOT_PWD

const TplAppMysql::ACTION_CHANGE_ROOT_PWD = 'changeMysqlRootPwd'

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

◆ ACTION_ENABLE

const TplAppMysql::ACTION_ENABLE = 'enableMysql'

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

◆ ACTION_INSTALL_SERVICE

const TplAppMysql::ACTION_INSTALL_SERVICE = 'installMysqlService'

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

◆ ACTION_REMOVE_SERVICE

const TplAppMysql::ACTION_REMOVE_SERVICE = 'removeMysqlService'

Definition at line 30 of file class.tpl.app.mysql.php.

◆ ACTION_SWITCH_VERSION

const TplAppMysql::ACTION_SWITCH_VERSION = 'switchMysqlVersion'

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

◆ MENU

const TplAppMysql::MENU = 'mysql'

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

◆ MENU_DEBUG

const TplAppMysql::MENU_DEBUG = 'mysqlDebug'

Definition at line 23 of file class.tpl.app.mysql.php.

◆ MENU_SERVICE

const TplAppMysql::MENU_SERVICE = 'mysqlService'

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

◆ MENU_VERSIONS

const TplAppMysql::MENU_VERSIONS = 'mysqlVersions'

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


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