![]() |
2024.8.23
|
Public Member Functions | |
__construct ($id, $type) | |
changePort ($port, $checkUsed=false, $wbProgressBar=null) | |
checkPort ($port, $showWindow=false) | |
getApiPort () | |
getExe () | |
getLog () | |
getMailPath () | |
getService () | |
getSmtpPort () | |
getUiPort () | |
rebuildConf () | |
reload ($id=null, $type=null) | |
setApiPort ($apiPort) | |
setEnable ($enabled, $showWindow=false) | |
setSmtpPort ($smtpPort) | |
setUiPort ($uiPort) | |
setVersion ($version) | |
switchVersion ($version, $showWindow=false) | |
![]() | |
__toString () | |
getCurrentPath () | |
getId () | |
getName () | |
getRelease () | |
getRootPath () | |
getSymlinkPath () | |
getType () | |
getVersion () | |
getVersionList () | |
isEnable () | |
update ($sub=0, $showWindow=false) | |
Data Fields | |
const | LOCAL_CFG_API_PORT = 'mailhogApiPort' |
const | LOCAL_CFG_EXE = 'mailhogExe' |
const | LOCAL_CFG_SMTP_PORT = 'mailhogSmtpPort' |
const | LOCAL_CFG_UI_PORT = 'mailhogUiPort' |
const | ROOT_CFG_ENABLE = 'mailhogEnable' |
const | ROOT_CFG_VERSION = 'mailhogVersion' |
const | SERVICE_NAME = 'bearsamppmailhog' |
const | SERVICE_PARAMS = '-hostname localhost -api-bind-addr 127.0.0.1:%d -ui-bind-addr 127.0.0.1:%d -smtp-bind-addr 127.0.0.1:%d -storage maildir -maildir-path "%s"' |
![]() | |
const | BUNDLE_RELEASE = 'bundleRelease' |
Protected Member Functions | |
replaceAll ($params) | |
updateConfig ($version=null, $sub=0, $showWindow=false) | |
![]() | |
__construct () | |
replace ($key, $value) | |
Private Attributes | |
$apiPort | |
$exe | |
$log | |
$mailPath | |
$service | |
$smtpPort | |
$uiPort | |
Additional Inherited Members | |
![]() | |
$bearsamppConf | |
$bearsamppConfRaw | |
$currentPath | |
$enable | |
$name | |
$release = 'N/A' | |
$rootPath | |
$symlinkPath | |
$version | |
Class BinMailhog
This class represents the Mailhog module in the Bearsampp application. It handles the configuration, initialization, and management of the Mailhog service.
Definition at line 16 of file class.bin.mailhog.php.
BinMailhog::__construct | ( | $id, | |
$type ) |
Constructs a BinMailhog object and initializes the module.
string | $id | The ID of the module. |
string | $type | The type of the module. |
Definition at line 44 of file class.bin.mailhog.php.
References Module\$id, Module\$type, Util\logInitClass(), and reload().
BinMailhog::changePort | ( | $port, | |
$checkUsed = false, | |||
$wbProgressBar = null ) |
Changes the SMTP port for the Mailhog 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 UI updates. |
Definition at line 192 of file class.bin.mailhog.php.
References $port, Module\getName(), Util\isPortInUse(), Util\isValidPort(), Util\logDebug(), Util\logError(), setSmtpPort(), and Module\update().
BinMailhog::checkPort | ( | $port, | |
$showWindow = false ) |
Checks if a specific port is used by the Mailhog service.
int | $port | The port number to check. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 231 of file class.bin.mailhog.php.
References $bearsamppLang, $port, Lang\CHECK_PORT_TITLE, Util\contains(), Util\getHeaders(), Module\getName(), Util\isValidPort(), Util\logDebug(), Util\logError(), Lang\PORT_NOT_USED, Lang\PORT_NOT_USED_BY, and Lang\PORT_USED_BY.
BinMailhog::getApiPort | ( | ) |
Gets the API port for the Mailhog service.
Definition at line 427 of file class.bin.mailhog.php.
References $apiPort.
BinMailhog::getExe | ( | ) |
Gets the executable file path for the Mailhog service.
Definition at line 417 of file class.bin.mailhog.php.
References $exe.
BinMailhog::getLog | ( | ) |
Gets the log file path for the Mailhog service.
Definition at line 407 of file class.bin.mailhog.php.
References $log.
BinMailhog::getMailPath | ( | ) |
Gets the mail directory path for the Mailhog service.
This method returns the path to the directory where Mailhog stores its mail data. The path is typically set during the initialization or reloading of the module and is based on the application's root temporary path.
Definition at line 491 of file class.bin.mailhog.php.
References $mailPath.
BinMailhog::getService | ( | ) |
Gets the Win32Service object for the Mailhog service.
Definition at line 363 of file class.bin.mailhog.php.
References $service.
BinMailhog::getSmtpPort | ( | ) |
Gets the SMTP port for the Mailhog service.
Definition at line 467 of file class.bin.mailhog.php.
References $smtpPort.
BinMailhog::getUiPort | ( | ) |
Gets the UI port for the Mailhog service.
Definition at line 447 of file class.bin.mailhog.php.
References $uiPort.
BinMailhog::rebuildConf | ( | ) |
Rebuilds the configuration in the Windows Registry.
Definition at line 162 of file class.bin.mailhog.php.
References Registry\HKEY_LOCAL_MACHINE, and Nssm\INFO_APP_PARAMETERS.
BinMailhog::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 56 of file class.bin.mailhog.php.
References $bearsamppConfig, $bearsamppLang, $bearsamppRoot, Module\$id, Module\$type, 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_EXE, Util\logError(), Util\logInfo(), Util\logReloadClass(), Lang\MAILHOG, 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 134 of file class.bin.mailhog.php.
References LOCAL_CFG_API_PORT, LOCAL_CFG_SMTP_PORT, and LOCAL_CFG_UI_PORT.
BinMailhog::setApiPort | ( | $apiPort | ) |
Sets the API port for the Mailhog service.
int | $apiPort | The new API port. |
Definition at line 437 of file class.bin.mailhog.php.
References $apiPort, and Module\replace().
BinMailhog::setEnable | ( | $enabled, | |
$showWindow = false ) |
Enables or disables the Mailhog service.
bool | $enabled | Whether to enable or disable the service. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 374 of file class.bin.mailhog.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().
BinMailhog::setSmtpPort | ( | $smtpPort | ) |
Sets the SMTP port for the Mailhog service.
int | $smtpPort | The new SMTP port. |
Definition at line 477 of file class.bin.mailhog.php.
References $smtpPort, and Module\replace().
Referenced by changePort().
BinMailhog::setUiPort | ( | $uiPort | ) |
Sets the UI port for the Mailhog service.
int | $uiPort | The new UI port. |
Definition at line 457 of file class.bin.mailhog.php.
References $uiPort, and Module\replace().
BinMailhog::setVersion | ( | $version | ) |
Sets the version of the Mailhog service.
string | $version | The version to set. |
Reimplemented from Module.
Definition at line 350 of file class.bin.mailhog.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
BinMailhog::switchVersion | ( | $version, | |
$showWindow = false ) |
Switches the version of the Mailhog service.
string | $version | The version to switch to. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 284 of file class.bin.mailhog.php.
References Module\$version, Util\logDebug(), and updateConfig().
|
protected |
Updates the configuration of the Mailhog service.
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 message box with the result. |
Reimplemented from Module.
Definition at line 300 of file class.bin.mailhog.php.
References Module\$bearsamppConf, Module\$bearsamppConfRaw, $bearsamppLang, Module\$version, Lang\BEARSAMPP_CONF_MALFORMED_ERROR, Lang\BEARSAMPP_CONF_NOT_FOUND_ERROR, Module\getName(), Module\getVersion(), Util\logDebug(), Util\logError(), setVersion(), and Lang\SWITCH_VERSION_TITLE.
Referenced by switchVersion().
|
private |
Definition at line 33 of file class.bin.mailhog.php.
Referenced by getApiPort(), and setApiPort().
|
private |
Definition at line 32 of file class.bin.mailhog.php.
Referenced by getExe().
|
private |
Definition at line 30 of file class.bin.mailhog.php.
Referenced by getLog().
|
private |
Definition at line 36 of file class.bin.mailhog.php.
Referenced by getMailPath().
|
private |
Definition at line 29 of file class.bin.mailhog.php.
Referenced by getService().
|
private |
Definition at line 35 of file class.bin.mailhog.php.
Referenced by getSmtpPort(), and setSmtpPort().
|
private |
Definition at line 34 of file class.bin.mailhog.php.
Referenced by getUiPort(), and setUiPort().
const BinMailhog::LOCAL_CFG_API_PORT = 'mailhogApiPort' |
Definition at line 25 of file class.bin.mailhog.php.
Referenced by replaceAll().
const BinMailhog::LOCAL_CFG_EXE = 'mailhogExe' |
Definition at line 24 of file class.bin.mailhog.php.
Referenced by reload().
const BinMailhog::LOCAL_CFG_SMTP_PORT = 'mailhogSmtpPort' |
Definition at line 27 of file class.bin.mailhog.php.
Referenced by replaceAll().
const BinMailhog::LOCAL_CFG_UI_PORT = 'mailhogUiPort' |
Definition at line 26 of file class.bin.mailhog.php.
Referenced by replaceAll().
const BinMailhog::ROOT_CFG_ENABLE = 'mailhogEnable' |
Definition at line 21 of file class.bin.mailhog.php.
const BinMailhog::ROOT_CFG_VERSION = 'mailhogVersion' |
Definition at line 22 of file class.bin.mailhog.php.
const BinMailhog::SERVICE_NAME = 'bearsamppmailhog' |
Definition at line 18 of file class.bin.mailhog.php.
Referenced by ActionService\__construct(), TplAppMailhog\getActionInstallMailhogService(), TplAppMailhog\getActionRemoveMailhogService(), Bins\getServices(), ActionStartup\installServices(), ActionQuit\processWindow(), and Win32Service\start().
const BinMailhog::SERVICE_PARAMS = '-hostname localhost -api-bind-addr 127.0.0.1:%d -ui-bind-addr 127.0.0.1:%d -smtp-bind-addr 127.0.0.1:%d -storage maildir -maildir-path "%s"' |
Definition at line 19 of file class.bin.mailhog.php.