60 $this->enable = $this->enable &&
$bearsamppConfig->getRaw(self::ROOT_CFG_ENABLE);
64 if ($this->bearsamppConfRaw !==
false) {
66 $this->SslPort = intval($this->bearsamppConfRaw[self::LOCAL_CFG_SSL_PORT]);
67 $this->port = intval($this->bearsamppConfRaw[self::LOCAL_CFG_PORT]);
74 if (!is_dir($this->currentPath)) {
78 if (!is_dir($this->symlinkPath)) {
82 if (!is_file($this->bearsamppConf)) {
86 if (!is_file($this->exe)) {
90 if (empty($this->SslPort)) {
94 if (empty($this->port)) {
99 $nssm =
new Nssm(self::SERVICE_NAME);
101 $nssm->setBinPath($this->exe);
102 $nssm->setParams(sprintf(self::SERVICE_PARAMS, $this->SslPort, $this->port));
105 $nssm->setStderr(
$bearsamppRoot->getLogsPath() .
'/xlight.error.log');
107 $this->service->setNssm($nssm);
116 $content = file_get_contents($this->bearsamppConf);
118 foreach ($params as $key => $value) {
119 $content = preg_replace(
'|' . $key .
' = .*|', $key .
' = ' .
'"' . $value.
'"', $content);
120 $this->bearsamppConfRaw[$key] = $value;
123 $this->SslPort = intval($value);
126 $this->port = intval($value);
131 file_put_contents($this->bearsamppConf, $content);
140 global $bearsamppRegistry;
142 $exists = $bearsamppRegistry->exists(
144 'SYSTEM\CurrentControlSet\Services\\' . self::SERVICE_NAME .
'\Parameters',
148 return $bearsamppRegistry->setExpandStringValue(
150 'SYSTEM\CurrentControlSet\Services\\' . self::SERVICE_NAME .
'\Parameters',
152 sprintf(self::SERVICE_PARAMS, $this->SslPort, $this->port)
168 global $bearsamppWinbinder;
176 $bearsamppWinbinder->incrProgressBar($wbProgressBar);
179 if (!$checkUsed || $isPortInUse ===
false) {
181 $this->setSmtpPort(
$port);
182 $bearsamppWinbinder->incrProgressBar($wbProgressBar);
186 $bearsamppWinbinder->incrProgressBar($wbProgressBar);
212 if (!empty($headers)) {
216 $bearsamppWinbinder->messageBoxInfo(
225 $bearsamppWinbinder->messageBoxWarning(
233 $bearsamppWinbinder->messageBoxError(
266 if (!$this->enable) {
271 Util::logDebug(($sub > 0 ? str_repeat(
' ', 2 * $sub) :
'') .
'Update ' . $this->name .
' ' .
$version .
' config');
279 $bearsamppWinbinder->messageBoxError(
291 $bearsamppWinbinder->messageBoxError(
332 public function setEnable($enabled, $showWindow =
false) {
338 $bearsamppWinbinder->messageBoxError(
updateConfig($version=null, $sub=0, $showWindow=false)
changePort($port, $checkUsed=false, $wbProgressBar=null)
checkPort($port, $showWindow=false)
reload($id=null, $type=null)
switchVersion($version, $showWindow=false)
setEnable($enabled, $showWindow=false)
const ERROR_FILE_NOT_FOUND
const ERROR_INVALID_PARAMETER
const BEARSAMPP_CONF_NOT_FOUND_ERROR
const ENABLE_BUNDLE_NOT_EXIST
const ERROR_CONF_NOT_FOUND
const SWITCH_VERSION_TITLE
const ERROR_EXE_NOT_FOUND
const BEARSAMPP_CONF_MALFORMED_ERROR
update($sub=0, $showWindow=false)
const SERVICE_DEMAND_START
const INFO_APP_PARAMETERS
static logReloadClass($classInstance)
static getHeaders($host, $port, $ssl=false)
static contains($string, $search)
static logError($data, $file=null)
static isValidPort($port)
static installService($bin, $port, $syntaxCheckCmd, $showWindow=false)
static removeService($service, $name)
static logDebug($data, $file=null)
static logInitClass($classInstance)
static isPortInUse($port)
static logInfo($data, $file=null)