@@ -23,12 +23,12 @@ |
||
| 23 | 23 | exit(2); |
| 24 | 24 | } |
| 25 | 25 | $settings_file = trim($argv[1]); |
| 26 | - if ( ! file_exists($settings_file)) { |
|
| 26 | + if (!file_exists($settings_file)) { |
|
| 27 | 27 | // File with settings not found |
| 28 | 28 | exit(3); |
| 29 | 29 | } |
| 30 | 30 | $file_data = json_decode(file_get_contents($settings_file), true); |
| 31 | - if ( ! isset($file_data['result_file'])) { |
|
| 31 | + if (!isset($file_data['result_file'])) { |
|
| 32 | 32 | // Wrong settings |
| 33 | 33 | exit(4); |
| 34 | 34 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $res->success = true; |
| 64 | 64 | $di = Di::getDefault(); |
| 65 | 65 | $dirsConfig = $di->getShared('config'); |
| 66 | - $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.txt'; |
|
| 66 | + $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.txt'; |
|
| 67 | 67 | |
| 68 | 68 | $content = self::prepareSysyinfoContent(); |
| 69 | 69 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $content .= self::getAsteriskInfo(); |
| 98 | 98 | $content .= self::getChangedConfigFiles(); |
| 99 | 99 | $content .= self::getCorruptedFiles(); |
| 100 | - $content .= PHP_EOL . PHP_EOL; |
|
| 100 | + $content .= PHP_EOL.PHP_EOL; |
|
| 101 | 101 | |
| 102 | 102 | return $content; |
| 103 | 103 | } |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | public static function getDate(): string |
| 111 | 111 | { |
| 112 | 112 | $content = '───────────────────────────────────────── Date ─────────────────────────────────────────'; |
| 113 | - $content .= PHP_EOL . PHP_EOL; |
|
| 113 | + $content .= PHP_EOL.PHP_EOL; |
|
| 114 | 114 | $datePath = Util::which('date'); |
| 115 | 115 | $ut = []; |
| 116 | 116 | Util::mwExec($datePath, $ut); |
| 117 | - $content .= implode(PHP_EOL, $ut). PHP_EOL; |
|
| 118 | - $content .= PHP_EOL . PHP_EOL; |
|
| 117 | + $content .= implode(PHP_EOL, $ut).PHP_EOL; |
|
| 118 | + $content .= PHP_EOL.PHP_EOL; |
|
| 119 | 119 | return $content; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $version = PbxSettings::getValueByKey('PBXVersion'); |
| 130 | 130 | $content = '─────────────────────────────────────── PBXVersion ───────────────────────────────────────'; |
| 131 | - $content .= PHP_EOL . PHP_EOL; |
|
| 132 | - $content .= $version . PHP_EOL; |
|
| 133 | - $content .= PHP_EOL . PHP_EOL; |
|
| 131 | + $content .= PHP_EOL.PHP_EOL; |
|
| 132 | + $content .= $version.PHP_EOL; |
|
| 133 | + $content .= PHP_EOL.PHP_EOL; |
|
| 134 | 134 | return $content; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | public static function getUpTime(): string |
| 143 | 143 | { |
| 144 | 144 | $content = '───────────────────────────────────────── Uptime ─────────────────────────────────────────'; |
| 145 | - $content .= PHP_EOL . PHP_EOL; |
|
| 145 | + $content .= PHP_EOL.PHP_EOL; |
|
| 146 | 146 | $uptimePath = Util::which('uptime'); |
| 147 | 147 | $ut = []; |
| 148 | 148 | Util::mwExec($uptimePath, $ut); |
| 149 | - $uptime = implode(PHP_EOL, $ut); |
|
| 150 | - $content .= $uptime . PHP_EOL; |
|
| 151 | - $content .= PHP_EOL . PHP_EOL; |
|
| 149 | + $uptime = implode(PHP_EOL, $ut); |
|
| 150 | + $content .= $uptime.PHP_EOL; |
|
| 151 | + $content .= PHP_EOL.PHP_EOL; |
|
| 152 | 152 | return $content; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | public static function getCpu(): string |
| 161 | 161 | { |
| 162 | 162 | $content = '───────────────────────────────────────── CPU load ───────────────────────────────────────'; |
| 163 | - $content .= PHP_EOL . PHP_EOL; |
|
| 163 | + $content .= PHP_EOL.PHP_EOL; |
|
| 164 | 164 | $ut = []; |
| 165 | 165 | $grepPath = Util::which('grep'); |
| 166 | 166 | $mpstatPath = Util::which('mpstat'); |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | $rv = 100; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $content .= round($rv, 2) . PHP_EOL; |
|
| 176 | - $content .= PHP_EOL . PHP_EOL; |
|
| 175 | + $content .= round($rv, 2).PHP_EOL; |
|
| 176 | + $content .= PHP_EOL.PHP_EOL; |
|
| 177 | 177 | return $content; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public static function getMemInfo(): string |
| 186 | 186 | { |
| 187 | 187 | $content = '───────────────────────────────────────── MemInfo ────────────────────────────────────────'; |
| 188 | - $content .= PHP_EOL . PHP_EOL; |
|
| 188 | + $content .= PHP_EOL.PHP_EOL; |
|
| 189 | 189 | $out = []; |
| 190 | 190 | $catPath = Util::which('cat'); |
| 191 | 191 | $grepPath = Util::which('grep'); |
@@ -193,19 +193,19 @@ discard block |
||
| 193 | 193 | $freePath = Util::which('free'); |
| 194 | 194 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'Inactive:' | {$awkPath} '{print $2}'", $out); |
| 195 | 195 | $inactive = round((1 * implode($out)) / 1024, 2); |
| 196 | - $content .= "inactive = {$inactive}" . PHP_EOL; |
|
| 196 | + $content .= "inactive = {$inactive}".PHP_EOL; |
|
| 197 | 197 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'MemFree:' | {$awkPath} '{print $2}'", $out); |
| 198 | 198 | $free = round((1 * implode($out)) / 1024, 2); |
| 199 | - $content .= "free = {$free}" . PHP_EOL; |
|
| 199 | + $content .= "free = {$free}".PHP_EOL; |
|
| 200 | 200 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'MemTotal:' | {$awkPath} '{print $2}'", $out); |
| 201 | 201 | $total = round((1 * implode($out)) / 1024, 2); |
| 202 | - $content .= "total = {$total}" . PHP_EOL . PHP_EOL; |
|
| 202 | + $content .= "total = {$total}".PHP_EOL.PHP_EOL; |
|
| 203 | 203 | |
| 204 | 204 | $content .= '────────────────────────────────────────── Free ─────────────────────────────────────────'; |
| 205 | - $content .= PHP_EOL . PHP_EOL; |
|
| 205 | + $content .= PHP_EOL.PHP_EOL; |
|
| 206 | 206 | Util::mwExec($freePath, $out); |
| 207 | - $content .= implode(PHP_EOL, $out) . PHP_EOL; |
|
| 208 | - $content .= PHP_EOL . PHP_EOL; |
|
| 207 | + $content .= implode(PHP_EOL, $out).PHP_EOL; |
|
| 208 | + $content .= PHP_EOL.PHP_EOL; |
|
| 209 | 209 | return $content; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | private static function getStorageInfo(): string |
| 218 | 218 | { |
| 219 | 219 | $content = '─────────────────────────────────────────── df ───────────────────────────────────────────'; |
| 220 | - $content .= PHP_EOL . PHP_EOL; |
|
| 220 | + $content .= PHP_EOL.PHP_EOL; |
|
| 221 | 221 | $dfPath = Util::which('df'); |
| 222 | 222 | $out = []; |
| 223 | 223 | Util::mwExec("{$dfPath} -h", $out); |
| 224 | 224 | $dfOut = implode(PHP_EOL, $out); |
| 225 | - $content .= $dfOut . PHP_EOL; |
|
| 226 | - $content .= PHP_EOL . PHP_EOL; |
|
| 225 | + $content .= $dfOut.PHP_EOL; |
|
| 226 | + $content .= PHP_EOL.PHP_EOL; |
|
| 227 | 227 | return $content; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | private static function getIfconfigInfo(): string |
| 236 | 236 | { |
| 237 | 237 | $content = '─────────────────────────────────────── ifconfig ──────────────────────────────────────'; |
| 238 | - $content .= PHP_EOL . PHP_EOL; |
|
| 238 | + $content .= PHP_EOL.PHP_EOL; |
|
| 239 | 239 | $ifconfigPath = Util::which('ifconfig'); |
| 240 | 240 | $out = []; |
| 241 | 241 | Util::mwExec($ifconfigPath, $out); |
| 242 | 242 | $ifconfigOut = implode(PHP_EOL, $out); |
| 243 | - $content .= $ifconfigOut . PHP_EOL; |
|
| 244 | - $content .= PHP_EOL . PHP_EOL; |
|
| 243 | + $content .= $ifconfigOut.PHP_EOL; |
|
| 244 | + $content .= PHP_EOL.PHP_EOL; |
|
| 245 | 245 | return $content; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -253,13 +253,13 @@ discard block |
||
| 253 | 253 | private static function getArpInfo(): string |
| 254 | 254 | { |
| 255 | 255 | $content = '─────────────────────────────────────────── arp ──────────────────────────────────────────'; |
| 256 | - $content .= PHP_EOL . PHP_EOL; |
|
| 256 | + $content .= PHP_EOL.PHP_EOL; |
|
| 257 | 257 | $arpPath = Util::which('arp'); |
| 258 | 258 | $out = []; |
| 259 | 259 | Util::mwExec($arpPath, $out); |
| 260 | 260 | $arpOut = implode(PHP_EOL, $out); |
| 261 | - $content .= $arpOut . PHP_EOL; |
|
| 262 | - $content .= PHP_EOL . PHP_EOL; |
|
| 261 | + $content .= $arpOut.PHP_EOL; |
|
| 262 | + $content .= PHP_EOL.PHP_EOL; |
|
| 263 | 263 | return $content; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -271,13 +271,13 @@ discard block |
||
| 271 | 271 | private static function getRouteInfo(): string |
| 272 | 272 | { |
| 273 | 273 | $content = '────────────────────────────────────────── route ─────────────────────────────────────────'; |
| 274 | - $content .= PHP_EOL . PHP_EOL; |
|
| 274 | + $content .= PHP_EOL.PHP_EOL; |
|
| 275 | 275 | $routePath = Util::which('route'); |
| 276 | 276 | $out = []; |
| 277 | 277 | Util::mwExec($routePath, $out); |
| 278 | 278 | $routeOut = implode(PHP_EOL, $out); |
| 279 | - $content .= $routeOut . PHP_EOL; |
|
| 280 | - $content .= PHP_EOL . PHP_EOL; |
|
| 279 | + $content .= $routeOut.PHP_EOL; |
|
| 280 | + $content .= PHP_EOL.PHP_EOL; |
|
| 281 | 281 | return $content; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -289,13 +289,13 @@ discard block |
||
| 289 | 289 | private static function getIptablesInfo(): string |
| 290 | 290 | { |
| 291 | 291 | $content = '────────────────────────────────────────── iptables ──────────────────────────────────────'; |
| 292 | - $content .= PHP_EOL . PHP_EOL; |
|
| 292 | + $content .= PHP_EOL.PHP_EOL; |
|
| 293 | 293 | $iptablesPath = Util::which('iptables'); |
| 294 | 294 | $out = []; |
| 295 | 295 | Util::mwExec("{$iptablesPath} -S", $out); |
| 296 | 296 | $iptablesOut = implode(PHP_EOL, $out); |
| 297 | - $content .= $iptablesOut . PHP_EOL; |
|
| 298 | - $content .= PHP_EOL . PHP_EOL; |
|
| 297 | + $content .= $iptablesOut.PHP_EOL; |
|
| 298 | + $content .= PHP_EOL.PHP_EOL; |
|
| 299 | 299 | return $content; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -307,17 +307,17 @@ discard block |
||
| 307 | 307 | private static function getPingInfo(): string |
| 308 | 308 | { |
| 309 | 309 | $content = '──────────────────────────────────────────── ping ────────────────────────────────────────'; |
| 310 | - $content .= PHP_EOL . PHP_EOL; |
|
| 310 | + $content .= PHP_EOL.PHP_EOL; |
|
| 311 | 311 | $pingPath = Util::which('ping'); |
| 312 | 312 | $out = []; |
| 313 | 313 | Util::mwExec("{$pingPath} 8.8.8.8 -w 2", $out); |
| 314 | 314 | $pingOut = implode(PHP_EOL, $out); |
| 315 | 315 | Util::mwExec("{$pingPath} ya.ru -w 2", $out); |
| 316 | 316 | $ping2Out = implode(PHP_EOL, $out); |
| 317 | - $content .= $pingOut . PHP_EOL; |
|
| 318 | - $content .= PHP_EOL . PHP_EOL; |
|
| 319 | - $content .= $ping2Out . PHP_EOL; |
|
| 320 | - $content .= PHP_EOL . PHP_EOL; |
|
| 317 | + $content .= $pingOut.PHP_EOL; |
|
| 318 | + $content .= PHP_EOL.PHP_EOL; |
|
| 319 | + $content .= $ping2Out.PHP_EOL; |
|
| 320 | + $content .= PHP_EOL.PHP_EOL; |
|
| 321 | 321 | return $content; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -331,12 +331,12 @@ discard block |
||
| 331 | 331 | $opensslPath = Util::which('openssl'); |
| 332 | 332 | |
| 333 | 333 | $content = '─────────────────────────────────────── openssl ─────────────────────────────────────────'; |
| 334 | - $content .= PHP_EOL . PHP_EOL; |
|
| 334 | + $content .= PHP_EOL.PHP_EOL; |
|
| 335 | 335 | $out = []; |
| 336 | 336 | Util::mwExec("{$opensslPath} s_client -connect lic.miko.ru:443", $out); |
| 337 | 337 | $opensslOut = implode(PHP_EOL, $out); |
| 338 | - $content .= $opensslOut . PHP_EOL; |
|
| 339 | - $content .= PHP_EOL . PHP_EOL; |
|
| 338 | + $content .= $opensslOut.PHP_EOL; |
|
| 339 | + $content .= PHP_EOL.PHP_EOL; |
|
| 340 | 340 | return $content; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -350,23 +350,23 @@ discard block |
||
| 350 | 350 | $asteriskPath = Util::which('asterisk'); |
| 351 | 351 | |
| 352 | 352 | $content = '────────────────────────────────── asterisk registrations ────────────────────────────────'; |
| 353 | - $content .= PHP_EOL . PHP_EOL; |
|
| 353 | + $content .= PHP_EOL.PHP_EOL; |
|
| 354 | 354 | Util::mwExec("{$asteriskPath} -rx 'pjsip show registrations' ", $out); |
| 355 | 355 | $asteriskOut = implode(PHP_EOL, $out); |
| 356 | - $content .= $asteriskOut . PHP_EOL; |
|
| 356 | + $content .= $asteriskOut.PHP_EOL; |
|
| 357 | 357 | |
| 358 | 358 | $content .= '────────────────────────────────── asterisk endpoints ───────────────────────────────────'; |
| 359 | - $content .= PHP_EOL . PHP_EOL; |
|
| 359 | + $content .= PHP_EOL.PHP_EOL; |
|
| 360 | 360 | Util::mwExec("{$asteriskPath} -rx 'pjsip show endpoints' ", $out); |
| 361 | 361 | $asteriskOut = implode(PHP_EOL, $out); |
| 362 | - $content .= $asteriskOut . PHP_EOL; |
|
| 362 | + $content .= $asteriskOut.PHP_EOL; |
|
| 363 | 363 | |
| 364 | 364 | $content .= '─────────────────────────────────── asterisk contacts ───────────────────────────────────'; |
| 365 | - $content .= PHP_EOL . PHP_EOL; |
|
| 365 | + $content .= PHP_EOL.PHP_EOL; |
|
| 366 | 366 | Util::mwExec("{$asteriskPath} -rx 'pjsip show contacts' ", $out); |
| 367 | 367 | $asteriskOut = implode(PHP_EOL, $out); |
| 368 | - $content .= $asteriskOut . PHP_EOL; |
|
| 369 | - $content .= PHP_EOL . PHP_EOL; |
|
| 368 | + $content .= $asteriskOut.PHP_EOL; |
|
| 369 | + $content .= PHP_EOL.PHP_EOL; |
|
| 370 | 370 | return $content; |
| 371 | 371 | } |
| 372 | 372 | |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | private static function getChangedConfigFiles(): string |
| 379 | 379 | { |
| 380 | 380 | $content = '────────────────────────────────── Changed config files ─────────────────────────────────'; |
| 381 | - $content .= PHP_EOL . PHP_EOL; |
|
| 381 | + $content .= PHP_EOL.PHP_EOL; |
|
| 382 | 382 | $files = CustomFiles::find('mode!="none"'); |
| 383 | 383 | foreach ($files as $file) { |
| 384 | - $content .= "({$file->mode}){$file->filepath}" . PHP_EOL; |
|
| 384 | + $content .= "({$file->mode}){$file->filepath}".PHP_EOL; |
|
| 385 | 385 | } |
| 386 | - $content .= PHP_EOL . PHP_EOL; |
|
| 386 | + $content .= PHP_EOL.PHP_EOL; |
|
| 387 | 387 | return $content; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -395,12 +395,12 @@ discard block |
||
| 395 | 395 | private static function getCorruptedFiles(): string |
| 396 | 396 | { |
| 397 | 397 | $content = '──────────────────────────────────── Corrupted files ────────────────────────────────────'; |
| 398 | - $content .= PHP_EOL . PHP_EOL; |
|
| 398 | + $content .= PHP_EOL.PHP_EOL; |
|
| 399 | 399 | $files = Main::checkForCorruptedFiles(); |
| 400 | 400 | foreach ($files as $file) { |
| 401 | - $content .= $file . PHP_EOL; |
|
| 401 | + $content .= $file.PHP_EOL; |
|
| 402 | 402 | } |
| 403 | - $content .= PHP_EOL . PHP_EOL; |
|
| 403 | + $content .= PHP_EOL.PHP_EOL; |
|
| 404 | 404 | return $content; |
| 405 | 405 | } |
| 406 | 406 | |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $response = json_decode($resultrequest, true); |
| 439 | 439 | $res->data['ip'] = $response['ip']; |
| 440 | 440 | } else { |
| 441 | - $res->messages[] = 'Error format data ' . $resultrequest; |
|
| 441 | + $res->messages[] = 'Error format data '.$resultrequest; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | return $res; |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $res = new PBXApiResult(); |
| 76 | 76 | $res->processor = __METHOD__; |
| 77 | - $filename = System::getLogDir() . '/' . $filename; |
|
| 78 | - if ( ! file_exists($filename)) { |
|
| 77 | + $filename = System::getLogDir().'/'.$filename; |
|
| 78 | + if (!file_exists($filename)) { |
|
| 79 | 79 | $res->success = false; |
| 80 | - $res->messages[] = 'No access to the file ' . $filename; |
|
| 80 | + $res->messages[] = 'No access to the file '.$filename; |
|
| 81 | 81 | } else { |
| 82 | 82 | $res->success = true; |
| 83 | 83 | $cat = Util::which('cat'); |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $di = Di::getDefault(); |
| 88 | 88 | $dirsConfig = $di->getShared('config'); |
| 89 | - $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.log'; |
|
| 90 | - $cmd = "{$cat} {$filename} | {$grep} " . escapeshellarg($filter) . " | $tail -n " . escapeshellarg( |
|
| 89 | + $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.log'; |
|
| 90 | + $cmd = "{$cat} {$filename} | {$grep} ".escapeshellarg($filter)." | $tail -n ".escapeshellarg( |
|
| 91 | 91 | $lines |
| 92 | - ) . "> $filenameTmp"; |
|
| 92 | + )."> $filenameTmp"; |
|
| 93 | 93 | Util::mwExec("$cmd; chown www:www $filenameTmp"); |
| 94 | 94 | $res->data['filename'] = $filenameTmp; |
| 95 | 95 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $systemInfoFile = "{$logDir}/system-information.log"; |
| 149 | 149 | file_put_contents($systemInfoFile, SysinfoManagementProcessor::prepareSysyinfoContent()); |
| 150 | 150 | |
| 151 | - $futureFileName = $temp_dir . '/temp-all-log-' . time() . '.zip'; |
|
| 151 | + $futureFileName = $temp_dir.'/temp-all-log-'.time().'.zip'; |
|
| 152 | 152 | $res->data['filename'] = $futureFileName; |
| 153 | 153 | $res->success = true; |
| 154 | 154 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $res->processor = __METHOD__; |
| 185 | 185 | |
| 186 | 186 | $progress_file = "{$resultFile}.progress"; |
| 187 | - if ( ! file_exists($progress_file)) { |
|
| 187 | + if (!file_exists($progress_file)) { |
|
| 188 | 188 | $res->messages[] = 'Archive does not exist. Try again!'; |
| 189 | 189 | } elseif (file_exists($progress_file) && file_get_contents($progress_file) === '100') { |
| 190 | 190 | $uid = Util::generateRandomString(36); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $downloadLink = $di->getShared('config')->path('www.downloadCacheDir'); |
| 193 | 193 | $result_dir = "{$downloadLink}/{$uid}"; |
| 194 | 194 | Util::mwMkdir($result_dir); |
| 195 | - $link_name = 'MikoPBXLogs_' . basename($resultFile); |
|
| 195 | + $link_name = 'MikoPBXLogs_'.basename($resultFile); |
|
| 196 | 196 | Util::createUpdateSymlink($resultFile, "{$result_dir}/{$link_name}"); |
| 197 | 197 | Util::addRegularWWWRights("{$result_dir}/{$link_name}"); |
| 198 | 198 | $res->success = true; |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | $res = new PBXApiResult(); |
| 220 | 220 | $res->processor = __METHOD__; |
| 221 | - $filename = System::getLogDir() . '/' . $filename; |
|
| 222 | - if ( ! file_exists($filename)) { |
|
| 221 | + $filename = System::getLogDir().'/'.$filename; |
|
| 222 | + if (!file_exists($filename)) { |
|
| 223 | 223 | $res->success = false; |
| 224 | - $res->messages[] = 'File does not exist ' . $filename; |
|
| 224 | + $res->messages[] = 'File does not exist '.$filename; |
|
| 225 | 225 | } else { |
| 226 | 226 | $uid = Util::generateRandomString(36); |
| 227 | 227 | $di = Di::getDefault(); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | continue; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - $relativePath = str_ireplace($logDir . '/', '', $entry); |
|
| 265 | + $relativePath = str_ireplace($logDir.'/', '', $entry); |
|
| 266 | 266 | $fileSizeKB = ceil($fileSize / 1024); |
| 267 | 267 | $filesList[$relativePath] = |
| 268 | 268 | [ |
@@ -178,14 +178,14 @@ |
||
| 178 | 178 | $res->data['message'] = 'In progress...'; |
| 179 | 179 | |
| 180 | 180 | |
| 181 | - if ( ! file_exists($tempFilename)) { |
|
| 181 | + if (!file_exists($tempFilename)) { |
|
| 182 | 182 | $res->success = false; |
| 183 | 183 | $res->messages[] = "Update file '{$tempFilename}' not found."; |
| 184 | 184 | |
| 185 | 185 | return $res; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if ( ! file_exists('/var/etc/cfdevice')) { |
|
| 188 | + if (!file_exists('/var/etc/cfdevice')) { |
|
| 189 | 189 | $res->success = false; |
| 190 | 190 | $res->messages[] = "The system is not installed"; |
| 191 | 191 | |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | 93 | if (isset($resumableIdentifier) && trim($resumableIdentifier) !== '') { |
| 94 | - $temp_dir = $uploadDir . '/' . Util::trimExtensionForFile(basename($resumableFilename)); |
|
| 95 | - $temp_dst_file = $uploadDir . '/' . $upload_id . '/' . $upload_id . '_' . basename( |
|
| 94 | + $temp_dir = $uploadDir.'/'.Util::trimExtensionForFile(basename($resumableFilename)); |
|
| 95 | + $temp_dst_file = $uploadDir.'/'.$upload_id.'/'.$upload_id.'_'.basename( |
|
| 96 | 96 | $resumableFilename |
| 97 | 97 | ); |
| 98 | - $chunks_dest_file = $temp_dir . '/' . $resumableFilename . '.part' . $resumableChunkNumber; |
|
| 98 | + $chunks_dest_file = $temp_dir.'/'.$resumableFilename.'.part'.$resumableChunkNumber; |
|
| 99 | 99 | } else { |
| 100 | - $temp_dir = $uploadDir . '/' . $upload_id; |
|
| 101 | - $temp_dst_file = $temp_dir . '/' . $upload_id . '_' . basename($file->getClientFilename()); |
|
| 100 | + $temp_dir = $uploadDir.'/'.$upload_id; |
|
| 101 | + $temp_dst_file = $temp_dir.'/'.$upload_id.'_'.basename($file->getClientFilename()); |
|
| 102 | 102 | $chunks_dest_file = $temp_dst_file; |
| 103 | 103 | } |
| 104 | - if ( ! Util::mwMkdir($temp_dir) || ! Util::mwMkdir(dirname($temp_dst_file))) { |
|
| 104 | + if (!Util::mwMkdir($temp_dir) || !Util::mwMkdir(dirname($temp_dst_file))) { |
|
| 105 | 105 | Util::sysLogMsg('UploadFile', "Error create dir '$temp_dir'"); |
| 106 | 106 | $res->success = false; |
| 107 | 107 | $res->messages[] = "Error create dir '{$temp_dir}'"; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | ], |
| 125 | 125 | 'action' => 'merge', |
| 126 | 126 | ]; |
| 127 | - $settings_file = "{$temp_dir}/merge_settings"; |
|
| 127 | + $settings_file = "{$temp_dir}/merge_settings"; |
|
| 128 | 128 | file_put_contents( |
| 129 | 129 | $settings_file, |
| 130 | 130 | json_encode($merge_settings, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | $res->data['upload_id'] = $upload_id; |
| 145 | 145 | $res->data['filename'] = $temp_dst_file; |
| 146 | 146 | $res->data['d_status'] = 'UPLOAD_COMPLETE'; |
| 147 | - file_put_contents($temp_dir . '/progress', '100'); |
|
| 147 | + file_put_contents($temp_dir.'/progress', '100'); |
|
| 148 | 148 | |
| 149 | 149 | Util::mwExecBg( |
| 150 | - '/sbin/shell_functions.sh killprocesses ' . $temp_dir . ' -TERM 0;rm -rf ' . $temp_dir, |
|
| 150 | + '/sbin/shell_functions.sh killprocesses '.$temp_dir.' -TERM 0;rm -rf '.$temp_dir, |
|
| 151 | 151 | '/dev/null', |
| 152 | 152 | 120 |
| 153 | 153 | ); |
@@ -178,18 +178,18 @@ discard block |
||
| 178 | 178 | $uploadDir = $di->getShared('config')->path('www.uploadDir'); |
| 179 | 179 | if ($postData && isset($postData['id'])) { |
| 180 | 180 | $upload_id = $postData['id']; |
| 181 | - $progress_dir = $uploadDir . '/' . $upload_id; |
|
| 182 | - $progress_file = $progress_dir . '/progress'; |
|
| 181 | + $progress_dir = $uploadDir.'/'.$upload_id; |
|
| 182 | + $progress_file = $progress_dir.'/progress'; |
|
| 183 | 183 | |
| 184 | 184 | if (empty($upload_id)) { |
| 185 | 185 | $res->success = false; |
| 186 | 186 | $res->data['d_status_progress'] = '0'; |
| 187 | 187 | $res->data['d_status'] = 'ID_NOT_SET'; |
| 188 | - } elseif ( ! file_exists($progress_file) && file_exists($progress_dir)) { |
|
| 188 | + } elseif (!file_exists($progress_file) && file_exists($progress_dir)) { |
|
| 189 | 189 | $res->success = true; |
| 190 | 190 | $res->data['d_status_progress'] = '0'; |
| 191 | 191 | $res->data['d_status'] = 'INPROGRESS'; |
| 192 | - } elseif ( ! file_exists($progress_dir)) { |
|
| 192 | + } elseif (!file_exists($progress_dir)) { |
|
| 193 | 193 | $res->success = false; |
| 194 | 194 | $res->data['d_status_progress'] = '0'; |
| 195 | 195 | $res->data['d_status'] = 'NOT_FOUND'; |
@@ -217,14 +217,14 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $res = new PBXApiResult(); |
| 219 | 219 | $res->processor = __METHOD__; |
| 220 | - if ( ! file_exists($filename)) { |
|
| 220 | + if (!file_exists($filename)) { |
|
| 221 | 221 | $res->success = false; |
| 222 | 222 | $res->messages[] = "File '{$filename}' not found."; |
| 223 | 223 | |
| 224 | 224 | return $res; |
| 225 | 225 | } |
| 226 | 226 | $out = []; |
| 227 | - $tmp_filename = '/tmp/' . time() . "_" . basename($filename); |
|
| 227 | + $tmp_filename = '/tmp/'.time()."_".basename($filename); |
|
| 228 | 228 | if (false === copy($filename, $tmp_filename)) { |
| 229 | 229 | $res->success = false; |
| 230 | 230 | $res->messages[] = "Unable to create temporary file '{$tmp_filename}'."; |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // Принудительно устанавливаем расширение файла в wav. |
| 236 | - $n_filename = Util::trimExtensionForFile($filename) . ".wav"; |
|
| 237 | - $n_filename_mp3 = Util::trimExtensionForFile($filename) . ".mp3"; |
|
| 236 | + $n_filename = Util::trimExtensionForFile($filename).".wav"; |
|
| 237 | + $n_filename_mp3 = Util::trimExtensionForFile($filename).".mp3"; |
|
| 238 | 238 | // Конвертируем файл. |
| 239 | 239 | $tmp_filename = escapeshellcmd($tmp_filename); |
| 240 | 240 | $n_filename = escapeshellcmd($n_filename); |
@@ -288,13 +288,13 @@ discard block |
||
| 288 | 288 | $cat = Util::which('cat'); |
| 289 | 289 | $di = Di::getDefault(); |
| 290 | 290 | $dirsConfig = $di->getShared('config'); |
| 291 | - $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.conf'; |
|
| 291 | + $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.conf'; |
|
| 292 | 292 | $cmd = "{$cat} {$filename} > $filenameTmp"; |
| 293 | 293 | Util::mwExec("$cmd; chown www:www $filenameTmp"); |
| 294 | 294 | $res->data['filename'] = $filenameTmp; |
| 295 | 295 | } else { |
| 296 | 296 | $res->success = false; |
| 297 | - $res->messages[] = 'No access to the file ' . $filename; |
|
| 297 | + $res->messages[] = 'No access to the file '.$filename; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | return $res; |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | $rmPath = Util::which('rm'); |
| 319 | 319 | $module = 'NewFirmware'; |
| 320 | - if ( ! file_exists($tempDir . "/{$module}")) { |
|
| 321 | - Util::mwMkdir($tempDir . "/{$module}"); |
|
| 320 | + if (!file_exists($tempDir."/{$module}")) { |
|
| 321 | + Util::mwMkdir($tempDir."/{$module}"); |
|
| 322 | 322 | } else { |
| 323 | 323 | // Чистим файлы, загруженные онлайн. |
| 324 | 324 | Util::mwExec("{$rmPath} -rf {$tempDir}/{$module}/* "); |
@@ -338,13 +338,13 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $workerDownloaderPath = Util::getFilePathByClassName(WorkerDownloader::class); |
| 340 | 340 | |
| 341 | - file_put_contents($tempDir . "/{$module}/progress", '0'); |
|
| 341 | + file_put_contents($tempDir."/{$module}/progress", '0'); |
|
| 342 | 342 | file_put_contents( |
| 343 | - $tempDir . "/{$module}/download_settings.json", |
|
| 343 | + $tempDir."/{$module}/download_settings.json", |
|
| 344 | 344 | json_encode($download_settings, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) |
| 345 | 345 | ); |
| 346 | 346 | $phpPath = Util::which('php'); |
| 347 | - Util::mwExecBg("{$phpPath} -f {$workerDownloaderPath} " . $tempDir . "/{$module}/download_settings.json"); |
|
| 347 | + Util::mwExecBg("{$phpPath} -f {$workerDownloaderPath} ".$tempDir."/{$module}/download_settings.json"); |
|
| 348 | 348 | |
| 349 | 349 | $res = new PBXApiResult(); |
| 350 | 350 | $res->processor = __METHOD__; |
@@ -372,15 +372,15 @@ discard block |
||
| 372 | 372 | } else { |
| 373 | 373 | $tempDir = '/tmp'; |
| 374 | 374 | } |
| 375 | - $modulesDir = $tempDir . '/NewFirmware'; |
|
| 376 | - $progress_file = $modulesDir . '/progress'; |
|
| 375 | + $modulesDir = $tempDir.'/NewFirmware'; |
|
| 376 | + $progress_file = $modulesDir.'/progress'; |
|
| 377 | 377 | |
| 378 | 378 | $error = ''; |
| 379 | - if (file_exists($modulesDir . '/error')) { |
|
| 380 | - $error = trim(file_get_contents($modulesDir . '/error')); |
|
| 379 | + if (file_exists($modulesDir.'/error')) { |
|
| 380 | + $error = trim(file_get_contents($modulesDir.'/error')); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if ( ! file_exists($progress_file)) { |
|
| 383 | + if (!file_exists($progress_file)) { |
|
| 384 | 384 | $res->data['d_status_progress'] = '0'; |
| 385 | 385 | $res->data['d_status'] = 'NOT_FOUND'; |
| 386 | 386 | } elseif ('' !== $error) { |
@@ -393,12 +393,12 @@ discard block |
||
| 393 | 393 | $res->data['filePath'] = "{$tempDir}/NewFirmware/update.img"; |
| 394 | 394 | } else { |
| 395 | 395 | $res->data['d_status_progress'] = file_get_contents($progress_file); |
| 396 | - $d_pid = Util::getPidOfProcess($tempDir . '/NewFirmware/download_settings.json'); |
|
| 396 | + $d_pid = Util::getPidOfProcess($tempDir.'/NewFirmware/download_settings.json'); |
|
| 397 | 397 | if (empty($d_pid)) { |
| 398 | 398 | $res->data['d_status'] = 'DOWNLOAD_ERROR'; |
| 399 | 399 | $error = ''; |
| 400 | - if (file_exists($modulesDir . '/error')) { |
|
| 401 | - $error = file_get_contents($modulesDir . '/error'); |
|
| 400 | + if (file_exists($modulesDir.'/error')) { |
|
| 401 | + $error = file_get_contents($modulesDir.'/error'); |
|
| 402 | 402 | } |
| 403 | 403 | $res->data['d_error'] = $error; |
| 404 | 404 | } else { |
@@ -479,11 +479,11 @@ discard block |
||
| 479 | 479 | } else { |
| 480 | 480 | $tempDir = '/tmp'; |
| 481 | 481 | } |
| 482 | - $moduleDirTmp = $tempDir . '/' . $moduleUniqueID; |
|
| 483 | - $progress_file = $moduleDirTmp . '/progress'; |
|
| 482 | + $moduleDirTmp = $tempDir.'/'.$moduleUniqueID; |
|
| 483 | + $progress_file = $moduleDirTmp.'/progress'; |
|
| 484 | 484 | $error = ''; |
| 485 | - if (file_exists($moduleDirTmp . '/error')) { |
|
| 486 | - $error = trim(file_get_contents($moduleDirTmp . '/error')); |
|
| 485 | + if (file_exists($moduleDirTmp.'/error')) { |
|
| 486 | + $error = trim(file_get_contents($moduleDirTmp.'/error')); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | // Ожидание запуска процесса загрузки. |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | usleep(500000); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if ( ! file_exists($progress_file)) { |
|
| 495 | + if (!file_exists($progress_file)) { |
|
| 496 | 496 | $res->data['d_status_progress'] = '0'; |
| 497 | 497 | $res->data['d_status'] = 'NOT_FOUND'; |
| 498 | 498 | $res->success = false; |
@@ -508,12 +508,12 @@ discard block |
||
| 508 | 508 | $res->success = true; |
| 509 | 509 | } else { |
| 510 | 510 | $res->data['d_status_progress'] = file_get_contents($progress_file); |
| 511 | - $d_pid = Util::getPidOfProcess($moduleDirTmp . '/download_settings.json'); |
|
| 511 | + $d_pid = Util::getPidOfProcess($moduleDirTmp.'/download_settings.json'); |
|
| 512 | 512 | if (empty($d_pid)) { |
| 513 | 513 | $res->data['d_status'] = 'DOWNLOAD_ERROR'; |
| 514 | 514 | $error = ''; |
| 515 | - if (file_exists($moduleDirTmp . '/error')) { |
|
| 516 | - $error = file_get_contents($moduleDirTmp . '/error'); |
|
| 515 | + if (file_exists($moduleDirTmp.'/error')) { |
|
| 516 | + $error = file_get_contents($moduleDirTmp.'/error'); |
|
| 517 | 517 | } |
| 518 | 518 | $res->messages[] = $error; |
| 519 | 519 | $res->success = false; |
@@ -538,14 +538,14 @@ discard block |
||
| 538 | 538 | $res = new PBXApiResult(); |
| 539 | 539 | $res->processor = __METHOD__; |
| 540 | 540 | $extension = Util::getExtensionOfFile($filePath); |
| 541 | - if ( ! in_array($extension, ['mp3', 'wav', 'alaw'])) { |
|
| 541 | + if (!in_array($extension, ['mp3', 'wav', 'alaw'])) { |
|
| 542 | 542 | $res->success = false; |
| 543 | 543 | $res->messages[] = "It is forbidden to remove the file type $extension."; |
| 544 | 544 | |
| 545 | 545 | return $res; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - if ( ! file_exists($filePath)) { |
|
| 548 | + if (!file_exists($filePath)) { |
|
| 549 | 549 | $res->success = true; |
| 550 | 550 | $res->data['message'] = "File '{$filePath}' already deleted"; |
| 551 | 551 | |
@@ -555,13 +555,13 @@ discard block |
||
| 555 | 555 | $out = []; |
| 556 | 556 | |
| 557 | 557 | $arrDeletedFiles = [ |
| 558 | - escapeshellarg(Util::trimExtensionForFile($filePath) . ".wav"), |
|
| 559 | - escapeshellarg(Util::trimExtensionForFile($filePath) . ".mp3"), |
|
| 560 | - escapeshellarg(Util::trimExtensionForFile($filePath) . ".alaw"), |
|
| 558 | + escapeshellarg(Util::trimExtensionForFile($filePath).".wav"), |
|
| 559 | + escapeshellarg(Util::trimExtensionForFile($filePath).".mp3"), |
|
| 560 | + escapeshellarg(Util::trimExtensionForFile($filePath).".alaw"), |
|
| 561 | 561 | ]; |
| 562 | 562 | |
| 563 | 563 | $rmPath = Util::which('rm'); |
| 564 | - Util::mwExec("{$rmPath} -rf " . implode(' ', $arrDeletedFiles), $out); |
|
| 564 | + Util::mwExec("{$rmPath} -rf ".implode(' ', $arrDeletedFiles), $out); |
|
| 565 | 565 | if (file_exists($filePath)) { |
| 566 | 566 | $res->success = false; |
| 567 | 567 | $res->messages = $out; |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | $res = new PBXApiResult(); |
| 586 | 586 | $res->processor = __METHOD__; |
| 587 | 587 | $moduleMetadata = FilesManagementProcessor::getMetadataFromModuleFile($filePath); |
| 588 | - if ( ! $moduleMetadata->success) { |
|
| 588 | + if (!$moduleMetadata->success) { |
|
| 589 | 589 | return $moduleMetadata; |
| 590 | 590 | } else { |
| 591 | 591 | $moduleUniqueID = $moduleMetadata->data['uniqid']; |
@@ -612,13 +612,13 @@ discard block |
||
| 612 | 612 | $grepPath = Util::which('grep'); |
| 613 | 613 | $echoPath = Util::which('echo'); |
| 614 | 614 | $awkPath = Util::which('awk'); |
| 615 | - $cmd = 'f="' . $filePath . '"; p=`' . $sevenZaPath . ' l $f | ' . $grepPath . ' module.json`;if [ "$?" == "0" ]; then ' . $sevenZaPath . ' -so e -y -r $f `' . $echoPath . ' $p | ' . $awkPath . ' -F" " \'{print $6}\'`; fi'; |
|
| 615 | + $cmd = 'f="'.$filePath.'"; p=`'.$sevenZaPath.' l $f | '.$grepPath.' module.json`;if [ "$?" == "0" ]; then '.$sevenZaPath.' -so e -y -r $f `'.$echoPath.' $p | '.$awkPath.' -F" " \'{print $6}\'`; fi'; |
|
| 616 | 616 | |
| 617 | 617 | Util::mwExec($cmd, $out); |
| 618 | 618 | $settings = json_decode(implode("\n", $out), true); |
| 619 | 619 | |
| 620 | 620 | $moduleUniqueID = $settings['moduleUniqueID'] ?? null; |
| 621 | - if ( ! $moduleUniqueID) { |
|
| 621 | + if (!$moduleUniqueID) { |
|
| 622 | 622 | $res->messages[] = 'The" moduleUniqueID " in the module file is not described.the json or file does not exist.'; |
| 623 | 623 | |
| 624 | 624 | return $res; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | if (class_exists($pbxExtensionSetupClass) |
| 663 | 663 | && method_exists($pbxExtensionSetupClass, 'installModule')) { |
| 664 | 664 | $setup = new $pbxExtensionSetupClass($moduleUniqueID); |
| 665 | - if ( ! $setup->installModule()) { |
|
| 665 | + if (!$setup->installModule()) { |
|
| 666 | 666 | $res->success = false; |
| 667 | 667 | $res->messages[] = $setup->getMessages(); |
| 668 | 668 | } |
@@ -754,11 +754,11 @@ discard block |
||
| 754 | 754 | continue; |
| 755 | 755 | } |
| 756 | 756 | //if current file ($d) is a directory, call scanDirRecursively |
| 757 | - if (is_dir($dir . '/' . $d)) { |
|
| 758 | - $list[] = self::scanDirRecursively($dir . '/' . $d); |
|
| 757 | + if (is_dir($dir.'/'.$d)) { |
|
| 758 | + $list[] = self::scanDirRecursively($dir.'/'.$d); |
|
| 759 | 759 | //otherwise, add the file to the list |
| 760 | - } elseif (is_file($dir . '/' . $d) || is_link($dir . '/' . $d)) { |
|
| 761 | - $list[] = $dir . '/' . $d; |
|
| 760 | + } elseif (is_file($dir.'/'.$d) || is_link($dir.'/'.$d)) { |
|
| 761 | + $list[] = $dir.'/'.$d; |
|
| 762 | 762 | } |
| 763 | 763 | } |
| 764 | 764 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | $response = json_decode($response, true); |
| 67 | 67 | |
| 68 | 68 | $filename = $response['data']['filename'] ?? ''; |
| 69 | - if ( ! file_exists($filename)) { |
|
| 69 | + if (!file_exists($filename)) { |
|
| 70 | 70 | $response['messages'][] = 'Log file not found'; |
| 71 | 71 | } else { |
| 72 | 72 | $response['data']['filename'] = $filename; |
| 73 | - $response['data']['content'] = '' . file_get_contents($filename); |
|
| 73 | + $response['data']['content'] = ''.file_get_contents($filename); |
|
| 74 | 74 | unlink($filename); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | if (array_key_exists('filename', $response['data'])) { |
| 103 | 103 | $di = Di::getDefault(); |
| 104 | 104 | $downloadLink = $di->getShared('config')->path('www.downloadCacheDir'); |
| 105 | - $filename = $downloadLink . "/" . $response['data']['filename'] ?? ''; |
|
| 106 | - if ( ! file_exists($filename)) { |
|
| 105 | + $filename = $downloadLink."/".$response['data']['filename'] ?? ''; |
|
| 106 | + if (!file_exists($filename)) { |
|
| 107 | 107 | $response['messages'][] = 'File not found'; |
| 108 | 108 | } else { |
| 109 | 109 | $scheme = $this->request->getScheme(); |
@@ -53,10 +53,10 @@ |
||
| 53 | 53 | if ($response !== false) { |
| 54 | 54 | $response = json_decode($response, true); |
| 55 | 55 | $filename = $response['data']['filename'] ?? ''; |
| 56 | - if ( ! file_exists($filename)) { |
|
| 56 | + if (!file_exists($filename)) { |
|
| 57 | 57 | $response['messages'][] = 'System information collected file not found'; |
| 58 | 58 | } else { |
| 59 | - $response['data']['content'] = '' . file_get_contents($filename); |
|
| 59 | + $response['data']['content'] = ''.file_get_contents($filename); |
|
| 60 | 60 | unlink($filename); |
| 61 | 61 | } |
| 62 | 62 | $this->response->setPayloadSuccess($response); |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | $mohDir = $di->getShared('config')->path('asterisk.mohdir'); |
| 129 | 129 | switch ($category) { |
| 130 | 130 | case SoundFiles::CATEGORY_MOH: |
| 131 | - $data['filename'] = "{$mohDir}/" . basename($data['temp_filename']); |
|
| 131 | + $data['filename'] = "{$mohDir}/".basename($data['temp_filename']); |
|
| 132 | 132 | break; |
| 133 | 133 | case SoundFiles::CATEGORY_CUSTOM: |
| 134 | - $data['filename'] = "{$mediaDir}/" . basename($data['temp_filename']); |
|
| 134 | + $data['filename'] = "{$mediaDir}/".basename($data['temp_filename']); |
|
| 135 | 135 | break; |
| 136 | 136 | default: |
| 137 | 137 | $this->sendError(400, 'Category not set'); |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | if ($response !== false) { |
| 161 | 161 | $response = json_decode($response, true); |
| 162 | 162 | $filename = $response['data']['filename'] ?? ''; |
| 163 | - if ( ! file_exists($filename)) { |
|
| 163 | + if (!file_exists($filename)) { |
|
| 164 | 164 | $response['messages'][] = 'Config file not found'; |
| 165 | 165 | } else { |
| 166 | 166 | $response['data']['filename'] = $filename; |
| 167 | - $response['data']['content'] = '' . file_get_contents($filename); |
|
| 167 | + $response['data']['content'] = ''.file_get_contents($filename); |
|
| 168 | 168 | unlink($filename); |
| 169 | 169 | } |
| 170 | 170 | $this->response->setPayloadSuccess($response); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | return [ |
| 58 | 58 | 'Name' => 'PBX system', |
| 59 | - 'VirtualHardwareType' => 'REAL',//VMWARE,HYPERV,AWS,AZURE |
|
| 59 | + 'VirtualHardwareType' => 'REAL', //VMWARE,HYPERV,AWS,AZURE |
|
| 60 | 60 | 'Description' => '', |
| 61 | 61 | 'RestartEveryNight' => '0', |
| 62 | 62 | 'SIPPort' => '5060', |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | 'VoicemailNotificationsEmail' => '[email protected]', |
| 101 | 101 | 'VoicemailExten' => '*001', |
| 102 | 102 | 'PBXLanguage' => 'en-en', |
| 103 | - 'PBXInternalExtensionLength' => '3',// Длина внутреннего номера |
|
| 103 | + 'PBXInternalExtensionLength' => '3', // Длина внутреннего номера |
|
| 104 | 104 | 'PBXRecordCalls' => '1', |
| 105 | 105 | 'PBXSplitAudioThread' => '0', |
| 106 | 106 | 'PBXCallParkingExt' => '800', |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $result = parent::findFirstByKey($key); |
| 139 | 139 | if ($result === null || $result->value === null) { |
| 140 | 140 | $arrOfDefaultValues = self::getDefaultArrayValues(); |
| 141 | - if ( ! array_key_exists($key, $arrOfDefaultValues)) { |
|
| 141 | + if (!array_key_exists($key, $arrOfDefaultValues)) { |
|
| 142 | 142 | return ''; |
| 143 | 143 | } |
| 144 | 144 | |