2024.8.23
|
Public Member Functions | |
__construct ($id, $type) | |
changePort ($port, $checkUsed=false, $wbProgressBar=null) | |
checkPort ($port, $showWindow=false) | |
getExe () | |
getListen () | |
getLog () | |
getService () | |
getSmtpPort () | |
getUiPort () | |
getWebRoot () | |
rebuildConf () | |
reload ($id=null, $type=null) | |
setEnable ($enabled, $showWindow=false) | |
setListen () | |
setSmtpPort ($smtpPort) | |
setUiPort ($uiPort) | |
setVersion ($version) | |
setWebRoot ($webRoot) | |
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 | LOCAL_CFG_EXE = 'mailpitExe' |
const | LOCAL_CFG_LISTEN = 'mailpitListen' |
const | LOCAL_CFG_SMTP_PORT = 'mailpitSmtpPort' |
const | LOCAL_CFG_UI_PORT = 'mailpitUiPort' |
const | LOCAL_CFG_WEB_ROOT = 'mailpitWebRoot' |
const | ROOT_CFG_ENABLE = 'mailpitEnable' |
const | ROOT_CFG_VERSION = 'mailpitVersion' |
const | SERVICE_NAME = 'bearsamppmailpit' |
const | SERVICE_PARAMS = ' --listen "%s:%d" --smtp "%s:%d" --webroot "%s"' |
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 Attributes | |
$exe | |
$listen | |
$log | |
$service | |
$smtpPort | |
$uiPort | |
$webRoot | |
Additional Inherited Members | |
Protected Attributes inherited from Module | |
$bearsamppConf | |
$bearsamppConfRaw | |
$currentPath | |
$enable | |
$name | |
$release = 'N/A' | |
$rootPath | |
$symlinkPath | |
$version | |
Class BinMailpit
This class represents the Mailpit module in the Bearsampp application. It handles the configuration, initialization, and management of the Mailpit service.
Definition at line 16 of file class.bin.mailpit.php.
BinMailpit::__construct | ( | $id, | |
$type ) |
Constructs a BinMailpit object and initializes the module.
string | $id | The ID of the module. |
string | $type | The type of the module. |
Definition at line 45 of file class.bin.mailpit.php.
References Module\$id, Module\$type, Util\logInitClass(), and reload().
BinMailpit::changePort | ( | $port, | |
$checkUsed = false, | |||
$wbProgressBar = null ) |
Changes the SMTP port for the Mailpit 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 195 of file class.bin.mailpit.php.
References $port, Module\getName(), Util\isPortInUse(), Util\isValidPort(), Util\logDebug(), Util\logError(), setSmtpPort(), and Module\update().
BinMailpit::checkPort | ( | $port, | |
$showWindow = false ) |
Checks if the specified port is used by the Mailpit service.
int | $port | The port number to check. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 234 of file class.bin.mailpit.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.
BinMailpit::getExe | ( | ) |
Retrieves the executable file path for the Mailpit service.
Definition at line 420 of file class.bin.mailpit.php.
References $exe.
BinMailpit::getListen | ( | ) |
Retrieves the listen address for the Mailpit service.
Definition at line 490 of file class.bin.mailpit.php.
References $listen.
BinMailpit::getLog | ( | ) |
Retrieves the log file path for the Mailpit service.
Definition at line 410 of file class.bin.mailpit.php.
References $log.
BinMailpit::getService | ( | ) |
Retrieves the service object for the Mailpit service.
Definition at line 366 of file class.bin.mailpit.php.
References $service.
BinMailpit::getSmtpPort | ( | ) |
Retrieves the SMTP port for the Mailpit service.
Definition at line 470 of file class.bin.mailpit.php.
References $smtpPort.
BinMailpit::getUiPort | ( | ) |
Retrieves the UI port for the Mailpit service.
Definition at line 450 of file class.bin.mailpit.php.
References $uiPort.
BinMailpit::getWebRoot | ( | ) |
Retrieves the web root directory for the Mailpit service.
Definition at line 430 of file class.bin.mailpit.php.
References $webRoot.
BinMailpit::rebuildConf | ( | ) |
Rebuilds the configuration for the Mailpit service in the Windows Registry.
Definition at line 165 of file class.bin.mailpit.php.
References Registry\HKEY_LOCAL_MACHINE, and Nssm\INFO_APP_PARAMETERS.
BinMailpit::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 57 of file class.bin.mailpit.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, LOCAL_CFG_LISTEN, LOCAL_CFG_WEB_ROOT, Util\logError(), Util\logInfo(), Util\logReloadClass(), Lang\MAILPIT, 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 140 of file class.bin.mailpit.php.
References LOCAL_CFG_SMTP_PORT, and LOCAL_CFG_UI_PORT.
BinMailpit::setEnable | ( | $enabled, | |
$showWindow = false ) |
Enables or disables the Mailpit service.
bool | $enabled | Whether to enable or disable the service. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 377 of file class.bin.mailpit.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().
BinMailpit::setListen | ( | ) |
Sets the listen address for the Mailpit service.
Definition at line 500 of file class.bin.mailpit.php.
References Module\replace().
BinMailpit::setSmtpPort | ( | $smtpPort | ) |
Sets the SMTP port for the Mailpit service.
int | $smtpPort | The SMTP port to set. |
Definition at line 480 of file class.bin.mailpit.php.
References $smtpPort, and Module\replace().
Referenced by changePort().
BinMailpit::setUiPort | ( | $uiPort | ) |
Sets the UI port for the Mailpit service.
int | $uiPort | The UI port to set. |
Definition at line 460 of file class.bin.mailpit.php.
References $uiPort, and Module\replace().
BinMailpit::setVersion | ( | $version | ) |
Sets the version of the Mailpit service.
string | $version | The version to set. |
Reimplemented from Module.
Definition at line 353 of file class.bin.mailpit.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
BinMailpit::setWebRoot | ( | $webRoot | ) |
Sets the web root directory for the Mailpit service.
string | $webRoot | The web root directory to set. |
Definition at line 440 of file class.bin.mailpit.php.
References $webRoot, and Module\replace().
BinMailpit::switchVersion | ( | $version, | |
$showWindow = false ) |
Switches the version of the Mailpit service.
string | $version | The version to switch to. |
bool | $showWindow | Whether to show a message box with the result. |
Definition at line 287 of file class.bin.mailpit.php.
References Module\$version, Util\logDebug(), and updateConfig().
|
protected |
Updates the configuration for the Mailpit 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 303 of file class.bin.mailpit.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.mailpit.php.
Referenced by getExe().
|
private |
Definition at line 37 of file class.bin.mailpit.php.
Referenced by getListen().
|
private |
Definition at line 31 of file class.bin.mailpit.php.
Referenced by getLog().
|
private |
Definition at line 30 of file class.bin.mailpit.php.
Referenced by getService().
|
private |
Definition at line 36 of file class.bin.mailpit.php.
Referenced by getSmtpPort(), and setSmtpPort().
|
private |
Definition at line 35 of file class.bin.mailpit.php.
Referenced by getUiPort(), and setUiPort().
|
private |
Definition at line 34 of file class.bin.mailpit.php.
Referenced by getWebRoot(), and setWebRoot().
const BinMailpit::LOCAL_CFG_EXE = 'mailpitExe' |
Definition at line 24 of file class.bin.mailpit.php.
Referenced by reload().
const BinMailpit::LOCAL_CFG_LISTEN = 'mailpitListen' |
Definition at line 28 of file class.bin.mailpit.php.
Referenced by reload().
const BinMailpit::LOCAL_CFG_SMTP_PORT = 'mailpitSmtpPort' |
Definition at line 27 of file class.bin.mailpit.php.
Referenced by replaceAll().
const BinMailpit::LOCAL_CFG_UI_PORT = 'mailpitUiPort' |
Definition at line 26 of file class.bin.mailpit.php.
Referenced by replaceAll().
const BinMailpit::LOCAL_CFG_WEB_ROOT = 'mailpitWebRoot' |
Definition at line 25 of file class.bin.mailpit.php.
Referenced by reload().
const BinMailpit::ROOT_CFG_ENABLE = 'mailpitEnable' |
Definition at line 21 of file class.bin.mailpit.php.
const BinMailpit::ROOT_CFG_VERSION = 'mailpitVersion' |
Definition at line 22 of file class.bin.mailpit.php.
const BinMailpit::SERVICE_NAME = 'bearsamppmailpit' |
Definition at line 18 of file class.bin.mailpit.php.
Referenced by ActionService\__construct(), TplAppMailpit\getActionInstallMailpitService(), TplAppMailpit\getActionRemoveMailpitService(), Bins\getServices(), ActionStartup\installServices(), ActionQuit\processWindow(), and Win32Service\start().
const BinMailpit::SERVICE_PARAMS = ' --listen "%s:%d" --smtp "%s:%d" --webroot "%s"' |
Definition at line 19 of file class.bin.mailpit.php.