![]() |
Bearsampp 2026.9.23
|
Public Member Functions | |
| __construct ($id, $type) | |
| changePort ($port, $checkUsed=false, $wbProgressBar=null) | |
| checkPort ($port, $ssl=false, $showWindow=false) | |
| getAccessLog () | |
| getAlias () | |
| getAliasContent ($name, $dest) | |
| getCmdLineOutput ($cmd) | |
| getConf () | |
| getErrorLog () | |
| getExe () | |
| getModules () | |
| getModulesFromConf () | |
| getModulesLoaded () | |
| getModulesPath () | |
| getOpensslExe () | |
| getPort () | |
| getRewriteLog () | |
| getService () | |
| getSslConf () | |
| getSslPort () | |
| getVhostContent ($serverName, $documentRoot) | |
| getVhosts () | |
| getVhostsUrl () | |
| getWwwDirectories () | |
| refreshAlias ($putOnline) | |
| refreshConf ($putOnline) | |
| refreshVhosts ($putOnline) | |
| reload ($id=null, $type=null) | |
| setEnable ($enabled, $showWindow=false) | |
| setPort ($port) | |
| setSslPort ($sslPort) | |
| setVersion ($version) | |
| switchVersion ($version, $showWindow=false) | |
| Public Member Functions inherited from Module | |
| __toString () | |
| getId () | |
| getName () | |
| getRelease () | |
| getType () | |
| getVersion () | |
| getVersionList () | |
| isEnable () | |
| update ($sub=0, $showWindow=false) | |
Data Fields | |
| const | CMD_COMPILE_SETTINGS = '-V' |
| const | CMD_COMPILED_MODULES = '-l' |
| const | CMD_CONFIG_DIRECTIVES = '-L' |
| const | CMD_LOADED_MODULES = '-M' |
| const | CMD_SYNTAX_CHECK = '-t' |
| const | CMD_VERSION_NUMBER = '-v' |
| const | CMD_VHOSTS_SETTINGS = '-S' |
| const | LOCAL_CFG_CONF = 'apacheConf' |
| const | LOCAL_CFG_EXE = 'apacheExe' |
| const | LOCAL_CFG_OPENSSL_EXE = 'apacheOpensslExe' |
| const | LOCAL_CFG_PORT = 'apachePort' |
| const | LOCAL_CFG_SSL_PORT = 'apacheSslPort' |
| const | ROOT_CFG_ENABLE = 'apacheEnable' |
| const | ROOT_CFG_VERSION = 'apacheVersion' |
| const | SERVICE_NAME = 'bearsamppapache' |
| const | SERVICE_PARAMS = '-k runservice' |
| const | TAG_END_SWITCHONLINE = '# END switchOnline tag - Do not replace!' |
| const | TAG_START_SWITCHONLINE = '# START switchOnline tag - Do not replace!' |
| Data Fields inherited from Module | |
| $currentPath | |
| $rootPath | |
| $symlinkPath | |
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 | |
| getModulesFromFolder () | |
| getOfflineContent ($version=null) | |
| getOnlineContent ($version=null) | |
| getRequiredContent ($version=null) | |
Private Attributes | |
| $accessLog | |
| $conf | |
| $errorLog | |
| $exe | |
| $modulesPath | |
| $opensslExe | |
| $port | |
| $rewriteLog | |
| $service | |
| $sslConf | |
| $sslPort | |
Additional Inherited Members | |
| Static Public Member Functions inherited from Module | |
| static | clearMemoryCache () |
| static | invalidateConfigCacheForPath ($sourcePath) |
| Protected Attributes inherited from Module | |
| $bearsamppConf | |
| $bearsamppConfRaw | |
| $enable | |
| $name | |
| $release = 'N/A' | |
| $version | |
Class BinApache
This class represents the Apache module in the Bearsampp application. It provides functionalities to manage Apache services, configurations, and modules.
Definition at line 17 of file class.bin.apache.php.
| __construct | ( | $id, | |
| $type ) |
Constructor for the BinApache class.
| string | $id | The ID of the module. |
| string | $type | The type of the module. |
Definition at line 148 of file class.bin.apache.php.
References Module\$id, Module\$type, Log\initClass(), and reload().
| changePort | ( | $port, | |
| $checkUsed = false, | |||
| $wbProgressBar = null ) |
Changes the port for the Apache service.
| 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 updating progress. |
Definition at line 281 of file class.bin.apache.php.
References $port, Log\debug(), Log\error(), Module\getName(), ServiceHelper\isPortInUse(), Util\isValidPort(), setPort(), and Module\update().
| checkPort | ( | $port, | |
| $ssl = false, | |||
| $showWindow = false ) |
Checks if a specific port is being used by the Apache service.
| int | $port | The port number to check. |
| bool | $ssl | Whether to check for SSL. |
| bool | $showWindow | Whether to show a window with the result. |
Definition at line 321 of file class.bin.apache.php.
References $bearsamppLang, $port, Lang\CHECK_PORT_TITLE, Log\debug(), Log\error(), HttpClient\getHttpHeaders(), Module\getName(), Path\getWebResourcesPath(), Util\isValidPort(), Lang\PORT_NOT_USED, Lang\PORT_NOT_USED_BY, Lang\PORT_USED_BY, and UtilString\startWith().
| getAccessLog | ( | ) |
Gets the access log file path.
Definition at line 1066 of file class.bin.apache.php.
References $accessLog.
| getAlias | ( | ) |
Retrieves the list of alias configurations.
Definition at line 608 of file class.bin.apache.php.
References $bearsamppRoot, $result, UtilString\endWith(), and Path\getAliasPath().
Referenced by refreshAlias().
| getAliasContent | ( | $name, | |
| $dest ) |
Generates the alias content for the configuration file.
| string | $name | The name of the alias. |
| string | $dest | The destination path of the alias. |
Definition at line 809 of file class.bin.apache.php.
References Module\$name, Path\formatUnixPath(), and getRequiredContent().
| getCmdLineOutput | ( | $cmd | ) |
Executes a command line and retrieves the output.
| string | $cmd | The command to execute. |
Definition at line 721 of file class.bin.apache.php.
References $result, Batch\exec(), and getExe().
| getConf | ( | ) |
Gets the configuration file path.
Definition at line 1106 of file class.bin.apache.php.
References $conf.
Referenced by getModulesFromConf(), refreshConf(), and updateConfig().
| getErrorLog | ( | ) |
Gets the error log file path.
Definition at line 1086 of file class.bin.apache.php.
References $errorLog.
| getExe | ( | ) |
Gets the executable file path.
Definition at line 1096 of file class.bin.apache.php.
References $exe.
Referenced by getCmdLineOutput().
| getModules | ( | ) |
Retrieves the list of modules by merging the modules from the folder and the configuration file.
Definition at line 511 of file class.bin.apache.php.
References $result, getModulesFromConf(), and getModulesFromFolder().
| getModulesFromConf | ( | ) |
Retrieves the list of modules from the configuration file.
Definition at line 526 of file class.bin.apache.php.
References Module\$name, $result, getConf(), UtilString\startWith(), ActionSwitchApacheModule\SWITCH_OFF, and ActionSwitchApacheModule\SWITCH_ON.
Referenced by getModules(), and getModulesLoaded().
|
private |
Retrieves the list of modules from the modules folder.
Definition at line 577 of file class.bin.apache.php.
References Module\$name, $result, UtilString\endWith(), getModulesPath(), UtilString\startWith(), and ActionSwitchApacheModule\SWITCH_OFF.
Referenced by getModules().
| getModulesLoaded | ( | ) |
Retrieves the list of loaded modules from the configuration file.
Definition at line 560 of file class.bin.apache.php.
References Module\$name, $result, getModulesFromConf(), and ActionSwitchApacheModule\SWITCH_ON.
| getModulesPath | ( | ) |
Gets the path to the modules.
Definition at line 1046 of file class.bin.apache.php.
References $modulesPath.
Referenced by getModulesFromFolder().
|
private |
Generates the offline content for the configuration file.
| string | null | $version | The version of the configuration. |
Definition at line 771 of file class.bin.apache.php.
References $result, Module\$version, APP_LOCALHOST, Module\getVersion(), and UtilString\startWith().
Referenced by getRequiredContent(), refreshAlias(), refreshConf(), and refreshVhosts().
|
private |
Generates the online content for the configuration file.
| string | null | $version | The version of the configuration. |
Definition at line 749 of file class.bin.apache.php.
References $result, Module\$version, Module\getVersion(), and UtilString\startWith().
Referenced by getRequiredContent(), refreshAlias(), refreshConf(), and refreshVhosts().
| getOpensslExe | ( | ) |
Gets the OpenSSL executable file path.
Definition at line 1160 of file class.bin.apache.php.
References $opensslExe.
| getPort | ( | ) |
Gets the port number.
Definition at line 1116 of file class.bin.apache.php.
References $port.
Referenced by getVhostContent().
|
private |
Generates the required content for the configuration file based on the online status.
| string | null | $version | The version of the configuration. |
Definition at line 794 of file class.bin.apache.php.
References $bearsamppConfig, Module\$version, getOfflineContent(), and getOnlineContent().
Referenced by getAliasContent(), and getVhostContent().
| getRewriteLog | ( | ) |
Gets the rewrite log file path.
Definition at line 1076 of file class.bin.apache.php.
References $rewriteLog.
| getService | ( | ) |
Gets the service associated with the module.
Definition at line 1036 of file class.bin.apache.php.
References $service.
| getSslConf | ( | ) |
Gets the SSL configuration file path.
Definition at line 1056 of file class.bin.apache.php.
References $sslConf.
Referenced by refreshConf().
| getSslPort | ( | ) |
Gets the SSL port number.
Definition at line 1138 of file class.bin.apache.php.
References $sslPort.
Referenced by getVhostContent().
| getVhostContent | ( | $serverName, | |
| $documentRoot ) |
Generates the virtual host content for the configuration file.
| string | $serverName | The server name of the virtual host. |
| string | $documentRoot | The document root of the virtual host. |
Definition at line 829 of file class.bin.apache.php.
References $bearsamppRoot, Path\formatUnixPath(), Path\getLogsPath(), getPort(), getRequiredContent(), Path\getSslPath(), and getSslPort().
| getVhosts | ( | ) |
Retrieves the list of virtual hosts configurations.
Definition at line 635 of file class.bin.apache.php.
References $bearsamppRoot, $result, UtilString\endWith(), and Path\getVhostsPath().
Referenced by getVhostsUrl(), refreshVhosts(), and updateConfig().
| getVhostsUrl | ( | ) |
Retrieves the URLs of the virtual hosts.
Definition at line 662 of file class.bin.apache.php.
References $bearsamppRoot, $result, getVhosts(), Path\getVhostsPath(), and UtilString\startWith().
| getWwwDirectories | ( | ) |
Retrieves the list of directories in the www folder.
Definition at line 692 of file class.bin.apache.php.
References $bearsamppRoot, $result, and Path\getWwwPath().
| refreshAlias | ( | $putOnline | ) |
Refreshes the alias configurations to switch between online and offline modes.
| bool | $putOnline | Whether to put the alias configurations online. |
Definition at line 917 of file class.bin.apache.php.
References $bearsamppHomepage, $bearsamppRoot, Log\debug(), getAlias(), Path\getAliasPath(), getOfflineContent(), getOnlineContent(), and Log\trace().
| refreshConf | ( | $putOnline | ) |
Refreshes the configuration file to switch between online and offline modes.
| bool | $putOnline | Whether to put the configuration online. |
Definition at line 876 of file class.bin.apache.php.
References $conf, $sslConf, Log\debug(), getConf(), getOfflineContent(), getOnlineContent(), getSslConf(), and Log\trace().
| refreshVhosts | ( | $putOnline | ) |
Refreshes the virtual host configurations to switch between online and offline modes.
| bool | $putOnline | Whether to put the virtual host configurations online. |
Definition at line 952 of file class.bin.apache.php.
References $bearsamppRoot, Log\debug(), getOfflineContent(), getOnlineContent(), getVhosts(), Path\getVhostsPath(), and Log\trace().
| 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 160 of file class.bin.apache.php.
References $bearsamppConfig, $bearsamppLang, $bearsamppRoot, Module\$id, Module\$type, Lang\APACHE, APP_TITLE, Log\error(), Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, Lang\ERROR_INVALID_PARAMETER, Path\getLogsPath(), Module\getName(), Log\info(), Log\reloadClass(), and Nssm\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 250 of file class.bin.apache.php.
References Module\invalidateConfigCacheForPath().
| setEnable | ( | $enabled, | |
| $showWindow = false ) |
Sets the enable status of the module.
This method enables or disables the module based on the provided parameter. If enabling the module and the current path does not exist, it logs an error and optionally shows an error message window.
| bool | $enabled | Whether to enable or disable the module. |
| bool | $showWindow | Whether to show an error message window if enabling fails. |
Definition at line 989 of file class.bin.apache.php.
References $bearsamppConfig, $bearsamppLang, Log\debug(), Config\DISABLED, Lang\ENABLE_BUNDLE_NOT_EXIST, Lang\ENABLE_TITLE, Config\ENABLED, Module\getName(), Module\getVersion(), Log\info(), ServiceHelper\installService(), reload(), and ServiceHelper\removeService().
| setPort | ( | $port | ) |
Sets the port number.
This method updates the port number in the configuration.
| int | $port | The port number to set. |
Definition at line 1128 of file class.bin.apache.php.
References $port, and Module\replace().
Referenced by changePort().
| setSslPort | ( | $sslPort | ) |
Sets the SSL port number.
This method updates the SSL port number in the configuration.
| int | $sslPort | The SSL port number to set. |
Definition at line 1150 of file class.bin.apache.php.
References $sslPort, and Module\replace().
| setVersion | ( | $version | ) |
Sets the version of the module.
This method updates the version of the module and reloads its configuration.
| string | $version | The version to set for the module. |
Reimplemented from Module.
Definition at line 1023 of file class.bin.apache.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
| switchVersion | ( | $version, | |
| $showWindow = false ) |
Switches the Apache version.
| string | $version | The version to switch to. |
| bool | $showWindow | Whether to show a window with the result. |
Definition at line 379 of file class.bin.apache.php.
References Module\$version, Log\debug(), and updateConfig().
|
protected |
Updates the Apache 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 window during the update process. |
Reimplemented from Module.
Definition at line 395 of file class.bin.apache.php.
References $bearsamppBins, Module\$bearsamppConf, Module\$bearsamppConfRaw, $bearsamppLang, $bearsamppRoot, $conf, Module\$version, Lang\APACHE_INCPT, Lang\BEARSAMPP_CONF_MALFORMED_ERROR, Lang\BEARSAMPP_CONF_NOT_FOUND_ERROR, Log\debug(), Log\error(), getConf(), Path\getModuleSymlinkPath(), Module\getName(), Module\getVersion(), getVhosts(), Path\getVhostsPath(), Path\getWwwPath(), Util\replaceInFile(), setVersion(), and Lang\SWITCH_VERSION_TITLE.
Referenced by switchVersion().
|
private |
Definition at line 111 of file class.bin.apache.php.
Referenced by getAccessLog().
|
private |
Definition at line 128 of file class.bin.apache.php.
Referenced by getConf(), refreshConf(), and updateConfig().
|
private |
Definition at line 119 of file class.bin.apache.php.
Referenced by getErrorLog().
|
private |
Definition at line 124 of file class.bin.apache.php.
Referenced by getExe().
|
private |
Definition at line 103 of file class.bin.apache.php.
Referenced by getModulesPath().
|
private |
Definition at line 140 of file class.bin.apache.php.
Referenced by getOpensslExe().
|
private |
Definition at line 132 of file class.bin.apache.php.
Referenced by changePort(), checkPort(), getPort(), and setPort().
|
private |
Definition at line 115 of file class.bin.apache.php.
Referenced by getRewriteLog().
|
private |
Definition at line 99 of file class.bin.apache.php.
Referenced by getService().
|
private |
Definition at line 107 of file class.bin.apache.php.
Referenced by getSslConf(), and refreshConf().
|
private |
Definition at line 136 of file class.bin.apache.php.
Referenced by getSslPort(), and setSslPort().
| const CMD_COMPILE_SETTINGS = '-V' |
Command line option to display Apache compile settings.
Definition at line 65 of file class.bin.apache.php.
Referenced by ActionDebugApache\getCommandMapping(), and TplAppApache\getMenuApacheDebug().
| const CMD_COMPILED_MODULES = '-l' |
Command line option to display compiled Apache modules.
Definition at line 69 of file class.bin.apache.php.
Referenced by ActionDebugApache\getCommandMapping(), and TplAppApache\getMenuApacheDebug().
| const CMD_CONFIG_DIRECTIVES = '-L' |
Command line option to display Apache configuration directives.
Definition at line 73 of file class.bin.apache.php.
Referenced by ActionDebugApache\getCommandMapping(), and TplAppApache\getMenuApacheDebug().
| const CMD_LOADED_MODULES = '-M' |
Command line option to display loaded Apache modules.
Definition at line 81 of file class.bin.apache.php.
Referenced by ActionDebugApache\getCommandMapping(), and TplAppApache\getMenuApacheDebug().
| const CMD_SYNTAX_CHECK = '-t' |
Command line option to perform a syntax check on the Apache configuration.
Definition at line 85 of file class.bin.apache.php.
Referenced by ActionService\__construct(), ActionDebugApache\getCommandMapping(), TplAppApache\getMenuApacheDebug(), ServiceHelper\hasSyntaxCheck(), ServiceHelper\initializeMappings(), ActionStartup\prepareService(), BinPhp\setEnable(), and Win32Service\start().
| const CMD_VERSION_NUMBER = '-v' |
Command line option to display the Apache version number.
Definition at line 61 of file class.bin.apache.php.
Referenced by ActionDebugApache\getCommandMapping(), and TplAppApache\getMenuApacheDebug().
| const CMD_VHOSTS_SETTINGS = '-S' |
Command line option to display Apache virtual host settings.
Definition at line 77 of file class.bin.apache.php.
Referenced by ActionDebugApache\getCommandMapping(), and TplAppApache\getMenuApacheDebug().
| const LOCAL_CFG_CONF = 'apacheConf' |
Configuration key for the Apache configuration file in the local configuration.
Definition at line 44 of file class.bin.apache.php.
| const LOCAL_CFG_EXE = 'apacheExe' |
Configuration key for the Apache executable in the local configuration.
Definition at line 40 of file class.bin.apache.php.
| const LOCAL_CFG_OPENSSL_EXE = 'apacheOpensslExe' |
Configuration key for the Apache OpenSSL executable in the local configuration.
Definition at line 56 of file class.bin.apache.php.
| const LOCAL_CFG_PORT = 'apachePort' |
Configuration key for the Apache port in the local configuration.
Definition at line 48 of file class.bin.apache.php.
| const LOCAL_CFG_SSL_PORT = 'apacheSslPort' |
Configuration key for the Apache SSL port in the local configuration.
Definition at line 52 of file class.bin.apache.php.
| const ROOT_CFG_ENABLE = 'apacheEnable' |
Configuration key for the Apache enable flag in the root configuration.
Definition at line 31 of file class.bin.apache.php.
| const ROOT_CFG_VERSION = 'apacheVersion' |
Configuration key for the Apache version in the root configuration.
Definition at line 35 of file class.bin.apache.php.
| const SERVICE_NAME = 'bearsamppapache' |
The name of the Windows service.
Definition at line 22 of file class.bin.apache.php.
Referenced by ActionService\__construct(), ServiceHelper\forceKillService(), TplAppApache\getActionInstallApacheService(), TplAppApache\getActionRemoveApacheService(), TplAppOnline\getActionStatus(), TplAppApache\getActionSwitchApacheModule(), TplAppPhp\getActionSwitchPhpExtension(), TplAppPhp\getActionSwitchPhpSetting(), ServiceHelper\getAllServiceNames(), ActionQuit\getServiceDisplayName(), Bins\getServices(), ActionQuit\getServiceShutdownOrder(), ActionRestartAllServices\getServiceShutdownOrder(), ActionRestartAllServices\getServiceStartupOrder(), ServiceHelper\hasSyntaxCheck(), ServiceHelper\initializeMappings(), ActionStartup\prepareService(), and Win32Service\start().
| const SERVICE_PARAMS = '-k runservice' |
The command line parameters passed to the Apache service.
Definition at line 26 of file class.bin.apache.php.
| const TAG_END_SWITCHONLINE = '# END switchOnline tag - Do not replace!' |
The end tag marker for the switchOnline section in the configuration file.
Definition at line 94 of file class.bin.apache.php.
| const TAG_START_SWITCHONLINE = '# START switchOnline tag - Do not replace!' |
The start tag marker for the switchOnline section in the configuration file.
Definition at line 90 of file class.bin.apache.php.