![]() |
Bearsampp 2025.8.29
|
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 () | |
getCurrentPath () | |
getId () | |
getName () | |
getRelease () | |
getRootPath () | |
getSymlinkPath () | |
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 | |
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 | |
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 | |
Protected Attributes inherited from Module | |
$bearsamppConf | |
$bearsamppConfRaw | |
$currentPath | |
$enable | |
$name | |
$release = 'N/A' | |
$rootPath | |
$symlinkPath | |
$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 61 of file class.bin.apache.php.
References Module\$id, Module\$type, Util\logInitClass(), 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 191 of file class.bin.apache.php.
References $port, Module\getName(), Util\isPortInUse(), Util\isValidPort(), Util\logDebug(), Util\logError(), 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 231 of file class.bin.apache.php.
References $bearsamppHomepage, $bearsamppLang, $port, Lang\CHECK_PORT_TITLE, Util\getHttpHeaders(), Module\getName(), Util\isValidPort(), Util\logDebug(), Util\logError(), Lang\PORT_NOT_USED, Lang\PORT_NOT_USED_BY, Lang\PORT_USED_BY, and Util\startWith().
getAccessLog | ( | ) |
Gets the access log file path.
Definition at line 971 of file class.bin.apache.php.
References $accessLog.
getAlias | ( | ) |
Retrieves the list of alias configurations.
Definition at line 506 of file class.bin.apache.php.
References $bearsamppRoot, $result, and Util\endWith().
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 709 of file class.bin.apache.php.
References Module\$name, Util\formatUnixPath(), and getRequiredContent().
getCmdLineOutput | ( | $cmd | ) |
Executes a command line and retrieves the output.
string | $cmd | The command to execute. |
Definition at line 619 of file class.bin.apache.php.
References $result, Batch\exec(), and getExe().
getConf | ( | ) |
Gets the configuration file path.
Definition at line 1011 of file class.bin.apache.php.
References $conf.
Referenced by getModulesFromConf(), refreshConf(), and updateConfig().
getErrorLog | ( | ) |
Gets the error log file path.
Definition at line 991 of file class.bin.apache.php.
References $errorLog.
getExe | ( | ) |
Gets the executable file path.
Definition at line 1001 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 408 of file class.bin.apache.php.
References $result, getModulesFromConf(), and getModulesFromFolder().
getModulesFromConf | ( | ) |
Retrieves the list of modules from the configuration file.
Definition at line 423 of file class.bin.apache.php.
References Module\$name, $result, getConf(), Util\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 475 of file class.bin.apache.php.
References Module\$name, $result, Util\endWith(), getModulesPath(), Util\startWith(), and ActionSwitchApacheModule\SWITCH_OFF.
Referenced by getModules().
getModulesLoaded | ( | ) |
Retrieves the list of loaded modules from the configuration file.
Definition at line 458 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 951 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 670 of file class.bin.apache.php.
References $result, Module\$version, Module\getVersion(), and Util\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 647 of file class.bin.apache.php.
References $result, Module\$version, Module\getVersion(), and Util\startWith().
Referenced by getRequiredContent(), refreshAlias(), refreshConf(), and refreshVhosts().
getOpensslExe | ( | ) |
Gets the OpenSSL executable file path.
Definition at line 1065 of file class.bin.apache.php.
References $opensslExe.
getPort | ( | ) |
Gets the port number.
Definition at line 1021 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 694 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 981 of file class.bin.apache.php.
References $rewriteLog.
getService | ( | ) |
Gets the service associated with the module.
Definition at line 941 of file class.bin.apache.php.
References $service.
getSslConf | ( | ) |
Gets the SSL configuration file path.
Definition at line 961 of file class.bin.apache.php.
References $sslConf.
Referenced by refreshConf().
getSslPort | ( | ) |
Gets the SSL port number.
Definition at line 1043 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 729 of file class.bin.apache.php.
References $bearsamppRoot, Util\formatUnixPath(), getPort(), getRequiredContent(), and getSslPort().
getVhosts | ( | ) |
Retrieves the list of virtual hosts configurations.
Definition at line 533 of file class.bin.apache.php.
References $bearsamppRoot, $result, and Util\endWith().
Referenced by getVhostsUrl(), refreshVhosts(), and updateConfig().
getVhostsUrl | ( | ) |
Retrieves the URLs of the virtual hosts.
Definition at line 560 of file class.bin.apache.php.
References $bearsamppRoot, $result, getVhosts(), and Util\startWith().
getWwwDirectories | ( | ) |
Retrieves the list of directories in the www folder.
Definition at line 590 of file class.bin.apache.php.
References $bearsamppRoot, and $result.
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 819 of file class.bin.apache.php.
References $bearsamppHomepage, $bearsamppRoot, getAlias(), getOfflineContent(), getOnlineContent(), Util\logDebug(), and Util\logTrace().
refreshConf | ( | $putOnline | ) |
Refreshes the configuration file to switch between online and offline modes.
bool | $putOnline | Whether to put the configuration online. |
Definition at line 776 of file class.bin.apache.php.
References $conf, $sslConf, getConf(), getOfflineContent(), getOnlineContent(), getSslConf(), Util\logDebug(), and Util\logTrace().
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 855 of file class.bin.apache.php.
References $bearsamppRoot, getOfflineContent(), getOnlineContent(), getVhosts(), Util\logDebug(), and Util\logTrace().
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 73 of file class.bin.apache.php.
References $bearsamppConfig, $bearsamppLang, $bearsamppRoot, Module\$id, Module\$type, Lang\APACHE, 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(), 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 162 of file class.bin.apache.php.
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 893 of file class.bin.apache.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.
This method updates the port number in the configuration.
int | $port | The port number to set. |
Definition at line 1033 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 1055 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 928 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 286 of file class.bin.apache.php.
References Module\$version, Util\logDebug(), 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 302 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, getConf(), Module\getName(), Module\getVersion(), getVhosts(), Util\logDebug(), Util\logError(), Util\replaceInFile(), setVersion(), and Lang\SWITCH_VERSION_TITLE.
Referenced by switchVersion().
|
private |
Definition at line 45 of file class.bin.apache.php.
Referenced by getAccessLog().
|
private |
Definition at line 50 of file class.bin.apache.php.
Referenced by getConf(), refreshConf(), and updateConfig().
|
private |
Definition at line 47 of file class.bin.apache.php.
Referenced by getErrorLog().
|
private |
Definition at line 49 of file class.bin.apache.php.
Referenced by getExe().
|
private |
Definition at line 43 of file class.bin.apache.php.
Referenced by getModulesPath().
|
private |
Definition at line 53 of file class.bin.apache.php.
Referenced by getOpensslExe().
|
private |
Definition at line 51 of file class.bin.apache.php.
Referenced by changePort(), checkPort(), getPort(), and setPort().
|
private |
Definition at line 46 of file class.bin.apache.php.
Referenced by getRewriteLog().
|
private |
Definition at line 42 of file class.bin.apache.php.
Referenced by getService().
|
private |
Definition at line 44 of file class.bin.apache.php.
Referenced by getSslConf(), and refreshConf().
|
private |
Definition at line 52 of file class.bin.apache.php.
Referenced by getSslPort(), and setSslPort().
const CMD_COMPILE_SETTINGS = '-V' |
Definition at line 32 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const CMD_COMPILED_MODULES = '-l' |
Definition at line 33 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const CMD_CONFIG_DIRECTIVES = '-L' |
Definition at line 34 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const CMD_LOADED_MODULES = '-M' |
Definition at line 36 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const CMD_SYNTAX_CHECK = '-t' |
Definition at line 37 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), ActionService\__construct(), TplAppApache\getMenuApacheDebug(), ActionStartup\installServices(), BinPhp\setEnable(), and Win32Service\start().
const CMD_VERSION_NUMBER = '-v' |
Definition at line 31 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const CMD_VHOSTS_SETTINGS = '-S' |
Definition at line 35 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const LOCAL_CFG_CONF = 'apacheConf' |
Definition at line 26 of file class.bin.apache.php.
const LOCAL_CFG_EXE = 'apacheExe' |
Definition at line 25 of file class.bin.apache.php.
const LOCAL_CFG_OPENSSL_EXE = 'apacheOpensslExe' |
Definition at line 29 of file class.bin.apache.php.
const LOCAL_CFG_PORT = 'apachePort' |
Definition at line 27 of file class.bin.apache.php.
const LOCAL_CFG_SSL_PORT = 'apacheSslPort' |
Definition at line 28 of file class.bin.apache.php.
const ROOT_CFG_ENABLE = 'apacheEnable' |
Definition at line 22 of file class.bin.apache.php.
const ROOT_CFG_VERSION = 'apacheVersion' |
Definition at line 23 of file class.bin.apache.php.
const SERVICE_NAME = 'bearsamppapache' |
Definition at line 19 of file class.bin.apache.php.
Referenced by ActionService\__construct(), TplAppApache\getActionInstallApacheService(), TplAppApache\getActionRemoveApacheService(), TplAppOnline\getActionStatus(), TplAppApache\getActionSwitchApacheModule(), TplAppPhp\getActionSwitchPhpExtension(), TplAppPhp\getActionSwitchPhpSetting(), Bins\getServices(), ActionStartup\installServices(), ActionEditVhost\processWindow(), and Win32Service\start().
const SERVICE_PARAMS = '-k runservice' |
Definition at line 20 of file class.bin.apache.php.
const TAG_END_SWITCHONLINE = '# END switchOnline tag - Do not replace!' |
Definition at line 40 of file class.bin.apache.php.
const TAG_START_SWITCHONLINE = '# START switchOnline tag - Do not replace!' |
Definition at line 39 of file class.bin.apache.php.