2024.8.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 () | |
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 16 of file class.bin.apache.php.
BinApache::__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 60 of file class.bin.apache.php.
References Module\$id, Module\$type, Util\logInitClass(), and reload().
BinApache::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 190 of file class.bin.apache.php.
References $port, Module\getName(), Util\isPortInUse(), Util\isValidPort(), Util\logDebug(), Util\logError(), setPort(), and Module\update().
BinApache::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 230 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().
BinApache::getAccessLog | ( | ) |
Gets the access log file path.
Definition at line 970 of file class.bin.apache.php.
References $accessLog.
BinApache::getAlias | ( | ) |
Retrieves the list of alias configurations.
Definition at line 505 of file class.bin.apache.php.
References $bearsamppRoot, $result, and Util\endWith().
Referenced by refreshAlias().
BinApache::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 708 of file class.bin.apache.php.
References Module\$name, Util\formatUnixPath(), and getRequiredContent().
BinApache::getCmdLineOutput | ( | $cmd | ) |
Executes a command line and retrieves the output.
string | $cmd | The command to execute. |
Definition at line 618 of file class.bin.apache.php.
References $result, Batch\exec(), and getExe().
BinApache::getConf | ( | ) |
Gets the configuration file path.
Definition at line 1010 of file class.bin.apache.php.
References $conf.
Referenced by getModulesFromConf(), refreshConf(), and updateConfig().
BinApache::getErrorLog | ( | ) |
Gets the error log file path.
Definition at line 990 of file class.bin.apache.php.
References $errorLog.
BinApache::getExe | ( | ) |
Gets the executable file path.
Definition at line 1000 of file class.bin.apache.php.
References $exe.
Referenced by getCmdLineOutput().
BinApache::getModules | ( | ) |
Retrieves the list of modules by merging the modules from the folder and the configuration file.
Definition at line 407 of file class.bin.apache.php.
References $result, getModulesFromConf(), and getModulesFromFolder().
BinApache::getModulesFromConf | ( | ) |
Retrieves the list of modules from the configuration file.
Definition at line 422 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 474 of file class.bin.apache.php.
References Module\$name, $result, Util\endWith(), getModulesPath(), Util\startWith(), and ActionSwitchApacheModule\SWITCH_OFF.
Referenced by getModules().
BinApache::getModulesLoaded | ( | ) |
Retrieves the list of loaded modules from the configuration file.
Definition at line 457 of file class.bin.apache.php.
References Module\$name, $result, getModulesFromConf(), and ActionSwitchApacheModule\SWITCH_ON.
BinApache::getModulesPath | ( | ) |
Gets the path to the modules.
Definition at line 950 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 669 of file class.bin.apache.php.
References $result, Module\$version, Module\getVersion(), Util\startWith(), and TAG_END_SWITCHONLINE.
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 646 of file class.bin.apache.php.
References $result, Module\$version, Module\getVersion(), Util\startWith(), and TAG_END_SWITCHONLINE.
Referenced by getRequiredContent(), refreshAlias(), refreshConf(), and refreshVhosts().
BinApache::getOpensslExe | ( | ) |
Gets the OpenSSL executable file path.
Definition at line 1064 of file class.bin.apache.php.
References $opensslExe.
BinApache::getPort | ( | ) |
Gets the port number.
Definition at line 1020 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 693 of file class.bin.apache.php.
References $bearsamppConfig, Module\$version, getOfflineContent(), and getOnlineContent().
Referenced by getAliasContent(), and getVhostContent().
BinApache::getRewriteLog | ( | ) |
Gets the rewrite log file path.
Definition at line 980 of file class.bin.apache.php.
References $rewriteLog.
BinApache::getService | ( | ) |
Gets the service associated with the module.
Definition at line 940 of file class.bin.apache.php.
References $service.
BinApache::getSslConf | ( | ) |
Gets the SSL configuration file path.
Definition at line 960 of file class.bin.apache.php.
References $sslConf.
Referenced by refreshConf().
BinApache::getSslPort | ( | ) |
Gets the SSL port number.
Definition at line 1042 of file class.bin.apache.php.
References $sslPort.
Referenced by getVhostContent().
BinApache::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 728 of file class.bin.apache.php.
References $bearsamppRoot, Util\formatUnixPath(), getPort(), getRequiredContent(), and getSslPort().
BinApache::getVhosts | ( | ) |
Retrieves the list of virtual hosts configurations.
Definition at line 532 of file class.bin.apache.php.
References $bearsamppRoot, $result, and Util\endWith().
Referenced by getVhostsUrl(), refreshVhosts(), and updateConfig().
BinApache::getVhostsUrl | ( | ) |
Retrieves the URLs of the virtual hosts.
Definition at line 559 of file class.bin.apache.php.
References $bearsamppRoot, $result, getVhosts(), and Util\startWith().
BinApache::getWwwDirectories | ( | ) |
Retrieves the list of directories in the www folder.
Definition at line 589 of file class.bin.apache.php.
References $bearsamppRoot, and $result.
BinApache::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 818 of file class.bin.apache.php.
References $bearsamppHomepage, $bearsamppRoot, getAlias(), getOfflineContent(), getOnlineContent(), Util\logDebug(), and Util\logTrace().
BinApache::refreshConf | ( | $putOnline | ) |
Refreshes the configuration file to switch between online and offline modes.
bool | $putOnline | Whether to put the configuration online. |
Definition at line 775 of file class.bin.apache.php.
References $conf, $sslConf, getConf(), getOfflineContent(), getOnlineContent(), getSslConf(), Util\logDebug(), and Util\logTrace().
BinApache::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 854 of file class.bin.apache.php.
References $bearsamppRoot, getOfflineContent(), getOnlineContent(), getVhosts(), Util\logDebug(), and Util\logTrace().
BinApache::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 72 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(), LOCAL_CFG_CONF, LOCAL_CFG_EXE, LOCAL_CFG_OPENSSL_EXE, LOCAL_CFG_PORT, LOCAL_CFG_SSL_PORT, 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 161 of file class.bin.apache.php.
References LOCAL_CFG_PORT, and LOCAL_CFG_SSL_PORT.
BinApache::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 892 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().
BinApache::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 1032 of file class.bin.apache.php.
References $port, and Module\replace().
Referenced by changePort().
BinApache::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 1054 of file class.bin.apache.php.
References $sslPort, and Module\replace().
BinApache::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 927 of file class.bin.apache.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
BinApache::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 285 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 301 of file class.bin.apache.php.
References $bearsamppBins, Module\$bearsamppConf, Module\$bearsamppConfRaw, $bearsamppLang, $bearsamppRoot, $conf, $port, 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 44 of file class.bin.apache.php.
Referenced by getAccessLog().
|
private |
Definition at line 49 of file class.bin.apache.php.
Referenced by getConf(), refreshConf(), and updateConfig().
|
private |
Definition at line 46 of file class.bin.apache.php.
Referenced by getErrorLog().
|
private |
Definition at line 48 of file class.bin.apache.php.
Referenced by getExe().
|
private |
Definition at line 42 of file class.bin.apache.php.
Referenced by getModulesPath().
|
private |
Definition at line 52 of file class.bin.apache.php.
Referenced by getOpensslExe().
|
private |
Definition at line 50 of file class.bin.apache.php.
Referenced by changePort(), checkPort(), getPort(), setPort(), and updateConfig().
|
private |
Definition at line 45 of file class.bin.apache.php.
Referenced by getRewriteLog().
|
private |
Definition at line 41 of file class.bin.apache.php.
Referenced by getService().
|
private |
Definition at line 43 of file class.bin.apache.php.
Referenced by getSslConf(), and refreshConf().
|
private |
Definition at line 51 of file class.bin.apache.php.
Referenced by getSslPort(), and setSslPort().
const BinApache::CMD_COMPILE_SETTINGS = '-V' |
Definition at line 31 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const BinApache::CMD_COMPILED_MODULES = '-l' |
Definition at line 32 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const BinApache::CMD_CONFIG_DIRECTIVES = '-L' |
Definition at line 33 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const BinApache::CMD_LOADED_MODULES = '-M' |
Definition at line 35 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const BinApache::CMD_SYNTAX_CHECK = '-t' |
Definition at line 36 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), ActionService\__construct(), TplAppApache\getMenuApacheDebug(), ActionStartup\installServices(), BinPhp\setEnable(), and Win32Service\start().
const BinApache::CMD_VERSION_NUMBER = '-v' |
Definition at line 30 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const BinApache::CMD_VHOSTS_SETTINGS = '-S' |
Definition at line 34 of file class.bin.apache.php.
Referenced by ActionDebugApache\__construct(), and TplAppApache\getMenuApacheDebug().
const BinApache::LOCAL_CFG_CONF = 'apacheConf' |
Definition at line 25 of file class.bin.apache.php.
Referenced by reload().
const BinApache::LOCAL_CFG_EXE = 'apacheExe' |
Definition at line 24 of file class.bin.apache.php.
Referenced by reload().
const BinApache::LOCAL_CFG_OPENSSL_EXE = 'apacheOpensslExe' |
Definition at line 28 of file class.bin.apache.php.
Referenced by reload().
const BinApache::LOCAL_CFG_PORT = 'apachePort' |
Definition at line 26 of file class.bin.apache.php.
Referenced by reload(), and replaceAll().
const BinApache::LOCAL_CFG_SSL_PORT = 'apacheSslPort' |
Definition at line 27 of file class.bin.apache.php.
Referenced by reload(), and replaceAll().
const BinApache::ROOT_CFG_ENABLE = 'apacheEnable' |
Definition at line 21 of file class.bin.apache.php.
const BinApache::ROOT_CFG_VERSION = 'apacheVersion' |
Definition at line 22 of file class.bin.apache.php.
const BinApache::SERVICE_NAME = 'bearsamppapache' |
Definition at line 18 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 BinApache::SERVICE_PARAMS = '-k runservice' |
Definition at line 19 of file class.bin.apache.php.
const BinApache::TAG_END_SWITCHONLINE = '# END switchOnline tag - Do not replace!' |
Definition at line 39 of file class.bin.apache.php.
Referenced by getOfflineContent(), and getOnlineContent().
const BinApache::TAG_START_SWITCHONLINE = '# START switchOnline tag - Do not replace!' |
Definition at line 38 of file class.bin.apache.php.