65 $this->enable = $this->enable &&
$bearsamppConfig->getRaw( self::ROOT_CFG_ENABLE );
70 if ( $this->bearsamppConfRaw !==
false ) {
72 $this->apiPort = intval( $this->bearsamppConfRaw[self::LOCAL_CFG_API_PORT] );
73 $this->uiPort = intval( $this->bearsamppConfRaw[self::LOCAL_CFG_UI_PORT] );
74 $this->smtpPort = intval( $this->bearsamppConfRaw[self::LOCAL_CFG_SMTP_PORT] );
77 if ( !$this->enable ) {
82 if ( !is_dir( $this->currentPath ) ) {
87 if ( !is_dir( $this->symlinkPath ) ) {
92 if ( !is_file( $this->bearsamppConf ) ) {
97 if ( !is_file( $this->exe ) ) {
102 if ( empty( $this->apiPort ) ) {
107 if ( empty( $this->uiPort ) ) {
112 if ( empty( $this->smtpPort ) ) {
118 $nssm =
new Nssm( self::SERVICE_NAME );
120 $nssm->setBinPath( $this->exe );
121 $nssm->setParams( sprintf( self::SERVICE_PARAMS, $this->apiPort, $this->uiPort, $this->smtpPort, $this->mailPath ) );
123 $nssm->setStdout(
$bearsamppRoot->getLogsPath() .
'/mailhog.out.log' );
124 $nssm->setStderr(
$bearsamppRoot->getLogsPath() .
'/mailhog.err.log' );
126 $this->service->setNssm( $nssm );
136 $content = file_get_contents( $this->bearsamppConf );
138 foreach ( $params as $key => $value ) {
139 $content = preg_replace(
'|' . $key .
' = .*|', $key .
' = ' .
'"' . $value .
'"', $content );
140 $this->bearsamppConfRaw[$key] = $value;
143 $this->apiPort = intval( $value );
146 $this->uiPort = intval( $value );
149 $this->smtpPort = intval( $value );
154 file_put_contents( $this->bearsamppConf, $content );
304 if ( !$this->enable ) {
309 Util::logDebug( ($sub > 0 ? str_repeat(
' ', 2 * $sub ) :
'') .
'Update ' . $this->name .
' ' .
$version .
' config' );
317 $bearsamppWinbinder->messageBoxError(
330 $bearsamppWinbinder->messageBoxError(
374 public function setEnable($enabled, $showWindow =
false)
381 $bearsamppWinbinder->messageBoxError(
394 if ( $this->enable ) {