Bearsampp 2026.9.23
Loading...
Searching...
No Matches
Batch Class Reference

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 initializeMariadb ($path)
static initializeMysql ($path)
static initializePostgresql ($path)
static installPostgresqlService ()
static refreshEnvVars ()
static removeSymlink ($link)
static restartApp ()
static setServiceDescription ($serviceName, $desc)
static setServiceDisplayName ($serviceName, $displayName)
static setServiceStartType ($serviceName, $startType)
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)

Detailed Description

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:

  • Finding executables by process ID.
  • Checking which process is using a specific port.
  • Exiting and restarting the application.
  • Managing services (installing, uninstalling, setting descriptions, etc.).
  • Executing batch scripts with optional output capture and timeout.
  • Refreshing environment variables.
  • Creating and removing symbolic links.
  • Retrieving operating system information.

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.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor for the Batch class.

Definition at line 38 of file class.batch.php.

39 {
40 }

Member Function Documentation

◆ createSymlink()

createSymlink ( $src,
$dest )
static

Creates a symbolic link.

Parameters
string$srcThe source path.
string$destThe destination path.

Definition at line 277 of file class.batch.php.

278 {
279 global $bearsamppCore;
280 $src = Path::formatWindowsPath($src);
281 $dest = Path::formatWindowsPath($dest);
282 self::exec('createSymlink', '"' . Path::getLnExe() . '" --absolute --symbolic --traditional --1023safe "' . $src . '" ' . '"' . $dest . '"', true, false);
283 }
global $bearsamppCore
static exec($basename, $content, $timeout=true, $catchOutput=true, $standalone=false, $silent=true, $rebuild=true)
static formatWindowsPath($path)
static getLnExe($aetrayPath=false)

References $bearsamppCore, exec(), Path\formatWindowsPath(), and Path\getLnExe().

Referenced by Symlinks\createModuleSymlink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exec()

exec ( $basename,
$content,
$timeout = true,
$catchOutput = true,
$standalone = false,
$silent = true,
$rebuild = true )
static

Executes a batch script.

Parameters
string$basenameThe base name for the script and result files.
string$contentThe content of the batch script.
int | bool$timeoutThe timeout for the script execution in seconds, or true for default timeout, or false for no timeout.
bool$catchOutputWhether to capture the output of the script.
bool$standaloneWhether the script is standalone.
bool$silentWhether to execute the script silently.
bool$rebuildWhether to rebuild the result array.
Returns
array|false The result of the execution, or false on failure.

Definition at line 453 of file class.batch.php.

454 {
455 global $bearsamppConfig, $bearsamppWinbinder;
456 $result = false;
457
458 $resultFile = self::getTmpFile('.tmp', $basename);
459 $scriptPath = self::getTmpFile('.bat', $basename);
460 $checkFile = self::getTmpFile('.tmp', $basename);
461
462 // Redirect output
463 if ($catchOutput) {
464 $content = '(' . PHP_EOL . $content . PHP_EOL . ') > "' . $resultFile . '"' . (!UtilString::endWith($content, '2') ? ' 2>&1' : '');
465 }
466
467 // Header
468 $header = '@ECHO OFF' . PHP_EOL . PHP_EOL;
469
470 // Footer
471 $footer = PHP_EOL . (!$standalone ? PHP_EOL . 'ECHO ' . self::END_PROCESS_STR . ' > "' . $checkFile . '"' : '');
472
473 // Process
474 file_put_contents($scriptPath, $header . $content . $footer);
475
476 if (is_object($bearsamppWinbinder)) {
477 $bearsamppWinbinder->exec($scriptPath, null, $silent);
478 } else {
479 // Fallback to standard PHP execution if WinBinder is not available (e.g. on web interface)
480 $cmd = 'cmd /c "' . $scriptPath . '"';
481 if ($silent) {
482 // Use shell_exec with output redirection to NUL for silent background execution on Windows
483 @shell_exec('start /B "" ' . $cmd . ' > NUL 2>&1');
484 } else {
485 @shell_exec($cmd);
486 }
487 }
488
489 if (!$standalone) {
490 $timeout = is_numeric($timeout) ? $timeout : ($timeout === true ? $bearsamppConfig->getScriptsTimeout() : false);
491 $maxtime = time() + $timeout;
492 $noTimeout = $timeout === false;
493 while ($result === false || empty($result)) {
494 $finished = false;
495 if (file_exists($checkFile)) {
496 $check = file($checkFile);
497 if (!empty($check) && trim($check[0]) == self::END_PROCESS_STR) {
498 $finished = true;
499 if ($catchOutput && file_exists($resultFile)) {
500 $result = file($resultFile);
501 } else {
502 $result = self::CATCH_OUTPUT_FALSE;
503 }
504 }
505 }
506
507 // The script completed once the FINISHED! marker appears, even if it
508 // produced no output. Without this, empty output (e.g. mysqld
509 // --initialize-insecure) makes us spin until the timeout elapses.
510 if ($finished) {
511 break;
512 }
513
514 if ($maxtime < time() && !$noTimeout) {
515 break;
516 }
517 }
518 }
519
520 self::writeLog('Exec:');
521 self::writeLog('-> basename: ' . $basename);
522 self::writeLog('-> content: ' . str_replace(PHP_EOL, ' \\\\ ', $content));
523 self::writeLog('-> checkFile: ' . $checkFile);
524 self::writeLog('-> resultFile: ' . $resultFile);
525 self::writeLog('-> scriptPath: ' . $scriptPath);
526
527 if ($result !== false && !empty($result) && is_array($result)) {
528 if ($rebuild) {
529 $rebuildResult = array();
530 foreach ($result as $row) {
531 $row = trim($row);
532 if (!empty($row)) {
533 $rebuildResult[] = $row;
534 }
535 }
536 $result = $rebuildResult;
537 }
538 self::writeLog('-> result: ' . substr(implode(' \\\\ ', $result), 0, 2048));
539 } else {
540 self::writeLog('-> result: N/A');
541 }
542
543 return $result;
544 }
$result
static writeLog($log)
static getTmpFile($ext, $customName=null)
static endWith($string, $search)
global $bearsamppConfig
Definition homepage.php:46

References $bearsamppConfig, $result, UtilString\endWith(), getTmpFile(), and writeLog().

Referenced by OpenSsl\createCrt(), createSymlink(), OpenSsl\ensureRootCaExists(), Nssm\exec(), execStandalone(), findExeByPid(), BinApache\getCmdLineOutput(), BinMariadb\getCmdLineOutput(), BinMysql\getCmdLineOutput(), BinPostgresql\getCmdLineOutput(), getOsInfo(), getPearVersion(), getProcessUsingPort(), BinMariadb\initData(), initializeMariadb(), initializeMysql(), initializePostgresql(), installPostgresqlService(), OpenSsl\makeRootCa(), removeSymlink(), setServiceDescription(), setServiceDisplayName(), setServiceStartType(), and uninstallPostgresqlService().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execStandalone()

execStandalone ( $basename,
$content,
$silent = true )
static

Executes a standalone batch script.

Parameters
string$basenameThe base name for the script and result files.
string$contentThe content of the batch script.
bool$silentWhether to execute the script silently.
Returns
array|false The result of the execution, or false on failure.

Definition at line 435 of file class.batch.php.

436 {
437 return self::exec($basename, $content, false, false, true, $silent);
438 }

References exec().

Referenced by exitApp(), and refreshEnvVars().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exitApp()

exitApp ( $restart = false)
static

Exits the application, optionally restarting it.

Parameters
bool$restartWhether to restart the application after exiting.

Definition at line 125 of file class.batch.php.

126 {
128
129 $content = 'PING 1.1.1.1 -n 1 -w 2000 > nul' . PHP_EOL;
130 $content .= '"' . Path::getExeFilePath() . '" -quit -id={bearsampp}' . PHP_EOL;
131 if ($restart) {
132 $basename = 'restartApp';
133 Log::info('Restart App');
134 $content .= '"' . Path::getPhpExe() . '" "' . Core::isRoot_FILE . '" "' . Action::RESTART . '"' . PHP_EOL;
135 } else {
136 $basename = 'exitApp';
137 Log::info('Exit App');
138 }
139
141 self::execStandalone($basename, $content);
142 }
global $bearsamppRoot
const RESTART
static execStandalone($basename, $content, $silent=true)
const isRoot_FILE
static info($data, $file=null)
static getExeFilePath($aetrayPath=false)
static getPhpExe($aetrayPath=false)
static killBins($refreshProcs=false)

References $bearsamppCore, $bearsamppRoot, execStandalone(), Path\getExeFilePath(), Path\getPhpExe(), Log\info(), Core\isRoot_FILE, Win32Ps\killBins(), and Action\RESTART.

Referenced by ActionExec\__construct(), and restartApp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findExeByPid()

findExeByPid ( $pid)
static

Finds the executable name by its process ID (PID).

Parameters
int$pidThe process ID to search for.
Returns
string|false The executable name if found, false otherwise.

Definition at line 60 of file class.batch.php.

61 {
62 // Sanitize PID to prevent command injection
63 $sanitizedPid = UtilInput::sanitizePID($pid);
64 if ($sanitizedPid === false) {
65 self::writeLog('Invalid PID provided to findExeByPid: ' . var_export($pid, true));
66
67 return false;
68 }
69
70 $result = self::exec('findExeByPid', 'TASKLIST /FO CSV /NH /FI "PID eq ' . $sanitizedPid . '"', 5);
71 if ($result !== false) {
72 $expResult = explode('","', $result[0]);
73 if (is_array($expResult) && count($expResult) > 2 && isset($expResult[0]) && !empty($expResult[0])) {
74 return substr($expResult[0], 1);
75 }
76 }
77
78 return false;
79 }
static sanitizePID($pid)

References $result, exec(), UtilInput\sanitizePID(), and writeLog().

Referenced by getProcessUsingPort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOsInfo()

getOsInfo ( )
static

Gets the operating system information.

Returns
string The operating system information.

Definition at line 336 of file class.batch.php.

337 {
338 $result = self::exec('getOsInfo', 'ver', 5);
339 if (is_array($result)) {
340 foreach ($result as $row) {
341 if (UtilString::startWith($row, 'Microsoft')) {
342 return trim($row);
343 }
344 }
345 }
346
347 return '';
348 }
static startWith($string, $search)

References $result, exec(), and UtilString\startWith().

Referenced by ActionStartup\sysInfos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPearVersion()

getPearVersion ( )
static

Gets the version of PEAR installed.

Returns
string|null The PEAR version if found, null otherwise.

Definition at line 157 of file class.batch.php.

158 {
159 global $bearsamppBins;
160
161 $result = self::exec('getPearVersion', 'CMD /C "' . $bearsamppBins->getPhp()->getPearExe() . '" -V', 5);
162 if (is_array($result)) {
163 foreach ($result as $row) {
164 if (UtilString::startWith($row, 'PEAR Version:')) {
165 $expResult = explode(' ', $row);
166 if (count($expResult) == 3) {
167 return trim($expResult[2]);
168 }
169 }
170 }
171 }
172
173 return null;
174 }
global $bearsamppBins

References $bearsamppBins, $result, exec(), and UtilString\startWith().

Referenced by BinPhp\getPearVersion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProcessUsingPort()

getProcessUsingPort ( $port)
static

Gets the process using a specific port.

Parameters
int$portThe port number to check.
Returns
string|int|null The executable name and PID if found, the PID if executable not found, or null if no process is using the port.

Definition at line 88 of file class.batch.php.

89 {
90 // Sanitize port to prevent command injection
91 $sanitizedPort = UtilInput::sanitizePort($port);
92 if ($sanitizedPort === false) {
93 self::writeLog('Invalid port provided to getProcessUsingPort: ' . var_export($port, true));
94
95 return null;
96 }
97
98 $result = self::exec('getProcessUsingPort', 'NETSTAT -aon', 4);
99 if ($result !== false) {
100 foreach ($result as $row) {
101 if (!UtilString::startWith($row, 'TCP')) {
102 continue;
103 }
104 $rowExp = explode(' ', preg_replace('/\s+/', ' ', $row));
105 if (count($rowExp) == 5 && UtilString::endWith($rowExp[1], ':' . $sanitizedPort) && $rowExp[3] == 'LISTENING') {
106 $pid = intval($rowExp[4]);
107 $exe = self::findExeByPid($pid);
108 if ($exe !== false) {
109 return $exe . ' (' . $pid . ')';
110 }
111
112 return $pid;
113 }
114 }
115 }
116
117 return null;
118 }
$port
static findExeByPid($pid)
static sanitizePort($port)

References $port, $result, UtilString\endWith(), exec(), findExeByPid(), UtilInput\sanitizePort(), UtilString\startWith(), and writeLog().

Referenced by ServiceHelper\isPortInUse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTmpFile()

getTmpFile ( $ext,
$customName = null )
staticprivate

Gets a temporary file path with a specified extension and optional custom name.

Parameters
string$extThe file extension.
string | null$customNameAn optional custom name for the file.
Returns
string The temporary file path.

Definition at line 554 of file class.batch.php.

555 {
556 global $bearsamppCore;
557
558 return Path::formatWindowsPath(Path::getTmpPath() . '/' . (!empty($customName) ? $customName . '-' : '') . UtilString::random() . $ext);
559 }
static getTmpPath($aetrayPath=false)
static random($length=32, $withNumeric=true)

References $bearsamppCore, Path\formatWindowsPath(), Path\getTmpPath(), and UtilString\random().

Referenced by exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeMariadb()

initializeMariadb ( $path)
static

Initializes MariaDB using a specified path.

Parameters
string$pathThe path to the MariaDB initialization script.

Definition at line 261 of file class.batch.php.

262 {
263 if (!file_exists($path . '/init.bat')) {
264 Log::warning($path . '/init.bat does not exist');
265
266 return;
267 }
268 self::exec('initializeMariadb', 'CMD /C "' . $path . '/init.bat"', 60);
269 }
static warning($data, $file=null)

References exec(), and Log\warning().

Referenced by BinMariadb\initData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeMysql()

initializeMysql ( $path)
static

Initializes MySQL using a specified path.

Parameters
string$pathThe path to the MySQL initialization script.

Definition at line 190 of file class.batch.php.

191 {
192 if (!file_exists($path . '/init.bat')) {
193 Log::warning($path . '/init.bat does not exist');
194
195 return;
196 }
197 self::exec('initializeMysql', 'CMD /C "' . $path . '/init.bat"', 60);
198 }

References exec(), and Log\warning().

Referenced by BinMysql\initData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializePostgresql()

initializePostgresql ( $path)
static

Initializes PostgreSQL using a specified path.

Parameters
string$pathThe path to the PostgreSQL initialization script.

Definition at line 246 of file class.batch.php.

247 {
248 if (!file_exists($path . '/init.bat')) {
249 Log::warning($path . '/init.bat does not exist');
250
251 return;
252 }
253 self::exec('initializePostgresql', 'CMD /C "' . $path . '/init.bat"', 15);
254 }

References exec(), and Log\warning().

Referenced by BinPostgresql\initData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ installPostgresqlService()

installPostgresqlService ( )
static

Installs the PostgreSQL service.

Returns
bool True if the service was installed successfully, false otherwise.

Definition at line 205 of file class.batch.php.

206 {
207 global $bearsamppBins;
208
209 $cmd = '"' . Path::formatWindowsPath($bearsamppBins->getPostgresql()->getCtlExe()) . '" register -N "' . BinPostgresql::SERVICE_NAME . '"';
210 $cmd .= ' -U "LocalSystem" -D "' . Path::formatWindowsPath(Path::getModuleSymlinkPath($bearsamppBins->getPostgresql())) . '\\data"';
211 $cmd .= ' -l "' . Path::formatWindowsPath($bearsamppBins->getPostgresql()->getErrorLog()) . '" -w';
212 self::exec('installPostgresqlService', $cmd, true, false);
213
214 if (!$bearsamppBins->getPostgresql()->getService()->isInstalled()) {
215 return false;
216 }
217
218 self::setServiceDisplayName(BinPostgresql::SERVICE_NAME, $bearsamppBins->getPostgresql()->getService()->getDisplayName());
219 self::setServiceDescription(BinPostgresql::SERVICE_NAME, $bearsamppBins->getPostgresql()->getService()->getDisplayName());
221
222 return true;
223 }
static setServiceDisplayName($serviceName, $displayName)
static setServiceStartType($serviceName, $startType)
static setServiceDescription($serviceName, $desc)
static getModuleSymlinkPath($module)

References $bearsamppBins, exec(), Path\formatWindowsPath(), Path\getModuleSymlinkPath(), BinPostgresql\SERVICE_NAME, setServiceDescription(), setServiceDisplayName(), and setServiceStartType().

Referenced by Win32Service\create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshEnvVars()

refreshEnvVars ( )
static

Refreshes the environment variables.

Definition at line 179 of file class.batch.php.

180 {
183 }
static getRootPath($aetrayPath=false)
static getSetEnvExe($aetrayPath=false)
const APP_PATH_REG_ENTRY

References $bearsamppCore, $bearsamppRoot, Registry\APP_PATH_REG_ENTRY, execStandalone(), Path\formatWindowsPath(), Path\getRootPath(), and Path\getSetEnvExe().

Referenced by Registry\setValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSymlink()

removeSymlink ( $link)
static

Removes a symbolic link.

Parameters
string$linkThe path to the symbolic link.
Returns
bool True if the symlink was removed successfully, false otherwise.

Definition at line 292 of file class.batch.php.

293 {
294 if (!file_exists($link)) {
295 self::writeLog('-> removeSymlink: Link does not exist: ' . $link);
296
297 return true; // If the link doesn't exist, nothing to do
298 }
299
300 // Check if it's a directory symlink
301 $isDirectory = is_dir($link);
302 $formattedLink = Path::formatWindowsPath($link);
303
304 try {
305 // Use different commands based on whether it's a directory or file symlink
306 if ($isDirectory) {
307 // For directory symlinks
308 self::exec('removeSymlink', 'rmdir /Q "' . $formattedLink . '"', true, false);
309 } else {
310 // For file symlinks
311 self::exec('removeSymlink', 'del /F /Q "' . $formattedLink . '"', true, false);
312 }
313
314 // Check if removal was successful
315 if (file_exists($link)) {
316 self::writeLog('-> removeSymlink: Failed to remove symlink: ' . $link);
317
318 return false;
319 }
320
321 self::writeLog('-> removeSymlink: Successfully removed symlink: ' . $link);
322
323 return true;
324 } catch (Exception $e) {
325 self::writeLog('-> removeSymlink: Exception: ' . $e->getMessage());
326
327 return false;
328 }
329 }

References exec(), Path\formatWindowsPath(), and writeLog().

Referenced by Symlinks\createModuleSymlink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restartApp()

restartApp ( )
static

Restarts the application.

Definition at line 147 of file class.batch.php.

148 {
149 self::exitApp(true);
150 }
static exitApp($restart=false)

References exitApp().

Referenced by ActionExec\__construct().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setServiceDescription()

setServiceDescription ( $serviceName,
$desc )
static

Sets the description of a service.

Parameters
string$serviceNameThe name of the service.
string$descThe description to set.

Definition at line 380 of file class.batch.php.

381 {
382 // Sanitize service name to prevent command injection
383 $sanitizedName = UtilInput::sanitizeServiceName($serviceName);
384 if ($sanitizedName === false) {
385 self::writeLog('Invalid service name provided to setServiceDescription: ' . $serviceName);
386
387 return;
388 }
389
390 // Remove quotes and dangerous characters from description
391 $sanitizedDesc = str_replace('"', '', $desc);
392 $sanitizedDesc = preg_replace('/[<>|&^]/', '', $sanitizedDesc);
393
394 $cmd = 'sc description ' . $sanitizedName . ' "' . $sanitizedDesc . '"';
395 self::exec('setServiceDescription', $cmd, true, false);
396 }
static sanitizeServiceName($serviceName)

References exec(), UtilInput\sanitizeServiceName(), and writeLog().

Referenced by installPostgresqlService().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setServiceDisplayName()

setServiceDisplayName ( $serviceName,
$displayName )
static

Sets the display name of a service.

Parameters
string$serviceNameThe name of the service.
string$displayNameThe display name to set.

Definition at line 356 of file class.batch.php.

357 {
358 // Sanitize service name to prevent command injection
359 $sanitizedName = UtilInput::sanitizeServiceName($serviceName);
360 if ($sanitizedName === false) {
361 self::writeLog('Invalid service name provided to setServiceDisplayName: ' . $serviceName);
362
363 return;
364 }
365
366 // Remove quotes and dangerous characters from display name
367 $sanitizedDisplayName = str_replace('"', '', $displayName);
368 $sanitizedDisplayName = preg_replace('/[<>|&^]/', '', $sanitizedDisplayName);
369
370 $cmd = 'sc config ' . $sanitizedName . ' DisplayName= "' . $sanitizedDisplayName . '"';
371 self::exec('setServiceDisplayName', $cmd, true, false);
372 }

References exec(), UtilInput\sanitizeServiceName(), and writeLog().

Referenced by installPostgresqlService().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setServiceStartType()

setServiceStartType ( $serviceName,
$startType )
static

Sets the start type of a service.

Parameters
string$serviceNameThe name of the service.
string$startTypeThe start type to set (e.g., "auto", "demand").

Definition at line 404 of file class.batch.php.

405 {
406 // Sanitize service name to prevent command injection
407 $sanitizedName = UtilInput::sanitizeServiceName($serviceName);
408 if ($sanitizedName === false) {
409 self::writeLog('Invalid service name provided to setServiceStartType: ' . $serviceName);
410
411 return;
412 }
413
414 // Validate start type (only allow known values)
415 $allowedStartTypes = ['auto', 'demand', 'disabled', 'delayed-auto'];
416 if (!in_array(strtolower($startType), $allowedStartTypes, true)) {
417 self::writeLog('Invalid start type provided: ' . $startType);
418
419 return;
420 }
421
422 $cmd = 'sc config ' . $sanitizedName . ' start= ' . strtolower($startType);
423 self::exec('setServiceStartType', $cmd, true, false);
424 }

References exec(), UtilInput\sanitizeServiceName(), and writeLog().

Referenced by installPostgresqlService().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uninstallPostgresqlService()

uninstallPostgresqlService ( )
static

Uninstalls the PostgreSQL service.

Returns
bool True if the service was uninstalled successfully, false otherwise.

Definition at line 230 of file class.batch.php.

231 {
232 global $bearsamppBins;
233
234 $cmd = '"' . Path::formatWindowsPath($bearsamppBins->getPostgresql()->getCtlExe()) . '" unregister -N "' . BinPostgresql::SERVICE_NAME . '"';
235 $cmd .= ' -l "' . Path::formatWindowsPath($bearsamppBins->getPostgresql()->getErrorLog()) . '" -w';
236 self::exec('uninstallPostgresqlService', $cmd, true, false);
237
238 return !$bearsamppBins->getPostgresql()->getService()->isInstalled();
239 }

References $bearsamppBins, exec(), Path\formatWindowsPath(), and BinPostgresql\SERVICE_NAME.

Referenced by Win32Service\delete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeLog()

writeLog ( $log)
staticprivate

Writes a log entry to the batch log file.

Parameters
string$logThe log message to write.

Definition at line 47 of file class.batch.php.

48 {
49 global $bearsamppRoot;
51 }
static debug($data, $file=null)
static getBatchLogFilePath($aetrayPath=false)

References $bearsamppRoot, Log\debug(), and Path\getBatchLogFilePath().

Referenced by exec(), findExeByPid(), getProcessUsingPort(), removeSymlink(), setServiceDescription(), setServiceDisplayName(), and setServiceStartType().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ CATCH_OUTPUT_FALSE

const CATCH_OUTPUT_FALSE = 'bearsamppCatchOutputFalse'

Definition at line 33 of file class.batch.php.

◆ END_PROCESS_STR

const END_PROCESS_STR = 'FINISHED!'

Definition at line 32 of file class.batch.php.


The documentation for this class was generated from the following file: