Bearsampp 2025.8.29
Loading...
Searching...
No Matches
Core Class Reference

Public Member Functions

 __construct ()
 __toString ()
 addLoadingPid ($pid)
 getAjaxPath ($aetrayPath=false)
 getAppVersion ()
 getExec ($aetrayPath=false)
 getFileFromUrl (string $moduleUrl, string $filePath, $progressBar=false)
 getHomepagePath ($aetrayPath=false)
 getHostsEditorExe ($aetrayPath=false)
 getHostsEditorPath ($aetrayPath=false)
 getIconsPath ($aetrayPath=false)
 getImagesPath ($aetrayPath=false)
 getisRootFilePath ($aetrayPath=false)
 getLangsPath ($aetrayPath=false)
 getLastPath ($aetrayPath=false)
 getLastPathContent ()
 getLibsPath ($aetrayPath=false)
 getLnExe ($aetrayPath=false)
 getLnPath ($aetrayPath=false)
 getLoadingPid ($aetrayPath=false)
 getNssmExe ($aetrayPath=false)
 getNssmPath ($aetrayPath=false)
 getOpenSslConf ($aetrayPath=false)
 getOpenSslExe ($aetrayPath=false)
 getOpenSslPath ($aetrayPath=false)
 getPhpExe ($aetrayPath=false)
 getPhpPath ($aetrayPath=false)
 getPwgenExe ($aetrayPath=false)
 getPwgenPath ($aetrayPath=false)
 getResourcesPath ($aetrayPath=false)
 getScript ($type)
 getScriptsPath ($aetrayPath=false)
 getSetEnvExe ($aetrayPath=false)
 getSetEnvPath ($aetrayPath=false)
 getTmpPath ($aetrayPath=false)
 setExec ($action)
 unzipFile ($filePath, $destination, $progressCallback=null)

Data Fields

const APP_VERSION = 'version.dat'
const EXEC = 'exec.dat'
const HOSTSEDITOR_EXE = 'hEdit_x64.exe'
const isRoot_FILE = 'root.php'
const LAST_PATH = 'lastPath.dat'
const LN_EXE = 'ln.exe'
const LOADING_PID = 'loading.pid'
const NSSM_EXE = 'nssm.exe'
const OPENSSL_CONF = 'openssl.cfg'
const OPENSSL_EXE = 'openssl.exe'
const PATH_LIN_PLACEHOLDER = '~BEARSAMPP_LIN_PATH~'
const PATH_WIN_PLACEHOLDER = '~BEARSAMPP_WIN_PATH~'
const PHP_EXE = 'php-win.exe'
const PWGEN_EXE = "PWGenPortable.exe"
const SCRIPT_EXEC_SILENT = 'execSilent.vbs'
const SETENV_EXE = 'SetEnv.exe'

Detailed Description

Class Core

This class provides core functionalities and constants for the Bearsampp application. It includes methods for retrieving paths, managing application versions, and handling various executable files and configurations.

Definition at line 18 of file class.core.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Core constructor.

Loads the WinBinder extension if available.

Definition at line 46 of file class.core.php.

47 {
48 if ( extension_loaded( 'winbinder' ) ) {
49 require_once $this->getLibsPath() . '/winbinder/winbinder.php';
50 }
51 }
getLibsPath($aetrayPath=false)

References getLibsPath().

Member Function Documentation

◆ __toString()

__toString ( )

Provides a string representation of the core object.

Returns
string A string describing the core object.

Definition at line 455 of file class.core.php.

456 {
457 return 'core object';
458 }

◆ addLoadingPid()

addLoadingPid ( $pid)

Adds a PID to the loading PID file.

Parameters
int$pidThe PID to add.

Definition at line 265 of file class.core.php.

266 {
267 file_put_contents( $this->getLoadingPid(), $pid . PHP_EOL, FILE_APPEND );
268 }
getLoadingPid($aetrayPath=false)

References getLoadingPid().

◆ getAjaxPath()

getAjaxPath ( $aetrayPath = false)

Definition at line 140 of file class.core.php.

141 {
142 return $this->getHomepagePath( $aetrayPath ) . '/ajax';
143 }
getHomepagePath($aetrayPath=false)

References getHomepagePath().

◆ getAppVersion()

getAppVersion ( )

Retrieves the application version.

Returns
string|null The application version or null if not found.

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

191 {
192 global $bearsamppLang;
193
194 $filePath = $this->getResourcesPath() . '/' . self::APP_VERSION;
195 if ( !is_file( $filePath ) ) {
196 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_CONF_NOT_FOUND ), APP_TITLE, $filePath ) );
197
198 return null;
199 }
200
201 return trim( file_get_contents( $filePath ) );
202 }
global $bearsamppLang
getResourcesPath($aetrayPath=false)
const ERROR_CONF_NOT_FOUND
static logError($data, $file=null)
const APP_TITLE
Definition root.php:13

References $bearsamppLang, APP_TITLE, Lang\ERROR_CONF_NOT_FOUND, getResourcesPath(), and Util\logError().

◆ getExec()

getExec ( $aetrayPath = false)

Retrieves the path to the exec file.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the exec file.

Definition at line 233 of file class.core.php.

234 {
235 return $this->getTmpPath( $aetrayPath ) . '/' . self::EXEC;
236 }
getTmpPath($aetrayPath=false)

References getTmpPath().

Referenced by setExec().

◆ getFileFromUrl()

getFileFromUrl ( string $moduleUrl,
string $filePath,
$progressBar = false )

Fetches a file from a given URL and saves it to a specified file path.

This method attempts to retrieve the content from the provided URL and save it to the specified file path. If any error occurs during fetching or saving, it logs the error and returns an error message. If the operation is successful, it returns the file path. The method also logs the file size if the input stream is a valid resource.

Parameters
string$moduleUrlThe URL from which to fetch the file content.
string$filePathThe path where the file content should be saved.
bool$progressBarOptional. Whether to display a progress bar during the download process. Default is false.
Returns
array Returns the file path if successful, or an array with an error message if an error occurs.

Definition at line 606 of file class.core.php.

607 {
608 // Open the URL for reading
609 $inputStream = @fopen( $moduleUrl, 'rb' );
610 if ( $inputStream === false ) {
611 Util::logError( 'Error fetching content from URL: ' . $moduleUrl );
612
613 return ['error' => 'Error fetching module'];
614 }
615
616 // Open the file for writing
617 $outputStream = @fopen( $filePath, 'wb' );
618 if ( $outputStream === false ) {
619 Util::logError( 'Error opening file for writing: ' . $filePath );
620 fclose( $inputStream );
621
622 return ['error' => 'Error saving module'];
623 }
624
625 // Read and write in chunks to avoid memory overload
626 $bufferSize = 8096; // 8KB
627 $chunksRead = 0;
628
629 while ( !feof( $inputStream ) ) {
630 $buffer = fread( $inputStream, $bufferSize );
631 fwrite( $outputStream, $buffer );
632 $chunksRead++;
633
634 // Send progress update
635 if ( $progressBar ) {
636 $progress = $chunksRead;
637 echo json_encode( ['progress' => $progress] );
638
639 // Check if output buffering is active before calling ob_flush()
640 if ( ob_get_length() !== false ) {
641 ob_flush();
642 }
643 flush();
644 }
645 }
646
647 fclose( $inputStream );
648 fclose( $outputStream );
649
650 return ['success' => true];
651 }

References Util\logError().

◆ getHomepagePath()

getHomepagePath ( $aetrayPath = false)

Definition at line 135 of file class.core.php.

136 {
137 return $this->getResourcesPath( $aetrayPath ) . '/homepage';
138 }

References getResourcesPath().

Referenced by getAjaxPath().

◆ getHostsEditorExe()

getHostsEditorExe ( $aetrayPath = false)

Retrieves the path to the HostsEditor executable.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the HostsEditor executable.

Definition at line 397 of file class.core.php.

398 {
399 return $this->getHostsEditorPath( $aetrayPath ) . '/' . self::HOSTSEDITOR_EXE;
400 }
getHostsEditorPath($aetrayPath=false)

References getHostsEditorPath().

◆ getHostsEditorPath()

getHostsEditorPath ( $aetrayPath = false)

Retrieves the path to the HostsEditor directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the HostsEditor directory.

Definition at line 385 of file class.core.php.

386 {
387 return $this->getLibsPath( $aetrayPath ) . '/hostseditor';
388 }

References getLibsPath().

Referenced by getHostsEditorExe().

◆ getIconsPath()

getIconsPath ( $aetrayPath = false)

Retrieves the path to the icons.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the icons.

Definition at line 102 of file class.core.php.

103 {
104 return $this->getImagesPath($aetrayPath) . '/icons';
105 }
getImagesPath($aetrayPath=false)

References getImagesPath().

◆ getImagesPath()

getImagesPath ( $aetrayPath = false)

Retrieves the path to the images.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the images.

Definition at line 114 of file class.core.php.

115 {
116 global $bearsamppCore;
117
118 return $bearsamppCore->getHomepagePath($aetrayPath) . '/img';
119 }
global $bearsamppCore

References $bearsamppCore.

Referenced by getIconsPath().

◆ getisRootFilePath()

getisRootFilePath ( $aetrayPath = false)

Retrieves the path to the root file.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the root file.

Definition at line 178 of file class.core.php.

179 {
180 global $bearsamppRoot;
181
182 return $bearsamppRoot->getCorePath( $aetrayPath ) . '/' . self::isRoot_FILE;
183 }
global $bearsamppRoot

References $bearsamppRoot.

◆ getLangsPath()

getLangsPath ( $aetrayPath = false)

Retrieves the path to the language files.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the language files.

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

61 {
62 global $bearsamppRoot;
63
64 return $bearsamppRoot->getCorePath( $aetrayPath ) . '/langs';
65 }

References $bearsamppRoot.

◆ getLastPath()

getLastPath ( $aetrayPath = false)

Retrieves the path to the last path file.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the last path file.

Definition at line 211 of file class.core.php.

212 {
213 return $this->getResourcesPath( $aetrayPath ) . '/' . self::LAST_PATH;
214 }

References getResourcesPath().

Referenced by getLastPathContent().

◆ getLastPathContent()

getLastPathContent ( )

Retrieves the content of the last path file.

Returns
string|false The content of the last path file or false on failure.

Definition at line 221 of file class.core.php.

222 {
223 return @file_get_contents( $this->getLastPath() );
224 }
getLastPath($aetrayPath=false)

References getLastPath().

◆ getLibsPath()

getLibsPath ( $aetrayPath = false)

Retrieves the path to the libraries.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the libraries.

Definition at line 74 of file class.core.php.

75 {
76 global $bearsamppRoot;
77
78 return $bearsamppRoot->getCorePath( $aetrayPath ) . '/libs';
79 }

References $bearsamppRoot.

Referenced by __construct(), getHostsEditorPath(), getLnPath(), getNssmPath(), getOpenSslPath(), getPhpPath(), getPwgenPath(), getSetEnvPath(), and unzipFile().

◆ getLnExe()

getLnExe ( $aetrayPath = false)

Retrieves the path to the LN executable.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the LN executable.

Definition at line 421 of file class.core.php.

422 {
423 return $this->getLnPath( $aetrayPath ) . '/' . self::LN_EXE;
424 }
getLnPath($aetrayPath=false)

References getLnPath().

◆ getLnPath()

getLnPath ( $aetrayPath = false)

Retrieves the path to the LN directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the LN directory.

Definition at line 409 of file class.core.php.

410 {
411 return $this->getLibsPath( $aetrayPath ) . '/ln';
412 }

References getLibsPath().

Referenced by getLnExe().

◆ getLoadingPid()

getLoadingPid ( $aetrayPath = false)

Retrieves the path to the loading PID file.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the loading PID file.

Definition at line 255 of file class.core.php.

256 {
257 return $this->getResourcesPath( $aetrayPath ) . '/' . self::LOADING_PID;
258 }

References getResourcesPath().

Referenced by addLoadingPid().

◆ getNssmExe()

getNssmExe ( $aetrayPath = false)

Retrieves the path to the NSSM executable.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the NSSM executable.

Definition at line 337 of file class.core.php.

338 {
339 return $this->getNssmPath( $aetrayPath ) . '/' . self::NSSM_EXE;
340 }
getNssmPath($aetrayPath=false)

References getNssmPath().

◆ getNssmPath()

getNssmPath ( $aetrayPath = false)

Retrieves the path to the NSSM directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the NSSM directory.

Definition at line 325 of file class.core.php.

326 {
327 return $this->getLibsPath( $aetrayPath ) . '/nssm';
328 }

References getLibsPath().

Referenced by getNssmExe().

◆ getOpenSslConf()

getOpenSslConf ( $aetrayPath = false)

Retrieves the path to the OpenSSL configuration file.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the OpenSSL configuration file.

Definition at line 373 of file class.core.php.

374 {
375 return $this->getOpenSslPath( $aetrayPath ) . '/' . self::OPENSSL_CONF;
376 }
getOpenSslPath($aetrayPath=false)

References getOpenSslPath().

◆ getOpenSslExe()

getOpenSslExe ( $aetrayPath = false)

Retrieves the path to the OpenSSL executable.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the OpenSSL executable.

Definition at line 361 of file class.core.php.

362 {
363 return $this->getOpenSslPath( $aetrayPath ) . '/' . self::OPENSSL_EXE;
364 }

References getOpenSslPath().

◆ getOpenSslPath()

getOpenSslPath ( $aetrayPath = false)

Retrieves the path to the OpenSSL directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the OpenSSL directory.

Definition at line 349 of file class.core.php.

350 {
351 return $this->getLibsPath( $aetrayPath ) . '/openssl';
352 }

References getLibsPath().

Referenced by getOpenSslConf(), and getOpenSslExe().

◆ getPhpExe()

getPhpExe ( $aetrayPath = false)

Retrieves the path to the PHP executable.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the PHP executable.

Definition at line 289 of file class.core.php.

290 {
291 return $this->getPhpPath( $aetrayPath ) . '/' . self::PHP_EXE;
292 }
getPhpPath($aetrayPath=false)

References getPhpPath().

◆ getPhpPath()

getPhpPath ( $aetrayPath = false)

Retrieves the path to the PHP directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the PHP directory.

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

278 {
279 return $this->getLibsPath( $aetrayPath ) . '/php';
280 }

References getLibsPath().

Referenced by getPhpExe().

◆ getPwgenExe()

getPwgenExe ( $aetrayPath = false)

Retrieves the path to the PWGen executable.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the PWGen executable.

Definition at line 445 of file class.core.php.

446 {
447 return $this->getPwgenPath( $aetrayPath ) . '/' . self::PWGEN_EXE;
448 }
getPwgenPath($aetrayPath=false)

References getPwgenPath().

◆ getPwgenPath()

getPwgenPath ( $aetrayPath = false)

Retrieves the path to the PWGen directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the PWGen directory.

Definition at line 433 of file class.core.php.

434 {
435 return $this->getLibsPath( $aetrayPath ) . '/pwgen';
436 }

References getLibsPath().

Referenced by getPwgenExe().

◆ getResourcesPath()

getResourcesPath ( $aetrayPath = false)

Retrieves the path to the resources.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the resources.

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

89 {
90 global $bearsamppRoot;
91
92 return $bearsamppRoot->getCorePath( $aetrayPath ) . '/resources';
93 }

References $bearsamppRoot.

Referenced by getAppVersion(), getHomepagePath(), getLastPath(), and getLoadingPid().

◆ getScript()

getScript ( $type)

Retrieves the path to a specific script.

Parameters
string$typeThe type of script.
Returns
string The path to the script.

Definition at line 152 of file class.core.php.

153 {
154 return $this->getScriptsPath() . '/' . $type;
155 }
getScriptsPath($aetrayPath=false)

References getScriptsPath().

◆ getScriptsPath()

getScriptsPath ( $aetrayPath = false)

Retrieves the path to the scripts.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the scripts.

Definition at line 128 of file class.core.php.

129 {
130 global $bearsamppRoot;
131
132 return $bearsamppRoot->getCorePath( $aetrayPath ) . '/scripts';
133 }

References $bearsamppRoot.

Referenced by getScript().

◆ getSetEnvExe()

getSetEnvExe ( $aetrayPath = false)

Retrieves the path to the SetEnv executable.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the SetEnv executable.

Definition at line 313 of file class.core.php.

314 {
315 return $this->getSetEnvPath( $aetrayPath ) . '/' . self::SETENV_EXE;
316 }
getSetEnvPath($aetrayPath=false)

References getSetEnvPath().

◆ getSetEnvPath()

getSetEnvPath ( $aetrayPath = false)

Retrieves the path to the SetEnv directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the SetEnv directory.

Definition at line 301 of file class.core.php.

302 {
303 return $this->getLibsPath( $aetrayPath ) . '/setenv';
304 }

References getLibsPath().

Referenced by getSetEnvExe().

◆ getTmpPath()

getTmpPath ( $aetrayPath = false)

Retrieves the path to the temporary directory.

Parameters
bool$aetrayPathWhether to format the path for AeTrayMenu.
Returns
string The path to the temporary directory.

Definition at line 164 of file class.core.php.

165 {
166 global $bearsamppRoot;
167
168 return $bearsamppRoot->getCorePath( $aetrayPath ) . '/tmp';
169 }

References $bearsamppRoot.

Referenced by getExec().

◆ setExec()

setExec ( $action)

Sets the content of the exec file.

Parameters
string$actionThe content to set in the exec file.

Definition at line 243 of file class.core.php.

244 {
245 file_put_contents( $this->getExec(), $action );
246 }
getExec($aetrayPath=false)

References getExec().

◆ unzipFile()

unzipFile ( $filePath,
$destination,
$progressCallback = null )

Unzips a file to the specified directory and provides progress updates.

This method uses the 7-Zip command-line tool to extract the contents of a zip file. It first tests the archive to determine the number of files to be extracted, then proceeds with the extraction while providing progress updates via a callback function.

Parameters
string$filePathThe path to the zip file.
string$destinationThe directory to extract the files to.
callable | null$progressCallbackA callback function to report progress. The callback receives two parameters:
  • int $currentFile: The current file number being extracted.
  • int $totalFiles: The total number of files to be extracted.

@global object $bearsamppRoot Global object to get core paths.

Returns
array|false An array containing the result of the extraction on success or failure:
  • On success: ['success' => true, 'numFiles' => int]
  • On failure: ['error' => string, 'numFiles' => int]
  • Returns false if the 7-Zip executable is not found.

Definition at line 480 of file class.core.php.

481 {
482 global $bearsamppRoot;
483
484 $sevenZipPath = $this->getLibsPath() . '/7zip/7za.exe';
485
486 if ( !file_exists( $sevenZipPath ) ) {
487 Util::logError( '7za.exe not found at: ' . $sevenZipPath );
488
489 return false;
490 }
491
492 // Command to test the archive and get the number of files
493 $testCommand = escapeshellarg( $sevenZipPath ) . ' t ' . escapeshellarg( $filePath ) . ' -y -bsp1';
494 $testOutput = shell_exec( $testCommand );
495
496 // Extract the number of files from the test command output
497 preg_match( '/Files: (\d+)/', $testOutput, $matches );
498 $numFiles = isset( $matches[1] ) ? (int) $matches[1] : 0;
499 Util::logTrace( 'Number of files to be extracted: ' . $numFiles );
500
501 // Command to extract the archive
502 $command = escapeshellarg( $sevenZipPath ) . ' x ' . escapeshellarg( $filePath ) . ' -y -bsp1 -bb0 -o' . escapeshellarg( $destination );
503 Util::logTrace( 'Executing command: ' . $command );
504
505 $process = popen( $command, 'rb' );
506
507 if ( $process ) {
508 $buffer = '';
509 while ( !feof( $process ) ) {
510 $buffer .= fread( $process, 8192 ); // Read in chunks of 8KB
511 while ( ($pos = strpos( $buffer, "\r" )) !== false ) {
512 $line = substr( $buffer, 0, $pos );
513 $buffer = substr( $buffer, $pos + 1 );
514 $line = trim( $line ); // Remove any leading/trailing whitespace
515 Util::logTrace( "Processing line: $line" );
516
517 // Check if the line indicates everything is okay
518 if ( $line === "Everything is Ok" ) {
519 if ( $progressCallback ) {
520 Util::logTrace( "Extraction progress: 100%" );
521 call_user_func( $progressCallback, 100 );
522 Util::logTrace( "Progress callback called with percentage: 100" );
523 }
524 }
525 else if ( $progressCallback && preg_match( '/(?:^|\s)(\d+)%/', $line, $matches ) ) {
526 $currentPercentage = intval( $matches[1] );
527 Util::logTrace( "Extraction progress: $currentPercentage%" );
528 call_user_func( $progressCallback, $currentPercentage );
529 Util::logTrace( "Progress callback called with percentage: $currentPercentage" );
530 }
531 else {
532 Util::logTrace( "Line did not match pattern: $line" );
533 }
534 }
535 }
536
537 // Process any remaining data in the buffer
538 if ( !empty( $buffer ) ) {
539 $line = trim( $buffer );
540 Util::logTrace( "Processing remaining line: $line" );
541
542 // Check if the remaining line indicates everything is okay
543 if ( $line === "Everything is Ok" ) {
544 if ( $progressCallback ) {
545 Util::logTrace( "Extraction progress: 100%" );
546 call_user_func( $progressCallback, 100 );
547 Util::logTrace( "Progress callback called with percentage: 100" );
548 }
549 }
550 else if ( $progressCallback && preg_match( '/(?:^|\s)(\d+)%/', $line, $matches ) ) {
551 $currentPercentage = intval( $matches[1] );
552 Util::logTrace( "Extraction progress: $currentPercentage%" );
553 call_user_func( $progressCallback, $currentPercentage );
554 Util::logTrace( "Progress callback called with percentage: $currentPercentage" );
555 }
556 else {
557 Util::logTrace( "Remaining line did not match pattern: $line" );
558 }
559 }
560
561 $returnVar = pclose( $process );
562 Util::logTrace( 'Command return value: ' . $returnVar );
563
564 // Set progress to 100% if the command was successful
565 if ( $returnVar === 0 && $progressCallback ) {
566 Util::logTrace( "Extraction completed successfully. Setting progress to 100%" );
567 call_user_func( $progressCallback, 100 );
568 Util::logTrace( "Progress callback called with percentage: 100" );
569
570 // Adding a small delay to ensure the progress bar update is processed
571 usleep( 100000 ); // 100 milliseconds
572 }
573
574 if ( $returnVar === 0 ) {
575 Util::logDebug( 'Successfully unzipped file to: ' . $destination );
576
577 return ['success' => true, 'numFiles' => $numFiles];
578 }
579 else {
580 Util::logError( 'Failed to unzip file. Command return value: ' . $returnVar );
581
582 return ['error' => 'Failed to unzip file', 'numFiles' => $numFiles];
583 }
584 }
585 else {
586 Util::logError( 'Failed to open process for command: ' . $command );
587
588 return ['error' => 'Failed to open process', 'numFiles' => $numFiles];
589 }
590 }
static logTrace($data, $file=null)
static logDebug($data, $file=null)

References $bearsamppRoot, getLibsPath(), Util\logDebug(), Util\logError(), and Util\logTrace().

Field Documentation

◆ APP_VERSION

const APP_VERSION = 'version.dat'

Definition at line 34 of file class.core.php.

◆ EXEC

const EXEC = 'exec.dat'

Definition at line 36 of file class.core.php.

◆ HOSTSEDITOR_EXE

const HOSTSEDITOR_EXE = 'hEdit_x64.exe'

Definition at line 30 of file class.core.php.

◆ isRoot_FILE

const isRoot_FILE = 'root.php'

Definition at line 21 of file class.core.php.

Referenced by Batch\exitApp(), TplApp\getActionRun(), and Util\startLoading().

◆ LAST_PATH

const LAST_PATH = 'lastPath.dat'

Definition at line 35 of file class.core.php.

◆ LN_EXE

const LN_EXE = 'ln.exe'

Definition at line 31 of file class.core.php.

◆ LOADING_PID

const LOADING_PID = 'loading.pid'

Definition at line 37 of file class.core.php.

◆ NSSM_EXE

const NSSM_EXE = 'nssm.exe'

Definition at line 27 of file class.core.php.

◆ OPENSSL_CONF

const OPENSSL_CONF = 'openssl.cfg'

Definition at line 29 of file class.core.php.

◆ OPENSSL_EXE

const OPENSSL_EXE = 'openssl.exe'

Definition at line 28 of file class.core.php.

◆ PATH_LIN_PLACEHOLDER

const PATH_LIN_PLACEHOLDER = '~BEARSAMPP_LIN_PATH~'

Definition at line 23 of file class.core.php.

Referenced by Util\changePath().

◆ PATH_WIN_PLACEHOLDER

const PATH_WIN_PLACEHOLDER = '~BEARSAMPP_WIN_PATH~'

Definition at line 22 of file class.core.php.

Referenced by Util\changePath().

◆ PHP_EXE

const PHP_EXE = 'php-win.exe'

Definition at line 25 of file class.core.php.

◆ PWGEN_EXE

const PWGEN_EXE = "PWGenPortable.exe"

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

◆ SCRIPT_EXEC_SILENT

const SCRIPT_EXEC_SILENT = 'execSilent.vbs'

Definition at line 39 of file class.core.php.

Referenced by WinBinder\exec().

◆ SETENV_EXE

const SETENV_EXE = 'SetEnv.exe'

Definition at line 26 of file class.core.php.


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