![]() |
Bearsampp 2025.8.29
|
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 () | |
getDataDir () | |
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 | |
$dataDir | |
$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.
__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 53 of file class.bin.mysql.php.
References Module\$id, Module\$type, Util\logInitClass(), and reload().
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 184 of file class.bin.mysql.php.
References $port, Module\getName(), Util\isPortInUse(), Util\isValidPort(), Util\logDebug(), Util\logError(), setPort(), and Module\update().
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 333 of file class.bin.mysql.php.
References $port, Module\$version, Util\logTrace(), setRootPwd(), and Module\update().
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 223 of file class.bin.mysql.php.
References $bearsamppLang, $port, Module\$version, Lang\CHECK_PORT_TITLE, Module\getName(), Util\isValidPort(), Util\logDebug(), Util\logError(), Util\logTrace(), Lang\PORT_NOT_USED, Lang\PORT_NOT_USED_BY, Lang\PORT_USED_BY, Lang\PORT_USED_BY_ANOTHER_DBMS, and Util\startWith().
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 417 of file class.bin.mysql.php.
References $port, and Util\logTrace().
getAdmin | ( | ) |
Retrieves the path to the MySQL admin executable.
Definition at line 865 of file class.bin.mysql.php.
References $admin.
Referenced by getCmdLineOutput().
getCliExe | ( | ) |
Retrieves the path to the MySQL CLI executable.
Definition at line 855 of file class.bin.mysql.php.
References $cliExe.
getCmdLineOutput | ( | $cmd | ) |
Executes a MySQL command and retrieves the output.
string | $cmd | The command to execute. |
Definition at line 669 of file class.bin.mysql.php.
References $result, Util\contains(), Batch\exec(), getAdmin(), getExe(), getRootPwd(), and getRootUser().
getConf | ( | ) |
Retrieves the path to the MySQL configuration file.
Definition at line 785 of file class.bin.mysql.php.
References $conf.
Referenced by updateConfig().
getDataDir | ( | ) |
Retrieves the path to the MySQL data directory.
Definition at line 875 of file class.bin.mysql.php.
References $dataDir.
getErrorLog | ( | ) |
Retrieves the path to the MySQL error log.
Definition at line 765 of file class.bin.mysql.php.
References $errorLog.
getExe | ( | ) |
Retrieves the path to the MySQL executable.
Definition at line 775 of file class.bin.mysql.php.
References $exe.
Referenced by getCmdLineOutput().
getPort | ( | ) |
Retrieves the MySQL port number.
Definition at line 795 of file class.bin.mysql.php.
References $port.
getRootPwd | ( | ) |
Retrieves the MySQL root password.
Definition at line 835 of file class.bin.mysql.php.
References $rootPwd.
Referenced by getCmdLineOutput().
getRootUser | ( | ) |
Retrieves the MySQL root username.
Definition at line 815 of file class.bin.mysql.php.
References $rootUser.
Referenced by getCmdLineOutput().
getService | ( | ) |
Retrieves the MySQL service object.
Definition at line 722 of file class.bin.mysql.php.
References $service.
initData | ( | $path = null, | |
$version = null ) |
Initializes the MySQL data directory if needed. Triggers reinitialization when the directory exists but is incomplete (e.g., missing performance_schema).
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 577 of file class.bin.mysql.php.
References $dataDir, Module\$version, Module\getCurrentPath(), Module\getVersion(), Batch\initializeMysql(), and Util\logTrace().
Referenced by updateConfig().
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 65 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(), 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 152 of file class.bin.mysql.php.
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 733 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().
setPort | ( | $port | ) |
Sets the MySQL port number and updates the configuration.
int | $port | The port number to set. |
Definition at line 805 of file class.bin.mysql.php.
References $port, and Module\replace().
Referenced by changePort().
setRootPwd | ( | $rootPwd | ) |
Sets the MySQL root password and updates the configuration.
string | $rootPwd | The root password to set. |
Definition at line 845 of file class.bin.mysql.php.
References $rootPwd, and Module\replace().
Referenced by changeRootPassword().
setRootUser | ( | $rootUser | ) |
Sets the MySQL root username and updates the configuration.
string | $rootUser | The root username to set. |
Definition at line 825 of file class.bin.mysql.php.
References $rootUser, and Module\replace().
setVersion | ( | $version | ) |
Sets the MySQL version and reloads the configuration.
string | $version | The version to set. |
Reimplemented from Module.
Definition at line 709 of file class.bin.mysql.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
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 489 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 505 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 45 of file class.bin.mysql.php.
Referenced by getDataDir(), and initData().
|
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(), changeRootPassword(), checkPort(), checkRootPassword(), 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 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 CMD_VARIABLES = 'variables' |
Definition at line 32 of file class.bin.mysql.php.
Referenced by ActionDebugMysql\__construct(), and TplAppMysql\getMenuMysqlDebug().
const CMD_VERSION = '--version' |
Definition at line 31 of file class.bin.mysql.php.
Referenced by ActionDebugMysql\__construct(), and TplAppMysql\getMenuMysqlDebug().
const LOCAL_CFG_ADMIN = 'mysqlAdmin' |
Definition at line 25 of file class.bin.mysql.php.
const LOCAL_CFG_CLI_EXE = 'mysqlCliExe' |
Definition at line 24 of file class.bin.mysql.php.
const LOCAL_CFG_CONF = 'mysqlConf' |
Definition at line 26 of file class.bin.mysql.php.
const LOCAL_CFG_EXE = 'mysqlExe' |
Definition at line 23 of file class.bin.mysql.php.
const LOCAL_CFG_PORT = 'mysqlPort' |
Definition at line 27 of file class.bin.mysql.php.
const LOCAL_CFG_ROOT_PWD = 'mysqlRootPwd' |
Definition at line 29 of file class.bin.mysql.php.
const LOCAL_CFG_ROOT_USER = 'mysqlRootUser' |
Definition at line 28 of file class.bin.mysql.php.
const ROOT_CFG_ENABLE = 'mysqlEnable' |
Definition at line 20 of file class.bin.mysql.php.
const ROOT_CFG_VERSION = 'mysqlVersion' |
Definition at line 21 of file class.bin.mysql.php.
const 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().