![]() |
Bearsampp 2026.7.11
|
Public Member Functions | |
| __construct ($root) | |
Static Public Member Functions | |
| static | createModuleSymlink ($module) |
| static | deleteCurrentSymlinks () |
| static | initializePaths () |
| static | isSkippingSymlinkCreation () |
| static | safeRemoveSymlink ($path) |
| static | setSkipSymlinkCreation (bool $skip) |
Data Fields | |
| const | APACHE_SYMLINK = 'apache' |
| const | BRUNO_SYMLINK = 'bruno' |
| const | COMPOSER_SYMLINK = 'composer' |
| const | GHOSTSCRIPT_SYMLINK = 'ghostscript' |
| const | GIT_SYMLINK = 'git' |
| const | MAILPIT_SYMLINK = 'mailpit' |
| const | MARIADB_SYMLINK = 'mariadb' |
| const | MEMCACHED_SYMLINK = 'memcached' |
| const | MYSQL_SYMLINK = 'mysql' |
| const | NGROK_SYMLINK = 'ngrok' |
| const | NODEJS_SYMLINK = 'nodejs' |
| const | PERL_SYMLINK = 'perl' |
| const | PHP_SYMLINK = 'php' |
| const | PHPMYADMIN_SYMLINK = 'phpmyadmin' |
| const | PHPPGADMIN_SYMLINK = 'phppgadmin' |
| const | POSTGRESQL_SYMLINK = 'postgresql' |
| const | POWERSHELL_SYMLINK = 'powershell' |
| const | PYTHON_SYMLINK = 'python' |
| const | RUBY_SYMLINK = 'ruby' |
| const | XLIGHT_SYMLINK = 'xlight' |
Static Private Member Functions | |
| static | isPathWithinAllowedBase ($path) |
| static | isSymlink ($path) |
Static Private Attributes | |
| static | $root |
| static | $skipSymlinkCreation = false |
Manages the creation and deletion of symbolic links for various components within the Bearsampp environment.
Definition at line 14 of file class.symlinks.php.
| __construct | ( | $root | ) |
Constructs a Symlinks object and initializes paths to current directories.
Definition at line 52 of file class.symlinks.php.
References $root, and initializePaths().
|
static |
Creates a symbolic link from the current path to the symlink path for a module. If the symlink already exists and points to the correct target, no action is taken.
| Module | $module | The module instance. |
Definition at line 96 of file class.symlinks.php.
References Batch\createSymlink(), Log\error(), Path\formatWindowsPath(), Batch\removeSymlink(), and Log\warning().
Referenced by Module\reload().
|
static |
Deletes all symbolic links listed in the arrayOfCurrents. Logs each operation's success or failure.
This method iterates over a predefined list of symbolic link paths and attempts to delete each one. Uses strict safety checks to prevent accidental deletion of user data:
@global Root $bearsamppRoot The root object providing access to system paths. @global Core $bearsamppCore The core object providing core functionalities.
Definition at line 248 of file class.symlinks.php.
References $bearsamppCore, $bearsamppRoot, Log\error(), Path\getAppsPath(), Path\getBinPath(), Path\getToolsPath(), safeRemoveSymlink(), and Log\trace().
Referenced by ActionQuit\processWindow().
|
static |
Initializes paths for symlinks. This is called by the constructor or can be called manually.
Definition at line 62 of file class.symlinks.php.
Referenced by __construct().
|
staticprivate |
Validates that a path is within allowed symlink directories. Prevents deletion of paths outside the Bearsampp managed directories.
| string | $path | The path to validate |
Definition at line 128 of file class.symlinks.php.
References $bearsamppRoot, Log\error(), Path\getAppsPath(), Path\getBinPath(), and Path\getToolsPath().
|
static |
Check if symlink creation is being skipped
Definition at line 85 of file class.symlinks.php.
Referenced by Module\reload().
|
staticprivate |
Checks if a path is a symlink (not following the link). Uses lstat to avoid following symlinks.
| string | $path | The path to check |
Definition at line 168 of file class.symlinks.php.
|
static |
Safely removes a symlink or directory. CRITICAL: Use with caution as it may perform recursive deletion if the path is a directory.
| string | $path | The path to remove |
Definition at line 180 of file class.symlinks.php.
References Log\debug(), Log\error(), Log\trace(), and Log\warning().
Referenced by deleteCurrentSymlinks(), and ActionQuit\verifySymlinksRemoved().
|
static |
Skip symlink creation during module reload Useful for performance optimization during service checking phase
| bool | $skip | True to skip symlink creation |
Definition at line 75 of file class.symlinks.php.
Referenced by ActionStartup\installServicesSequential().
|
staticprivate |
Definition at line 45 of file class.symlinks.php.
Referenced by __construct().
|
staticprivate |
Definition at line 40 of file class.symlinks.php.
| const APACHE_SYMLINK = 'apache' |
Definition at line 16 of file class.symlinks.php.
| const BRUNO_SYMLINK = 'bruno' |
Definition at line 17 of file class.symlinks.php.
| const COMPOSER_SYMLINK = 'composer' |
Definition at line 18 of file class.symlinks.php.
| const GHOSTSCRIPT_SYMLINK = 'ghostscript' |
Definition at line 19 of file class.symlinks.php.
| const GIT_SYMLINK = 'git' |
Definition at line 20 of file class.symlinks.php.
| const MAILPIT_SYMLINK = 'mailpit' |
Definition at line 21 of file class.symlinks.php.
| const MARIADB_SYMLINK = 'mariadb' |
Definition at line 22 of file class.symlinks.php.
| const MEMCACHED_SYMLINK = 'memcached' |
Definition at line 23 of file class.symlinks.php.
| const MYSQL_SYMLINK = 'mysql' |
Definition at line 24 of file class.symlinks.php.
| const NGROK_SYMLINK = 'ngrok' |
Definition at line 25 of file class.symlinks.php.
| const NODEJS_SYMLINK = 'nodejs' |
Definition at line 26 of file class.symlinks.php.
| const PERL_SYMLINK = 'perl' |
Definition at line 27 of file class.symlinks.php.
| const PHP_SYMLINK = 'php' |
Definition at line 28 of file class.symlinks.php.
| const PHPMYADMIN_SYMLINK = 'phpmyadmin' |
Definition at line 29 of file class.symlinks.php.
| const PHPPGADMIN_SYMLINK = 'phppgadmin' |
Definition at line 30 of file class.symlinks.php.
| const POSTGRESQL_SYMLINK = 'postgresql' |
Definition at line 31 of file class.symlinks.php.
| const POWERSHELL_SYMLINK = 'powershell' |
Definition at line 32 of file class.symlinks.php.
| const PYTHON_SYMLINK = 'python' |
Definition at line 33 of file class.symlinks.php.
| const RUBY_SYMLINK = 'ruby' |
Definition at line 34 of file class.symlinks.php.
| const XLIGHT_SYMLINK = 'xlight' |
Definition at line 35 of file class.symlinks.php.