![]() |
Bearsampp 2025.8.29
API Documentation for Bearsampp
|
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 Member Functions | |
| handleNonPostgresUsage ($port, $showWindow, $boxTitle) | |
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.
| __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().
| 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().
| 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 315 of file class.bin.postgresql.php.
References $result, setRootPwd(), and Module\update().
| checkPort | ( | $port, | |
| $showWindow = false ) |
Checks if the specified port is being used by PostgreSQL
| int | $port | The port number to check |
| bool | $showWindow | Whether to show a message box with the result |
Definition at line 244 of file class.bin.postgresql.php.
References $bearsamppLang, $port, Lang\CHECK_PORT_TITLE, Module\getName(), handleNonPostgresUsage(), Util\isValidPort(), Util\logDebug(), Util\logError(), and Lang\PORT_USED_BY.
| 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 364 of file class.bin.postgresql.php.
| getCliExe | ( | ) |
Gets the path to the PostgreSQL command line interface executable.
Definition at line 605 of file class.bin.postgresql.php.
References $cliExe.
Referenced by getCmdLineOutput().
| getCmdLineOutput | ( | $cmd | ) |
Executes a PostgreSQL command line instruction and returns the output.
| string | $cmd | The command to execute. |
Definition at line 508 of file class.bin.postgresql.php.
References $result, Batch\exec(), and getCliExe().
| getConf | ( | ) |
Gets the path to the PostgreSQL configuration file.
Definition at line 635 of file class.bin.postgresql.php.
References $conf.
Referenced by updateConfig().
| getCtlExe | ( | ) |
Gets the path to the PostgreSQL control executable.
Definition at line 595 of file class.bin.postgresql.php.
References $ctlExe.
| getDumpAllExe | ( | ) |
Gets the path to the PostgreSQL dump all executable.
Definition at line 625 of file class.bin.postgresql.php.
References $dumpAllExe.
| getDumpExe | ( | ) |
Gets the path to the PostgreSQL dump executable.
Definition at line 615 of file class.bin.postgresql.php.
References $dumpExe.
| getErrorLog | ( | ) |
Gets the path to the PostgreSQL error log file.
Definition at line 585 of file class.bin.postgresql.php.
References $errorLog.
| getHbaConf | ( | ) |
Gets the path to the PostgreSQL host-based authentication configuration file.
Definition at line 645 of file class.bin.postgresql.php.
References $hbaConf.
| getPort | ( | ) |
Gets the port number used by PostgreSQL.
Definition at line 655 of file class.bin.postgresql.php.
References $port.
| getRootPwd | ( | ) |
Gets the root password for PostgreSQL.
Definition at line 695 of file class.bin.postgresql.php.
References $rootPwd.
| getRootUser | ( | ) |
Gets the root user for PostgreSQL.
Definition at line 675 of file class.bin.postgresql.php.
References $rootUser.
| getService | ( | ) |
Gets the service object for PostgreSQL.
Definition at line 541 of file class.bin.postgresql.php.
References $service.
|
private |
Handles non-PostgreSQL port usage scenarios
Definition at line 282 of file class.bin.postgresql.php.
References $bearsamppLang, $port, Module\getName(), Util\isPortInUse(), Util\logDebug(), Lang\PORT_NOT_USED, and Lang\PORT_USED_BY_ANOTHER_DBMS.
Referenced by checkPort().
| 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 477 of file class.bin.postgresql.php.
References Module\getCurrentPath(), and Batch\initializePostgresql().
Referenced by updateConfig().
| rebuildConf | ( | ) |
Rebuilds the PostgreSQL configuration files by updating the port number.
Definition at line 491 of file class.bin.postgresql.php.
References Util\replaceInFile().
| 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(), 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.
| 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 552 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().
| setPort | ( | $port | ) |
Sets the port number used by PostgreSQL.
| int | $port | The port number to set. |
Definition at line 665 of file class.bin.postgresql.php.
References $port, and Module\replace().
Referenced by changePort().
| setRootPwd | ( | $rootPwd | ) |
Sets the root password for PostgreSQL.
| string | $rootPwd | The root password to set. |
Definition at line 705 of file class.bin.postgresql.php.
References $rootPwd, and Module\replace().
Referenced by changeRootPassword().
| setRootUser | ( | $rootUser | ) |
Sets the root user for PostgreSQL.
| string | $rootUser | The root user to set. |
Definition at line 685 of file class.bin.postgresql.php.
References $rootUser, and Module\replace().
| setVersion | ( | $version | ) |
Sets the version of PostgreSQL and reloads the configuration.
| string | $version | The version to set. |
Reimplemented from Module.
Definition at line 528 of file class.bin.postgresql.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
| 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 396 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 412 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(), handleNonPostgresUsage(), 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 CMD_VERSION = '--version' |
Definition at line 35 of file class.bin.postgresql.php.
Referenced by ActionDebugPostgresql\__construct(), and TplAppPostgresql\getMenuPostgresqlDebug().
| const LOCAL_CFG_ALT_CONF = 'postgresqlAltConf' |
Definition at line 29 of file class.bin.postgresql.php.
| const LOCAL_CFG_ALT_HBA_CONF = 'postgresqlAltUserConf' |
Definition at line 30 of file class.bin.postgresql.php.
| const LOCAL_CFG_CLI_EXE = 'postgresqlCliExe' |
Definition at line 24 of file class.bin.postgresql.php.
| const LOCAL_CFG_CONF = 'postgresqlConf' |
Definition at line 27 of file class.bin.postgresql.php.
| const LOCAL_CFG_CTL_EXE = 'postgresqlCtlExe' |
Definition at line 23 of file class.bin.postgresql.php.
| const LOCAL_CFG_DUMP_ALL_EXE = 'postgresqlDumpAllExe' |
Definition at line 26 of file class.bin.postgresql.php.
| const LOCAL_CFG_DUMP_EXE = 'postgresqlDumpExe' |
Definition at line 25 of file class.bin.postgresql.php.
| const LOCAL_CFG_HBA_CONF = 'postgresqlUserConf' |
Definition at line 28 of file class.bin.postgresql.php.
| const LOCAL_CFG_PORT = 'postgresqlPort' |
Definition at line 31 of file class.bin.postgresql.php.
| const LOCAL_CFG_ROOT_PWD = 'postgresqlRootPwd' |
Definition at line 33 of file class.bin.postgresql.php.
| const LOCAL_CFG_ROOT_USER = 'postgresqlRootUser' |
Definition at line 32 of file class.bin.postgresql.php.
| const ROOT_CFG_ENABLE = 'postgresqlEnable' |
Definition at line 20 of file class.bin.postgresql.php.
| const ROOT_CFG_VERSION = 'postgresqlVersion' |
Definition at line 21 of file class.bin.postgresql.php.
| const 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().