![]() |
2024.8.23
|
Public Member Functions | |
| __construct () | |
Static Public Member Functions | |
| static | createSymlink ($src, $dest) |
| static | exec ($basename, $content, $timeout=true, $catchOutput=true, $standalone=false, $silent=true, $rebuild=true) |
| static | execStandalone ($basename, $content, $silent=true) |
| static | exitApp ($restart=false) |
| static | findExeByPid ($pid) |
| static | getOsInfo () |
| static | getPearVersion () |
| static | getProcessUsingPort ($port) |
| static | initializeMysql ($path) |
| static | initializePostgresql ($path) |
| static | installFilezillaService () |
| static | installPostgresqlService () |
| static | refreshEnvVars () |
| static | removeSymlink ($link) |
| static | restartApp () |
| static | setServiceDescription ($serviceName, $desc) |
| static | setServiceDisplayName ($serviceName, $displayName) |
| static | setServiceStartType ($serviceName, $startType) |
| static | uninstallFilezillaService () |
| static | uninstallPostgresqlService () |
Data Fields | |
| const | CATCH_OUTPUT_FALSE = 'bearsamppCatchOutputFalse' |
| const | END_PROCESS_STR = 'FINISHED!' |
Static Private Member Functions | |
| static | getTmpFile ($ext, $customName=null) |
| static | writeLog ($log) |
Class Batch
This class provides various utility functions for managing processes, services, and environment variables within the Bearsampp application. It includes methods for finding executables by process ID, checking which process is using a specific port, exiting and restarting the application, managing services, and executing batch scripts.
Key functionalities include:
The class utilizes global variables to access application settings and paths, and logs operations for debugging purposes.
Definition at line 30 of file class.batch.php.
| Batch::__construct | ( | ) |
|
static |
Creates a symbolic link.
| string | $src | The source path. |
| string | $dest | The destination path. |
Definition at line 273 of file class.batch.php.
References $bearsamppCore, exec(), and Util\formatWindowsPath().
Referenced by Module\createSymlink().
Here is the caller graph for this function:
|
static |
Executes a batch script.
| string | $basename | The base name for the script and result files. |
| string | $content | The content of the batch script. |
| int | bool | $timeout | The timeout for the script execution in seconds, or true for default timeout, or false for no timeout. |
| bool | $catchOutput | Whether to capture the output of the script. |
| bool | $standalone | Whether the script is standalone. |
| bool | $silent | Whether to execute the script silently. |
| bool | $rebuild | Whether to rebuild the result array. |
Definition at line 370 of file class.batch.php.
References $bearsamppConfig, $result, CATCH_OUTPUT_FALSE, Util\endWith(), getTmpFile(), and writeLog().
Referenced by OpenSsl\createCrt(), createSymlink(), Nssm\exec(), execStandalone(), findExeByPid(), BinApache\getCmdLineOutput(), BinMariadb\getCmdLineOutput(), BinMysql\getCmdLineOutput(), BinPostgresql\getCmdLineOutput(), getOsInfo(), getPearVersion(), getProcessUsingPort(), initializeMysql(), initializePostgresql(), installFilezillaService(), installPostgresqlService(), removeSymlink(), setServiceDescription(), setServiceDisplayName(), setServiceStartType(), uninstallFilezillaService(), and uninstallPostgresqlService().
Here is the caller graph for this function:
|
static |
Executes a standalone batch script.
| string | $basename | The base name for the script and result files. |
| string | $content | The content of the batch script. |
| bool | $silent | Whether to execute the script silently. |
Definition at line 353 of file class.batch.php.
References exec().
Referenced by exitApp(), and refreshEnvVars().
Here is the caller graph for this function:
|
static |
Exits the application, optionally restarting it.
| bool | $restart | Whether to restart the application after exiting. |
Definition at line 106 of file class.batch.php.
References $bearsamppCore, $bearsamppRoot, execStandalone(), Core\isRoot_FILE, Win32Ps\killBins(), Util\logInfo(), and Action\RESTART.
Referenced by ActionExec\__construct(), and restartApp().
Here is the caller graph for this function:
|
static |
Finds the executable name by its process ID (PID).
| int | $pid | The process ID to search for. |
Definition at line 59 of file class.batch.php.
References $result, and exec().
Referenced by getProcessUsingPort().
Here is the caller graph for this function:
|
static |
Gets the operating system information.
Definition at line 296 of file class.batch.php.
References $result, exec(), and Util\startWith().
Referenced by ActionStartup\sysInfos().
Here is the caller graph for this function:
|
static |
Gets the version of PEAR installed.
Definition at line 138 of file class.batch.php.
References $bearsamppBins, $result, exec(), and Util\startWith().
Referenced by BinPhp\getPearVersion().
Here is the caller graph for this function:
|
static |
Gets the process using a specific port.
| int | $port | The port number to check. |
Definition at line 78 of file class.batch.php.
References $port, $result, Util\endWith(), exec(), findExeByPid(), and Util\startWith().
Referenced by Util\isPortInUse().
Here is the caller graph for this function:
|
staticprivate |
Gets a temporary file path with a specified extension and optional custom name.
| string | $ext | The file extension. |
| string | null | $customName | An optional custom name for the file. |
Definition at line 448 of file class.batch.php.
References $bearsamppCore, Util\formatWindowsPath(), and Util\random().
Referenced by exec().
Here is the caller graph for this function:
|
static |
Initializes MySQL using a specified path.
| string | $path | The path to the MySQL initialization script. |
Definition at line 204 of file class.batch.php.
References exec(), and Util\logWarning().
Referenced by BinMysql\initData().
Here is the caller graph for this function:
|
static |
Initializes PostgreSQL using a specified path.
| string | $path | The path to the PostgreSQL initialization script. |
Definition at line 258 of file class.batch.php.
References exec(), and Util\logWarning().
Referenced by BinPostgresql\initData().
Here is the caller graph for this function:
|
static |
Installs the FileZilla service.
Definition at line 171 of file class.batch.php.
References $bearsamppBins, exec(), BinFilezilla\SERVICE_NAME, and setServiceDescription().
Referenced by Win32Service\create().
Here is the caller graph for this function:
|
static |
Installs the PostgreSQL service.
Definition at line 218 of file class.batch.php.
References $bearsamppBins, exec(), Util\formatWindowsPath(), BinPostgresql\SERVICE_NAME, setServiceDescription(), setServiceDisplayName(), and setServiceStartType().
Referenced by Win32Service\create().
Here is the caller graph for this function:
|
static |
Refreshes the environment variables.
Definition at line 160 of file class.batch.php.
References $bearsamppCore, $bearsamppRoot, Registry\APP_PATH_REG_ENTRY, execStandalone(), and Util\formatWindowsPath().
Referenced by Registry\setValue().
Here is the caller graph for this function:
|
static |
Removes a symbolic link.
| string | $link | The path to the symbolic link. |
Definition at line 286 of file class.batch.php.
References exec(), and Util\formatWindowsPath().
Referenced by Module\createSymlink(), and Symlinks\deleteCurrentSymlinks().
Here is the caller graph for this function:
|
static |
Restarts the application.
Definition at line 128 of file class.batch.php.
References exitApp().
Referenced by ActionExec\__construct().
Here is the caller graph for this function:
|
static |
Sets the description of a service.
| string | $serviceName | The name of the service. |
| string | $desc | The description to set. |
Definition at line 327 of file class.batch.php.
References exec().
Referenced by installFilezillaService(), and installPostgresqlService().
Here is the caller graph for this function:
|
static |
Sets the display name of a service.
| string | $serviceName | The name of the service. |
| string | $displayName | The display name to set. |
Definition at line 315 of file class.batch.php.
References exec().
Referenced by installPostgresqlService().
Here is the caller graph for this function:
|
static |
Sets the start type of a service.
| string | $serviceName | The name of the service. |
| string | $startType | The start type to set (e.g., "auto", "demand"). |
Definition at line 339 of file class.batch.php.
References exec().
Referenced by installPostgresqlService().
Here is the caller graph for this function:
|
static |
Uninstalls the FileZilla service.
Definition at line 191 of file class.batch.php.
References $bearsamppBins, and exec().
Referenced by Win32Service\delete().
Here is the caller graph for this function:
|
static |
Uninstalls the PostgreSQL service.
Definition at line 243 of file class.batch.php.
References $bearsamppBins, exec(), Util\formatWindowsPath(), and BinPostgresql\SERVICE_NAME.
Referenced by Win32Service\delete().
Here is the caller graph for this function:
|
staticprivate |
Writes a log entry to the batch log file.
| string | $log | The log message to write. |
Definition at line 47 of file class.batch.php.
References $bearsamppRoot, and Util\logDebug().
Referenced by exec().
Here is the caller graph for this function:| const Batch::CATCH_OUTPUT_FALSE = 'bearsamppCatchOutputFalse' |
Definition at line 33 of file class.batch.php.
Referenced by exec().
| const Batch::END_PROCESS_STR = 'FINISHED!' |
Definition at line 32 of file class.batch.php.