2024.8.23
Loading...
Searching...
No Matches
Symlinks Class Reference

Public Member Functions

 __construct ($root)
 

Static Public Member Functions

static deleteCurrentSymlinks ()
 

Private Attributes

 $root
 

Detailed Description

Manages the creation and deletion of symbolic links for various components within the Bearsampp environment.

Definition at line 13 of file class.symlinks.php.

Constructor & Destructor Documentation

◆ __construct()

Symlinks::__construct ( $root)

Constructs a Symlinks object and initializes paths to current directories.

Parameters
Root$rootThe root object associated with the Bearsampp environment.

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

26 {
27 $this->root = $root;
28 $this->initializePaths();
29 }

References $root.

Member Function Documentation

◆ deleteCurrentSymlinks()

static Symlinks::deleteCurrentSymlinks ( )
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. If a symbolic link does not exist, an error is logged. If the deletion is successful, a debug message is logged.

@global Root $bearsamppRoot The root object providing access to system paths. @global Core $bearsamppCore The core object providing core functionalities.

Definition at line 41 of file class.symlinks.php.

42 {
44
45 // Check to see if purging is necessary
46 $appsPath = $bearsamppRoot->getAppsPath();
47 $binPath = $bearsamppRoot->getBinPath();
48 $toolsPath = $bearsamppRoot->getToolsPath();
49
50 $array = [
51 '1' => Util::formatWindowsPath($appsPath . '/adminer/current'),
52 '2' => Util::formatWindowsPath($appsPath . '/phpmyadmin/current'),
53 '3' => Util::formatWindowsPath($appsPath . '/phppgadmin/current'),
54 '4' => Util::formatWindowsPath($appsPath . '/webgrind/current'),
55 '5' => Util::formatWindowsPath($binPath . '/apache/current'),
56 '6' => Util::formatWindowsPath($binPath . '/filezilla/current'),
57 '7' => Util::formatWindowsPath($binPath . '/mailhog/current'),
58 '8' => Util::formatWindowsPath($binPath . '/mariadb/current'),
59 '9' => Util::formatWindowsPath($binPath . '/memcached/current'),
60 '10' => Util::formatWindowsPath($binPath . '/mysql/current'),
61 '11' => Util::formatWindowsPath($binPath . '/nodejs/current'),
62 '12' => Util::formatWindowsPath($binPath . '/php/current'),
63 '13' => Util::formatWindowsPath($binPath . '/postgresql/current'),
64 '14' => Util::formatWindowsPath($toolsPath . '/composer/current'),
65 '15' => Util::formatWindowsPath($toolsPath . '/consolez/current'),
66 '16' => Util::formatWindowsPath($toolsPath . '/ghostscript/current'),
67 '17' => Util::formatWindowsPath($toolsPath . '/git/current'),
68 '18' => Util::formatWindowsPath($toolsPath . '/ngrok/current'),
69 '19' => Util::formatWindowsPath($toolsPath . '/perl/current'),
70 '20' => Util::formatWindowsPath($toolsPath . '/python/current'),
71 '21' => Util::formatWindowsPath($toolsPath . '/ruby/current'),
72 '22' => Util::formatWindowsPath($toolsPath . '/xdc/current'),
73 '23' => Util::formatWindowsPath($toolsPath . '/yarn/current'),
74 '24' => Util::formatWindowsPath($binPath . '/xlight/current'),
75 '25' => Util::formatWindowsPath($binPath . '/mailpit/current')
76 ];
77
78 if (!is_array($array) || empty($array)) {
79 Util::logError('Current symlinks array is not initialized or empty.');
80 return;
81 }
82
83 // Purge "current" symlinks
84 foreach ($array as $startPath) {
85 if (!file_exists($startPath)) {
86 Util::logError('Symlink does not exist: ' . $startPath);
87 continue;
88 } else {
89 if (@Batch::removeSymlink($startPath)) {
90 Util::logDebug('Deleted: ' . $startPath);
91 }
92 }
93 }
94 }
global $bearsamppRoot
global $bearsamppCore
static removeSymlink($link)
static logError($data, $file=null)
static logDebug($data, $file=null)
static formatWindowsPath($path)

References $bearsamppCore, $bearsamppRoot, Util\formatWindowsPath(), Util\logDebug(), Util\logError(), and Batch\removeSymlink().

Referenced by ActionQuit\processWindow().

+ Here is the caller graph for this function:

Field Documentation

◆ $root

Symlinks::$root
private

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

Referenced by __construct().


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