![]() |
Bearsampp 2026.5.5
|
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) | |
| getPreviousExec () | |
| 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 | 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 getLibsPath().
| __toString | ( | ) |
Provides a string representation of the core object.
Definition at line 467 of file class.core.php.
| addLoadingPid | ( | $pid | ) |
Adds a PID to the loading PID file.
| int | $pid | The PID to add. |
Definition at line 277 of file class.core.php.
References getLoadingPid().
| getAjaxPath | ( | $aetrayPath = false | ) |
| getAppVersion | ( | ) |
Retrieves the application version.
Definition at line 188 of file class.core.php.
References $bearsamppLang, APP_TITLE, Log\error(), Lang\ERROR_CONF_NOT_FOUND, and getResourcesPath().
| getExec | ( | $aetrayPath = false | ) |
Retrieves the path to the exec file.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 245 of file class.core.php.
References 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 567 of file class.core.php.
References Log\error().
| getHomepagePath | ( | $aetrayPath = false | ) |
Definition at line 133 of file class.core.php.
References getResourcesPath().
Referenced by getAjaxPath().
| getHostsEditorExe | ( | $aetrayPath = false | ) |
Retrieves the path to the HostsEditor executable.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 409 of file class.core.php.
References getHostsEditorPath().
| getHostsEditorPath | ( | $aetrayPath = false | ) |
Retrieves the path to the HostsEditor directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 397 of file class.core.php.
References getLibsPath().
Referenced by getHostsEditorExe().
| getIconsPath | ( | $aetrayPath = false | ) |
Retrieves the path to the icons.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 100 of file class.core.php.
References getImagesPath().
| getImagesPath | ( | $aetrayPath = false | ) |
Retrieves the path to the images.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 112 of file class.core.php.
References $bearsamppCore.
Referenced by getIconsPath().
| getisRootFilePath | ( | $aetrayPath = false | ) |
Retrieves the path to the root file.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 176 of file class.core.php.
References $bearsamppRoot.
| getLangsPath | ( | $aetrayPath = false | ) |
Retrieves the path to the language files.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 58 of file class.core.php.
References $bearsamppRoot.
| getLastPath | ( | $aetrayPath = false | ) |
Retrieves the path to the last path file.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 209 of file class.core.php.
References getResourcesPath().
Referenced by getLastPathContent().
| getLastPathContent | ( | ) |
Retrieves the content of the last path file.
Definition at line 219 of file class.core.php.
References getLastPath().
| getLibsPath | ( | $aetrayPath = false | ) |
Retrieves the path to the libraries.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 72 of file class.core.php.
References $bearsamppRoot.
Referenced by __construct(), getHostsEditorPath(), getLnPath(), getNssmPath(), getOpenSslPath(), getPhpPath(), getPwgenPath(), getSetEnvPath(), and unzipFile().
| getLnExe | ( | $aetrayPath = false | ) |
Retrieves the path to the LN executable.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 433 of file class.core.php.
References getLnPath().
| getLnPath | ( | $aetrayPath = false | ) |
Retrieves the path to the LN directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 421 of file class.core.php.
References getLibsPath().
Referenced by getLnExe().
| getLoadingPid | ( | $aetrayPath = false | ) |
Retrieves the path to the loading PID file.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 267 of file class.core.php.
References getResourcesPath().
Referenced by addLoadingPid().
| getNssmExe | ( | $aetrayPath = false | ) |
Retrieves the path to the NSSM executable.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 349 of file class.core.php.
References getNssmPath().
| getNssmPath | ( | $aetrayPath = false | ) |
Retrieves the path to the NSSM directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 337 of file class.core.php.
References getLibsPath().
Referenced by getNssmExe().
| getOpenSslConf | ( | $aetrayPath = false | ) |
Retrieves the path to the OpenSSL configuration file.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 385 of file class.core.php.
References getOpenSslPath().
| getOpenSslExe | ( | $aetrayPath = false | ) |
Retrieves the path to the OpenSSL executable.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 373 of file class.core.php.
References getOpenSslPath().
| getOpenSslPath | ( | $aetrayPath = false | ) |
Retrieves the path to the OpenSSL directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 361 of file class.core.php.
References getLibsPath().
Referenced by getOpenSslConf(), and getOpenSslExe().
| getPhpExe | ( | $aetrayPath = false | ) |
Retrieves the path to the PHP executable.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 301 of file class.core.php.
References getPhpPath().
| getPhpPath | ( | $aetrayPath = false | ) |
Retrieves the path to the PHP directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 289 of file class.core.php.
References getLibsPath().
Referenced by getPhpExe().
| getPreviousExec | ( | ) |
Retrieves the content of the exec file without unlinking it.
Definition at line 229 of file class.core.php.
References getExec().
| getPwgenExe | ( | $aetrayPath = false | ) |
Retrieves the path to the PWGen executable.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 457 of file class.core.php.
References getPwgenPath().
| getPwgenPath | ( | $aetrayPath = false | ) |
Retrieves the path to the PWGen directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 445 of file class.core.php.
References getLibsPath().
Referenced by getPwgenExe().
| getResourcesPath | ( | $aetrayPath = false | ) |
Retrieves the path to the resources.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 86 of file class.core.php.
References $bearsamppRoot.
Referenced by getAppVersion(), getHomepagePath(), getLastPath(), and getLoadingPid().
| getScript | ( | $type | ) |
Retrieves the path to a specific script.
| string | $type | The type of script. |
Definition at line 150 of file class.core.php.
References getScriptsPath().
| getScriptsPath | ( | $aetrayPath = false | ) |
Retrieves the path to the scripts.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 126 of file class.core.php.
References $bearsamppRoot.
Referenced by getScript().
| getSetEnvExe | ( | $aetrayPath = false | ) |
Retrieves the path to the SetEnv executable.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 325 of file class.core.php.
References getSetEnvPath().
| getSetEnvPath | ( | $aetrayPath = false | ) |
Retrieves the path to the SetEnv directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 313 of file class.core.php.
References getLibsPath().
Referenced by getSetEnvExe().
| getTmpPath | ( | $aetrayPath = false | ) |
Retrieves the path to the temporary directory.
| bool | $aetrayPath | Whether to format the path for AeTrayMenu. |
Definition at line 162 of file class.core.php.
References $bearsamppRoot.
Referenced by getExec().
| setExec | ( | $action | ) |
Sets the content of the exec file.
| string | $action | The content to set in the exec file. |
Definition at line 255 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 492 of file class.core.php.
References $bearsamppRoot, Log\debug(), Log\error(), CommandRunner\exec(), 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.
| const isRoot_FILE = 'root.php' |
Definition at line 21 of file class.core.php.
Referenced by Batch\exitApp(), TplApp\getActionRun(), and Util\startLoading().
| const LAST_PATH = 'lastPath.dat' |
Definition at line 35 of file class.core.php.
| const LN_EXE = 'ln.exe' |
Definition at line 31 of file class.core.php.
| 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.
| const OPENSSL_CONF = 'openssl.cfg' |
Definition at line 29 of file class.core.php.
| const OPENSSL_EXE = 'openssl.exe' |
Definition at line 28 of file class.core.php.
| const PATH_LIN_PLACEHOLDER = '~BEARSAMPP_LIN_PATH~' |
Definition at line 23 of file class.core.php.
Referenced by Util\changePath().
| const PATH_WIN_PLACEHOLDER = '~BEARSAMPP_WIN_PATH~' |
Definition at line 22 of file class.core.php.
Referenced by Util\changePath().
| const PHP_EXE = 'php-win.exe' |
Definition at line 25 of file class.core.php.
| const PWGEN_EXE = "PWGenPortable.exe" |
Definition at line 32 of file class.core.php.
| const SETENV_EXE = 'SetEnv.exe' |
Definition at line 26 of file class.core.php.