@@ -29,7 +29,7 @@ |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // Extract username, UID, and home directory |
| 32 | - [$username, , $uid, , , $homeDirectory] = array_slice($parts, 0, 6); |
|
| 32 | + [$username,, $uid,,, $homeDirectory] = array_slice($parts, 0, 6); |
|
| 33 | 33 | |
| 34 | 34 | // Only consider regular users (UID >= 1000) with a valid home directory |
| 35 | 35 | if (!File::getInstance()->isDir($homeDirectory)) { |
@@ -45,7 +45,9 @@ |
||
| 45 | 45 | // Step 2: Extract managed log paths from logrotate config files |
| 46 | 46 | $explicitManaged = []; |
| 47 | 47 | foreach ($logrotateConfs as $confFile) { |
| 48 | - if (!File::getInstance()->isReadable($confFile)) continue; |
|
| 48 | + if (!File::getInstance()->isReadable($confFile)) { |
|
| 49 | + continue; |
|
| 50 | + } |
|
| 49 | 51 | $lines = file($confFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
| 50 | 52 | foreach ($lines as $line) { |
| 51 | 53 | if (preg_match('#^\s*/[^\s{}]+\.log#', $line, $matches)) { |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | if (!array_key_exists(ApacheServerNameCollector::COLLECTION_IDENTIFIER, $this->inventory) |
| 25 | 25 | || !is_array($this->inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]) |
| 26 | - ) return []; |
|
| 26 | + ) { |
|
| 27 | + return []; |
|
| 28 | + } |
|
| 27 | 29 | |
| 28 | 30 | $configs = $this->inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]; |
| 29 | 31 | |
@@ -55,7 +57,9 @@ discard block |
||
| 55 | 57 | private function extractPlugins(string $documentRoot): array |
| 56 | 58 | { |
| 57 | 59 | $pluginDir = $documentRoot . 'wp-content/plugins'; |
| 58 | - if (!File::getInstance()->isDir($pluginDir)) return []; |
|
| 60 | + if (!File::getInstance()->isDir($pluginDir)) { |
|
| 61 | + return []; |
|
| 62 | + } |
|
| 59 | 63 | |
| 60 | 64 | $plugins = array_diff(scandir($pluginDir), ['.', '..']); |
| 61 | 65 | $pluginArray = []; |
@@ -63,7 +67,9 @@ discard block |
||
| 63 | 67 | foreach ($plugins as $pluginFolder) { |
| 64 | 68 | $path = $pluginDir . '/' . $pluginFolder; |
| 65 | 69 | |
| 66 | - if (!File::getInstance()->isDir($path)) continue; |
|
| 70 | + if (!File::getInstance()->isDir($path)) { |
|
| 71 | + continue; |
|
| 72 | + } |
|
| 67 | 73 | |
| 68 | 74 | $phpFiles = glob("$path/*.php"); |
| 69 | 75 | foreach ($phpFiles as $phpFile) { |
@@ -95,7 +101,9 @@ discard block |
||
| 95 | 101 | ]; |
| 96 | 102 | |
| 97 | 103 | $fp = fopen($file, 'r'); |
| 98 | - if (!$fp) return []; |
|
| 104 | + if (!$fp) { |
|
| 105 | + return []; |
|
| 106 | + } |
|
| 99 | 107 | |
| 100 | 108 | $data = fread($fp, 8192); |
| 101 | 109 | fclose($fp); |
@@ -118,7 +126,9 @@ discard block |
||
| 118 | 126 | if (isset($urlParts['path'])) { |
| 119 | 127 | $segments = explode('/', trim($urlParts['path'], '/')); |
| 120 | 128 | $lastSegment = end($segments); |
| 121 | - if ($lastSegment) return $lastSegment; |
|
| 129 | + if ($lastSegment) { |
|
| 130 | + return $lastSegment; |
|
| 131 | + } |
|
| 122 | 132 | } |
| 123 | 133 | } |
| 124 | 134 | |
@@ -130,10 +140,14 @@ discard block |
||
| 130 | 140 | { |
| 131 | 141 | $url = "https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=" . urlencode($slug); |
| 132 | 142 | $response = @file_get_contents($url); |
| 133 | - if (!$response) return null; |
|
| 143 | + if (!$response) { |
|
| 144 | + return null; |
|
| 145 | + } |
|
| 134 | 146 | |
| 135 | 147 | $pluginData = json_decode($response, true); |
| 136 | - if (!isset($pluginData['version'])) return null; |
|
| 148 | + if (!isset($pluginData['version'])) { |
|
| 149 | + return null; |
|
| 150 | + } |
|
| 137 | 151 | |
| 138 | 152 | $latestVersion = $pluginData['version']; |
| 139 | 153 | |