![]() |
Bearsampp 2026.7.11
|
Public Member Functions | |
| __construct () | |
| __toString () | |
| addLoadingPid ($pid) | |
| getAppVersion () | |
| getExec ($aetrayPath=false) | |
| getFileFromUrl (string $moduleUrl, string $filePath, $progressBar=false) | |
| getLastPathContent () | |
| getLoadingPid ($aetrayPath=false) | |
| getPreviousExec () | |
| 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 = "PwTech.exe" |
| const | SETENV_EXE = 'SetEnv.exe' |
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.
| __construct | ( | ) |
Core constructor.
Loads the WinBinder extension if available.
Definition at line 44 of file class.core.php.
References Path\getLibsPath().
| __toString | ( | ) |
Provides a string representation of the core object.
Definition at line 143 of file class.core.php.
| addLoadingPid | ( | $pid | ) |
Adds a PID to the loading PID file.
| int | $pid | The PID to add. |
Definition at line 133 of file class.core.php.
References getLoadingPid().
| getAppVersion | ( | ) |
Retrieves the application version.
Definition at line 56 of file class.core.php.
References $bearsamppLang, APP_TITLE, Log\error(), Lang\ERROR_CONF_NOT_FOUND, and Path\getResourcesPath().
| getExec | ( | $aetrayPath = false | ) |
Retrieves the path to the exec file.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 101 of file class.core.php.
References Path\getTmpPath().
Referenced by getPreviousExec(), and setExec().
| 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.
| string | $moduleUrl | The URL from which to fetch the file content. |
| string | $filePath | The path where the file content should be saved. |
| bool | $progressBar | Optional. Whether to display a progress bar during the download process. Default is false. |
Definition at line 253 of file class.core.php.
References Log\error().
| getLastPathContent | ( | ) |
Retrieves the content of the last path file.
Definition at line 75 of file class.core.php.
References Path\getLastPath().
| getLoadingPid | ( | $aetrayPath = false | ) |
Retrieves the path to the loading PID file.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 123 of file class.core.php.
References Path\getResourcesPath().
Referenced by addLoadingPid().
| getPreviousExec | ( | ) |
Retrieves the content of the exec file without unlinking it.
Definition at line 85 of file class.core.php.
References getExec().
| setExec | ( | $action | ) |
Sets the content of the exec file.
| string | $action | The content to set in the exec file. |
Definition at line 111 of file class.core.php.
References getExec().
| 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.
| string | $filePath | The path to the zip file. |
| string | $destination | The directory to extract the files to. |
| callable | null | $progressCallback | A callback function to report progress. The callback receives two parameters:
|
@global object $bearsamppRoot Global object to get core paths.
Definition at line 168 of file class.core.php.
References $bearsamppRoot, Log\debug(), Log\error(), CommandRunner\exec(), Path\getLibsPath(), CommandRunner\stream(), and Log\trace().
| const APP_VERSION = 'version.dat' |
Definition at line 34 of file class.core.php.
| const EXEC = 'exec.dat' |
Definition at line 36 of file class.core.php.
| const HOSTSEDITOR_EXE = 'hEdit_x64.exe' |
Definition at line 30 of file class.core.php.
Referenced by Path\getHostsEditorExe().
| const isRoot_FILE = 'root.php' |
Definition at line 21 of file class.core.php.
Referenced by Batch\exitApp(), TplApp\getActionRun(), Path\getisRootFilePath(), and Util\startLoading().
| const LAST_PATH = 'lastPath.dat' |
Definition at line 35 of file class.core.php.
Referenced by Path\getLastPath().
| const LN_EXE = 'ln.exe' |
Definition at line 31 of file class.core.php.
Referenced by Path\getLnExe().
| const LOADING_PID = 'loading.pid' |
Definition at line 37 of file class.core.php.
| const NSSM_EXE = 'nssm.exe' |
Definition at line 27 of file class.core.php.
Referenced by Path\getNssmExe().
| const OPENSSL_CONF = 'openssl.cfg' |
Definition at line 29 of file class.core.php.
Referenced by Path\getOpenSslConf().
| const OPENSSL_EXE = 'openssl.exe' |
Definition at line 28 of file class.core.php.
Referenced by Path\getOpenSslExe().
| const PATH_LIN_PLACEHOLDER = '~BEARSAMPP_LIN_PATH~' |
Definition at line 23 of file class.core.php.
Referenced by Path\changePath().
| const PATH_WIN_PLACEHOLDER = '~BEARSAMPP_WIN_PATH~' |
Definition at line 22 of file class.core.php.
Referenced by Path\changePath().
| const PHP_EXE = 'php-win.exe' |
Definition at line 25 of file class.core.php.
Referenced by Path\getPhpExe().
| const PWGEN_EXE = "PwTech.exe" |
Definition at line 32 of file class.core.php.
Referenced by Path\getPwgenExe().
| const SETENV_EXE = 'SetEnv.exe' |
Definition at line 26 of file class.core.php.
Referenced by Path\getSetEnvExe().