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) | |
getCliExe () | |
getCmdLineOutput ($cmd) | |
getConf () | |
getCtlExe () | |
getDumpAllExe () | |
getDumpExe () | |
getErrorLog () | |
getHbaConf () | |
getPort () | |
getRootPwd () | |
getRootUser () | |
getService () | |
initData ($path=null) | |
rebuildConf () | |
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_VERSION = '--version' |
const | LOCAL_CFG_ALT_CONF = 'postgresqlAltConf' |
const | LOCAL_CFG_ALT_HBA_CONF = 'postgresqlAltUserConf' |
const | LOCAL_CFG_CLI_EXE = 'postgresqlCliExe' |
const | LOCAL_CFG_CONF = 'postgresqlConf' |
const | LOCAL_CFG_CTL_EXE = 'postgresqlCtlExe' |
const | LOCAL_CFG_DUMP_ALL_EXE = 'postgresqlDumpAllExe' |
const | LOCAL_CFG_DUMP_EXE = 'postgresqlDumpExe' |
const | LOCAL_CFG_HBA_CONF = 'postgresqlUserConf' |
const | LOCAL_CFG_PORT = 'postgresqlPort' |
const | LOCAL_CFG_ROOT_PWD = 'postgresqlRootPwd' |
const | LOCAL_CFG_ROOT_USER = 'postgresqlRootUser' |
const | ROOT_CFG_ENABLE = 'postgresqlEnable' |
const | ROOT_CFG_VERSION = 'postgresqlVersion' |
const | SERVICE_NAME = 'bearsampppostgresql' |
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 | |
$altConf | |
$altHbaConf | |
$cliExe | |
$conf | |
$ctlExe | |
$dumpAllExe | |
$dumpExe | |
$errorLog | |
$hbaConf | |
$port | |
$rootPwd | |
$rootUser | |
$service | |
Additional Inherited Members | |
Protected Attributes inherited from Module | |
$bearsamppConf | |
$bearsamppConfRaw | |
$currentPath | |
$enable | |
$name | |
$release = 'N/A' | |
$rootPath | |
$symlinkPath | |
$version | |
Class BinPostgresql
This class represents the PostgreSQL module in the Bearsampp application. It handles the configuration, management, and operations related to PostgreSQL.
Definition at line 16 of file class.bin.postgresql.php.
BinPostgresql::__construct | ( | $id, | |
$type ) |
Constructor for the BinPostgresql class.
string | $id | The ID of the module. |
string | $type | The type of the module. |
Definition at line 57 of file class.bin.postgresql.php.
References Module\$id, Module\$type, Util\logInitClass(), and reload().
BinPostgresql::changePort | ( | $port, | |
$checkUsed = false, | |||
$wbProgressBar = null ) |
Changes the port used by PostgreSQL.
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 207 of file class.bin.postgresql.php.
References $port, Module\getName(), Util\isPortInUse(), Util\isValidPort(), Util\logDebug(), Util\logError(), setPort(), and Module\update().
BinPostgresql::changeRootPassword | ( | $currentPwd, | |
$newPwd, | |||
$wbProgressBar = null ) |
Changes the root password for PostgreSQL.
string | $currentPwd | The current root password. |
string | $newPwd | The new root password. |
mixed | $wbProgressBar | The progress bar object for UI updates. |
Definition at line 326 of file class.bin.postgresql.php.
References $result, setRootPwd(), and Module\update().
BinPostgresql::checkPort | ( | $port, | |
$showWindow = false ) |
Checks if the specified port is used by PostgreSQL.
int | $port | The port number to check. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 246 of file class.bin.postgresql.php.
References $bearsamppLang, $port, $result, Module\$version, Lang\CHECK_PORT_TITLE, Module\getName(), Module\getVersion(), Util\isValidPort(), Util\logDebug(), Util\logError(), Lang\PORT_NOT_USED, Lang\PORT_NOT_USED_BY, Lang\PORT_USED_BY, and Lang\PORT_USED_BY_ANOTHER_DBMS.
BinPostgresql::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 375 of file class.bin.postgresql.php.
BinPostgresql::getCliExe | ( | ) |
Gets the path to the PostgreSQL command line interface executable.
Definition at line 619 of file class.bin.postgresql.php.
References $cliExe.
Referenced by getCmdLineOutput().
BinPostgresql::getCmdLineOutput | ( | $cmd | ) |
Executes a PostgreSQL command line instruction and returns the output.
string | $cmd | The command to execute. |
Definition at line 522 of file class.bin.postgresql.php.
References $result, Batch\exec(), and getCliExe().
BinPostgresql::getConf | ( | ) |
Gets the path to the PostgreSQL configuration file.
Definition at line 649 of file class.bin.postgresql.php.
References $conf.
Referenced by updateConfig().
BinPostgresql::getCtlExe | ( | ) |
Gets the path to the PostgreSQL control executable.
Definition at line 609 of file class.bin.postgresql.php.
References $ctlExe.
BinPostgresql::getDumpAllExe | ( | ) |
Gets the path to the PostgreSQL dump all executable.
Definition at line 639 of file class.bin.postgresql.php.
References $dumpAllExe.
BinPostgresql::getDumpExe | ( | ) |
Gets the path to the PostgreSQL dump executable.
Definition at line 629 of file class.bin.postgresql.php.
References $dumpExe.
BinPostgresql::getErrorLog | ( | ) |
Gets the path to the PostgreSQL error log file.
Definition at line 599 of file class.bin.postgresql.php.
References $errorLog.
BinPostgresql::getHbaConf | ( | ) |
Gets the path to the PostgreSQL host-based authentication configuration file.
Definition at line 659 of file class.bin.postgresql.php.
References $hbaConf.
BinPostgresql::getPort | ( | ) |
Gets the port number used by PostgreSQL.
Definition at line 669 of file class.bin.postgresql.php.
References $port.
BinPostgresql::getRootPwd | ( | ) |
Gets the root password for PostgreSQL.
Definition at line 709 of file class.bin.postgresql.php.
References $rootPwd.
BinPostgresql::getRootUser | ( | ) |
Gets the root user for PostgreSQL.
Definition at line 689 of file class.bin.postgresql.php.
References $rootUser.
BinPostgresql::getService | ( | ) |
Gets the service object for PostgreSQL.
Definition at line 555 of file class.bin.postgresql.php.
References $service.
BinPostgresql::initData | ( | $path = null | ) |
Initializes the data directory for PostgreSQL if it does not already exist.
string | null | $path | The path to the PostgreSQL data directory. If null, the current path is used. |
Definition at line 491 of file class.bin.postgresql.php.
References Module\getCurrentPath(), and Batch\initializePostgresql().
Referenced by updateConfig().
BinPostgresql::rebuildConf | ( | ) |
Rebuilds the PostgreSQL configuration files by updating the port number.
Definition at line 505 of file class.bin.postgresql.php.
References Util\replaceInFile().
BinPostgresql::reload | ( | $id = null, | |
$type = null ) |
Reloads the 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 69 of file class.bin.postgresql.php.
References $altConf, $altHbaConf, $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_ALT_CONF, LOCAL_CFG_ALT_HBA_CONF, LOCAL_CFG_CLI_EXE, LOCAL_CFG_CONF, LOCAL_CFG_CTL_EXE, LOCAL_CFG_DUMP_ALL_EXE, LOCAL_CFG_DUMP_EXE, LOCAL_CFG_HBA_CONF, LOCAL_CFG_PORT, LOCAL_CFG_ROOT_PWD, LOCAL_CFG_ROOT_USER, Util\logError(), Util\logInfo(), Util\logReloadClass(), Lang\POSTGRESQL, 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 175 of file class.bin.postgresql.php.
References LOCAL_CFG_PORT, LOCAL_CFG_ROOT_PWD, and LOCAL_CFG_ROOT_USER.
BinPostgresql::setEnable | ( | $enabled, | |
$showWindow = false ) |
Enables or disables the PostgreSQL module.
bool | $enabled | Whether to enable or disable the module. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 566 of file class.bin.postgresql.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().
BinPostgresql::setPort | ( | $port | ) |
Sets the port number used by PostgreSQL.
int | $port | The port number to set. |
Definition at line 679 of file class.bin.postgresql.php.
References $port, and Module\replace().
Referenced by changePort().
BinPostgresql::setRootPwd | ( | $rootPwd | ) |
Sets the root password for PostgreSQL.
string | $rootPwd | The root password to set. |
Definition at line 719 of file class.bin.postgresql.php.
References $rootPwd, and Module\replace().
Referenced by changeRootPassword().
BinPostgresql::setRootUser | ( | $rootUser | ) |
Sets the root user for PostgreSQL.
string | $rootUser | The root user to set. |
Definition at line 699 of file class.bin.postgresql.php.
References $rootUser, and Module\replace().
BinPostgresql::setVersion | ( | $version | ) |
Sets the version of PostgreSQL and reloads the configuration.
string | $version | The version to set. |
Reimplemented from Module.
Definition at line 542 of file class.bin.postgresql.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
BinPostgresql::switchVersion | ( | $version, | |
$showWindow = false ) |
Switches the PostgreSQL version.
string | $version | The version to switch to. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 407 of file class.bin.postgresql.php.
References Module\$version, Util\logDebug(), and updateConfig().
|
protected |
Updates the PostgreSQL configuration.
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 window during the update process. |
Reimplemented from Module.
Definition at line 423 of file class.bin.postgresql.php.
References 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 45 of file class.bin.postgresql.php.
Referenced by reload().
|
private |
Definition at line 46 of file class.bin.postgresql.php.
Referenced by reload().
|
private |
Definition at line 40 of file class.bin.postgresql.php.
Referenced by getCliExe().
|
private |
Definition at line 43 of file class.bin.postgresql.php.
Referenced by getConf(), and updateConfig().
|
private |
Definition at line 39 of file class.bin.postgresql.php.
Referenced by getCtlExe().
|
private |
Definition at line 42 of file class.bin.postgresql.php.
Referenced by getDumpAllExe().
|
private |
Definition at line 41 of file class.bin.postgresql.php.
Referenced by getDumpExe().
|
private |
Definition at line 38 of file class.bin.postgresql.php.
Referenced by getErrorLog().
|
private |
Definition at line 44 of file class.bin.postgresql.php.
Referenced by getHbaConf().
|
private |
Definition at line 47 of file class.bin.postgresql.php.
Referenced by changePort(), checkPort(), getPort(), and setPort().
|
private |
Definition at line 49 of file class.bin.postgresql.php.
Referenced by getRootPwd(), and setRootPwd().
|
private |
Definition at line 48 of file class.bin.postgresql.php.
Referenced by getRootUser(), and setRootUser().
|
private |
Definition at line 37 of file class.bin.postgresql.php.
Referenced by getService().
const BinPostgresql::CMD_VERSION = '--version' |
Definition at line 35 of file class.bin.postgresql.php.
Referenced by ActionDebugPostgresql\__construct(), and TplAppPostgresql\getMenuPostgresqlDebug().
const BinPostgresql::LOCAL_CFG_ALT_CONF = 'postgresqlAltConf' |
Definition at line 29 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_ALT_HBA_CONF = 'postgresqlAltUserConf' |
Definition at line 30 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_CLI_EXE = 'postgresqlCliExe' |
Definition at line 24 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_CONF = 'postgresqlConf' |
Definition at line 27 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_CTL_EXE = 'postgresqlCtlExe' |
Definition at line 23 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_DUMP_ALL_EXE = 'postgresqlDumpAllExe' |
Definition at line 26 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_DUMP_EXE = 'postgresqlDumpExe' |
Definition at line 25 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_HBA_CONF = 'postgresqlUserConf' |
Definition at line 28 of file class.bin.postgresql.php.
Referenced by reload().
const BinPostgresql::LOCAL_CFG_PORT = 'postgresqlPort' |
Definition at line 31 of file class.bin.postgresql.php.
Referenced by reload(), and replaceAll().
const BinPostgresql::LOCAL_CFG_ROOT_PWD = 'postgresqlRootPwd' |
Definition at line 33 of file class.bin.postgresql.php.
Referenced by reload(), and replaceAll().
const BinPostgresql::LOCAL_CFG_ROOT_USER = 'postgresqlRootUser' |
Definition at line 32 of file class.bin.postgresql.php.
Referenced by reload(), and replaceAll().
const BinPostgresql::ROOT_CFG_ENABLE = 'postgresqlEnable' |
Definition at line 20 of file class.bin.postgresql.php.
const BinPostgresql::ROOT_CFG_VERSION = 'postgresqlVersion' |
Definition at line 21 of file class.bin.postgresql.php.
const BinPostgresql::SERVICE_NAME = 'bearsampppostgresql' |
Definition at line 18 of file class.bin.postgresql.php.
Referenced by ActionService\__construct(), Win32Service\create(), Win32Service\delete(), TplAppPostgresql\getActionInstallPostgresqlService(), TplAppPostgresql\getActionRemovePostgresqlService(), Bins\getServices(), Batch\installPostgresqlService(), ActionStartup\installServices(), ActionQuit\processWindow(), Win32Service\start(), and Batch\uninstallPostgresqlService().