2024.8.23
|
Public Member Functions | |
__construct ($id, $type) | |
changePort ($port, $checkUsed=false, $wbProgressBar=null) | |
changeRootPassword ($currentPwd, $newPwd, $wbProgressBar=null) | |
checkPort ($port, $showWindow=false) | |
checkRootPassword ($currentPwd=null, $wbProgressBar=null) | |
getAdmin () | |
getCliExe () | |
getCmdLineOutput ($cmd) | |
getConf () | |
getErrorLog () | |
getExe () | |
getPort () | |
getRootPwd () | |
getRootUser () | |
getService () | |
initData ($path=null, $version=null) | |
reload ($id=null, $type=null) | |
setEnable ($enabled, $showWindow=false) | |
setPort ($port) | |
setRootPwd ($rootPwd) | |
setRootUser ($rootUser) | |
setVersion ($version) | |
switchVersion ($version, $showWindow=false) | |
Public Member Functions inherited from Module | |
__toString () | |
getCurrentPath () | |
getId () | |
getName () | |
getRelease () | |
getRootPath () | |
getSymlinkPath () | |
getType () | |
getVersion () | |
getVersionList () | |
isEnable () | |
update ($sub=0, $showWindow=false) | |
Data Fields | |
const | CMD_SYNTAX_CHECK = '--help --verbose 1>NUL' |
const | CMD_VARIABLES = 'variables' |
const | CMD_VERSION = '--version' |
const | LOCAL_CFG_ADMIN = 'mysqlAdmin' |
const | LOCAL_CFG_CLI_EXE = 'mysqlCliExe' |
const | LOCAL_CFG_CONF = 'mysqlConf' |
const | LOCAL_CFG_EXE = 'mysqlExe' |
const | LOCAL_CFG_PORT = 'mysqlPort' |
const | LOCAL_CFG_ROOT_PWD = 'mysqlRootPwd' |
const | LOCAL_CFG_ROOT_USER = 'mysqlRootUser' |
const | ROOT_CFG_ENABLE = 'mysqlEnable' |
const | ROOT_CFG_VERSION = 'mysqlVersion' |
const | SERVICE_NAME = 'bearsamppmysql' |
Data Fields inherited from Module | |
const | BUNDLE_RELEASE = 'bundleRelease' |
Protected Member Functions | |
replaceAll ($params) | |
updateConfig ($version=null, $sub=0, $showWindow=false) | |
Protected Member Functions inherited from Module | |
__construct () | |
replace ($key, $value) | |
Private Attributes | |
$admin | |
$cliExe | |
$conf | |
$errorLog | |
$exe | |
$port | |
$rootPwd | |
$rootUser | |
$service | |
Additional Inherited Members | |
Protected Attributes inherited from Module | |
$bearsamppConf | |
$bearsamppConfRaw | |
$currentPath | |
$enable | |
$name | |
$release = 'N/A' | |
$rootPath | |
$symlinkPath | |
$version | |
Class BinMysql
This class represents the MySQL binary module in the Bearsampp application. It handles the configuration, management, and operations related to MySQL.
Definition at line 16 of file class.bin.mysql.php.
BinMysql::__construct | ( | $id, | |
$type ) |
Constructs a BinMysql object and initializes the MySQL module.
string | $id | The ID of the module. |
string | $type | The type of the module. |
Definition at line 52 of file class.bin.mysql.php.
References Module\$id, Module\$type, Util\logInitClass(), and reload().
BinMysql::changePort | ( | $port, | |
$checkUsed = false, | |||
$wbProgressBar = null ) |
Changes the MySQL port and updates the configuration.
int | $port | The new port number. |
bool | $checkUsed | Whether to check if the port is already in use. |
mixed | $wbProgressBar | The progress bar object for UI updates. |
Definition at line 182 of file class.bin.mysql.php.
References $port, Module\getName(), Util\isPortInUse(), Util\isValidPort(), Util\logDebug(), Util\logError(), setPort(), and Module\update().
BinMysql::changeRootPassword | ( | $currentPwd, | |
$newPwd, | |||
$wbProgressBar = null ) |
Changes the MySQL root password.
string | $currentPwd | The current root password. |
string | $newPwd | The new root password. |
mixed | $wbProgressBar | The progress bar object for UI updates. |
Definition at line 313 of file class.bin.mysql.php.
References setRootPwd(), and Module\update().
BinMysql::checkPort | ( | $port, | |
$showWindow = false ) |
Checks if the specified port is in use by MySQL.
int | $port | The port number to check. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 221 of file class.bin.mysql.php.
References $bearsamppLang, $port, $result, Module\$version, Lang\CHECK_PORT_TITLE, Module\getName(), Util\isValidPort(), Util\logDebug(), Util\logError(), Lang\PORT_NOT_USED, Lang\PORT_NOT_USED_BY, Lang\PORT_USED_BY, Lang\PORT_USED_BY_ANOTHER_DBMS, and Util\startWith().
BinMysql::checkRootPassword | ( | $currentPwd = null, | |
$wbProgressBar = null ) |
Checks if the provided root password is correct.
string | null | $currentPwd | The current root password. If null, the stored root password is used. |
mixed | $wbProgressBar | The progress bar object for UI updates. |
Definition at line 383 of file class.bin.mysql.php.
BinMysql::getAdmin | ( | ) |
Retrieves the path to the MySQL admin executable.
Definition at line 729 of file class.bin.mysql.php.
References $admin.
Referenced by getCmdLineOutput().
BinMysql::getCliExe | ( | ) |
Retrieves the path to the MySQL CLI executable.
Definition at line 719 of file class.bin.mysql.php.
References $cliExe.
BinMysql::getCmdLineOutput | ( | $cmd | ) |
Executes a MySQL command and retrieves the output.
string | $cmd | The command to execute. |
Definition at line 531 of file class.bin.mysql.php.
References $result, Util\contains(), Batch\exec(), getAdmin(), getExe(), getRootPwd(), and getRootUser().
BinMysql::getConf | ( | ) |
Retrieves the path to the MySQL configuration file.
Definition at line 649 of file class.bin.mysql.php.
References $conf.
Referenced by updateConfig().
BinMysql::getErrorLog | ( | ) |
Retrieves the path to the MySQL error log.
Definition at line 629 of file class.bin.mysql.php.
References $errorLog.
BinMysql::getExe | ( | ) |
Retrieves the path to the MySQL executable.
Definition at line 639 of file class.bin.mysql.php.
References $exe.
Referenced by getCmdLineOutput().
BinMysql::getPort | ( | ) |
Retrieves the MySQL port number.
Definition at line 659 of file class.bin.mysql.php.
References $port.
BinMysql::getRootPwd | ( | ) |
Retrieves the MySQL root password.
Definition at line 699 of file class.bin.mysql.php.
References $rootPwd.
Referenced by getCmdLineOutput().
BinMysql::getRootUser | ( | ) |
Retrieves the MySQL root username.
Definition at line 679 of file class.bin.mysql.php.
References $rootUser.
Referenced by getCmdLineOutput().
BinMysql::getService | ( | ) |
Retrieves the MySQL service object.
Definition at line 585 of file class.bin.mysql.php.
References $service.
BinMysql::initData | ( | $path = null, | |
$version = null ) |
Initializes the MySQL data directory if it does not exist.
string | null | $path | The path to the MySQL installation. If null, the current path is used. |
string | null | $version | The version of MySQL. If null, the current version is used. |
Definition at line 508 of file class.bin.mysql.php.
References Module\$version, Module\getCurrentPath(), Module\getVersion(), and Batch\initializeMysql().
Referenced by updateConfig().
BinMysql::reload | ( | $id = null, | |
$type = null ) |
Reloads the MySQL module configuration based on the provided ID and type.
string | null | $id | The ID of the module. If null, the current ID is used. |
string | null | $type | The type of the module. If null, the current type is used. |
Reimplemented from Module.
Definition at line 64 of file class.bin.mysql.php.
References $bearsamppConfig, $bearsamppLang, $bearsamppRoot, Module\$id, Module\$type, APP_TITLE, Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, Lang\ERROR_INVALID_PARAMETER, Module\getName(), LOCAL_CFG_ADMIN, LOCAL_CFG_CLI_EXE, LOCAL_CFG_CONF, LOCAL_CFG_EXE, LOCAL_CFG_PORT, LOCAL_CFG_ROOT_PWD, LOCAL_CFG_ROOT_USER, Util\logError(), Util\logInfo(), Util\logReloadClass(), Lang\MYSQL, Win32Service\SERVER_ERROR_NORMAL, and Win32Service\SERVICE_DEMAND_START.
Referenced by __construct(), setEnable(), and setVersion().
|
protected |
Replaces multiple key-value pairs in the configuration file.
array | $params | An associative array of key-value pairs to replace. |
Reimplemented from Module.
Definition at line 150 of file class.bin.mysql.php.
References LOCAL_CFG_PORT, LOCAL_CFG_ROOT_PWD, and LOCAL_CFG_ROOT_USER.
BinMysql::setEnable | ( | $enabled, | |
$showWindow = false ) |
Enables or disables the MySQL module and updates the configuration.
bool | $enabled | Whether to enable or disable the module. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 596 of file class.bin.mysql.php.
References $bearsamppConfig, $bearsamppLang, Config\DISABLED, Lang\ENABLE_BUNDLE_NOT_EXIST, Lang\ENABLE_TITLE, Config\ENABLED, Module\getName(), Module\getVersion(), Util\installService(), Util\logDebug(), Util\logInfo(), reload(), and Util\removeService().
BinMysql::setPort | ( | $port | ) |
Sets the MySQL port number and updates the configuration.
int | $port | The port number to set. |
Definition at line 669 of file class.bin.mysql.php.
References $port, and Module\replace().
Referenced by changePort().
BinMysql::setRootPwd | ( | $rootPwd | ) |
Sets the MySQL root password and updates the configuration.
string | $rootPwd | The root password to set. |
Definition at line 709 of file class.bin.mysql.php.
References $rootPwd, and Module\replace().
Referenced by changeRootPassword().
BinMysql::setRootUser | ( | $rootUser | ) |
Sets the MySQL root username and updates the configuration.
string | $rootUser | The root username to set. |
Definition at line 689 of file class.bin.mysql.php.
References $rootUser, and Module\replace().
BinMysql::setVersion | ( | $version | ) |
Sets the MySQL version and reloads the configuration.
string | $version | The version to set. |
Reimplemented from Module.
Definition at line 572 of file class.bin.mysql.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
BinMysql::switchVersion | ( | $version, | |
$showWindow = false ) |
Switches the MySQL version and updates the configuration.
string | $version | The new MySQL version. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 420 of file class.bin.mysql.php.
References Module\$version, Util\logDebug(), and updateConfig().
|
protected |
Updates the MySQL configuration with a specific version.
string | null | $version | The version to update to. If null, the current version is used. |
int | $sub | The sub-level for logging indentation. |
bool | $showWindow | Whether to show a message box with the result. |
Reimplemented from Module.
Definition at line 436 of file class.bin.mysql.php.
References $bearsamppBins, Module\$bearsamppConf, Module\$bearsamppConfRaw, $bearsamppLang, $conf, Module\$currentPath, Module\$version, Lang\BEARSAMPP_CONF_MALFORMED_ERROR, Lang\BEARSAMPP_CONF_NOT_FOUND_ERROR, getConf(), Module\getCurrentPath(), Module\getName(), Module\getVersion(), initData(), Util\logDebug(), Util\logError(), Util\replaceInFile(), setVersion(), and Lang\SWITCH_VERSION_TITLE.
Referenced by switchVersion().
|
private |
Definition at line 44 of file class.bin.mysql.php.
Referenced by getAdmin().
|
private |
Definition at line 43 of file class.bin.mysql.php.
Referenced by getCliExe().
|
private |
Definition at line 39 of file class.bin.mysql.php.
Referenced by getConf(), and updateConfig().
|
private |
Definition at line 36 of file class.bin.mysql.php.
Referenced by getErrorLog().
|
private |
Definition at line 38 of file class.bin.mysql.php.
Referenced by getExe().
|
private |
Definition at line 40 of file class.bin.mysql.php.
Referenced by changePort(), checkPort(), getPort(), and setPort().
|
private |
Definition at line 42 of file class.bin.mysql.php.
Referenced by getRootPwd(), and setRootPwd().
|
private |
Definition at line 41 of file class.bin.mysql.php.
Referenced by getRootUser(), and setRootUser().
|
private |
Definition at line 35 of file class.bin.mysql.php.
Referenced by getService().
const BinMysql::CMD_SYNTAX_CHECK = '--help --verbose 1>NUL' |
Definition at line 33 of file class.bin.mysql.php.
Referenced by ActionDebugMysql\__construct(), ActionService\__construct(), TplAppMysql\getMenuMysqlDebug(), ActionStartup\installServices(), and Win32Service\start().
const BinMysql::CMD_VARIABLES = 'variables' |
Definition at line 32 of file class.bin.mysql.php.
Referenced by ActionDebugMysql\__construct(), and TplAppMysql\getMenuMysqlDebug().
const BinMysql::CMD_VERSION = '--version' |
Definition at line 31 of file class.bin.mysql.php.
Referenced by ActionDebugMysql\__construct(), and TplAppMysql\getMenuMysqlDebug().
const BinMysql::LOCAL_CFG_ADMIN = 'mysqlAdmin' |
Definition at line 25 of file class.bin.mysql.php.
Referenced by reload().
const BinMysql::LOCAL_CFG_CLI_EXE = 'mysqlCliExe' |
Definition at line 24 of file class.bin.mysql.php.
Referenced by reload().
const BinMysql::LOCAL_CFG_CONF = 'mysqlConf' |
Definition at line 26 of file class.bin.mysql.php.
Referenced by reload().
const BinMysql::LOCAL_CFG_EXE = 'mysqlExe' |
Definition at line 23 of file class.bin.mysql.php.
Referenced by reload().
const BinMysql::LOCAL_CFG_PORT = 'mysqlPort' |
Definition at line 27 of file class.bin.mysql.php.
Referenced by reload(), and replaceAll().
const BinMysql::LOCAL_CFG_ROOT_PWD = 'mysqlRootPwd' |
Definition at line 29 of file class.bin.mysql.php.
Referenced by reload(), and replaceAll().
const BinMysql::LOCAL_CFG_ROOT_USER = 'mysqlRootUser' |
Definition at line 28 of file class.bin.mysql.php.
Referenced by reload(), and replaceAll().
const BinMysql::ROOT_CFG_ENABLE = 'mysqlEnable' |
Definition at line 20 of file class.bin.mysql.php.
const BinMysql::ROOT_CFG_VERSION = 'mysqlVersion' |
Definition at line 21 of file class.bin.mysql.php.
const BinMysql::SERVICE_NAME = 'bearsamppmysql' |
Definition at line 18 of file class.bin.mysql.php.
Referenced by ActionService\__construct(), TplAppMysql\getActionInstallMysqlService(), TplAppMysql\getActionRemoveMysqlService(), Bins\getServices(), ActionStartup\installServices(), ActionQuit\processWindow(), and Win32Service\start().