@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | foreach ($directories as $directory) { |
| 63 | 63 | $pool = Pool::create()->concurrency($maxProcesses)->timeout(3600); |
| 64 | - $pool->add(function () use ($directory) { |
|
| 64 | + $pool->add(function() use ($directory) { |
|
| 65 | 65 | $this->_executeCommand( |
| 66 | 66 | $this->importPath.'"'. |
| 67 | 67 | $directory.'" '. |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | $this->useFileName.' '. |
| 71 | 71 | $this->maxPerProcess |
| 72 | 72 | ); |
| 73 | - })->then(function () { |
|
| 73 | + })->then(function() { |
|
| 74 | 74 | $this->colorCli->header('Finished importing new nzbs', true); |
| 75 | - })->catch(function (\Throwable $exception) { |
|
| 75 | + })->catch(function(\Throwable $exception) { |
|
| 76 | 76 | // Handle exception |
| 77 | 77 | }); |
| 78 | 78 | $pool->wait(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $this->colorCli->header($dMessage); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if ($articles !== '' && ! is_numeric($articles)) { |
|
| 89 | + if ($articles !== '' && !is_numeric($articles)) { |
|
| 90 | 90 | $articles = 20000; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -181,8 +181,7 @@ discard block |
||
| 181 | 181 | $dMessage = |
| 182 | 182 | 'We have hit the maximum we can backfill for '. |
| 183 | 183 | $groupName. |
| 184 | - ($this->_disableBackfillGroup ? ', disabling backfill on it.' : |
|
| 185 | - ', skipping it, consider disabling backfill on it.'); |
|
| 184 | + ($this->_disableBackfillGroup ? ', disabling backfill on it.' : ', skipping it, consider disabling backfill on it.'); |
|
| 186 | 185 | |
| 187 | 186 | if ($this->_disableBackfillGroup) { |
| 188 | 187 | UsenetGroup::updateGroupStatus($groupArr['id'], 'backfill', 0); |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $buffer .= sprintf($this->tmpMasks[3], 'File System', 'Used', 'Free'); |
| 406 | 406 | $buffer .= $this->_getSeparator(); |
| 407 | 407 | |
| 408 | - if (! empty($monitor_path) && file_exists($monitor_path)) { |
|
| 408 | + if (!empty($monitor_path) && file_exists($monitor_path)) { |
|
| 409 | 409 | $disk_use = $this->decodeSize(disk_total_space($monitor_path) - disk_free_space($monitor_path)); |
| 410 | 410 | $disk_free = $this->decodeSize(disk_free_space($monitor_path)); |
| 411 | 411 | if (basename($monitor_path) === '') { |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $buffer .= sprintf($this->tmpMasks[4], $show, $disk_use, $disk_free); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - if (! empty($monitor_path_a) && file_exists($monitor_path_a)) { |
|
| 419 | + if (!empty($monitor_path_a) && file_exists($monitor_path_a)) { |
|
| 420 | 420 | $disk_use = $this->decodeSize(disk_total_space($monitor_path_a) - disk_free_space($monitor_path_a)); |
| 421 | 421 | $disk_free = $this->decodeSize(disk_free_space($monitor_path_a)); |
| 422 | 422 | if (basename($monitor_path_a) === '') { |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $buffer .= sprintf($this->tmpMasks[4], $show, $disk_use, $disk_free); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if (! empty($monitor_path_b) && file_exists($monitor_path_b)) { |
|
| 430 | + if (!empty($monitor_path_b) && file_exists($monitor_path_b)) { |
|
| 431 | 431 | $disk_use = $this->decodeSize(disk_total_space($monitor_path_b) - disk_free_space($monitor_path_b)); |
| 432 | 432 | $disk_free = $this->decodeSize(disk_free_space($monitor_path_b)); |
| 433 | 433 | if (basename($monitor_path_b) === '') { |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | %s %s %s |
| 196 | 196 | GROUP BY m.id |
| 197 | 197 | ORDER BY %s %s', |
| 198 | - ! empty($musicIDs) ? 'WHERE m.id IN ('.implode(',', $musicIDs).')' : 'AND 1=1', |
|
| 199 | - (! empty($releaseIDs)) ? 'AND r.id in ('.implode(',', $releaseIDs).')' : '', |
|
| 198 | + !empty($musicIDs) ? 'WHERE m.id IN ('.implode(',', $musicIDs).')' : 'AND 1=1', |
|
| 199 | + (!empty($releaseIDs)) ? 'AND r.id in ('.implode(',', $releaseIDs).')' : '', |
|
| 200 | 200 | $catsrch, |
| 201 | 201 | $order[0], |
| 202 | 202 | $order[1] |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | { |
| 262 | 262 | $browseby = ' '; |
| 263 | 263 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
| 264 | - if (! empty($_REQUEST[$bbk])) { |
|
| 264 | + if (!empty($_REQUEST[$bbk])) { |
|
| 265 | 265 | $bbs = stripslashes($_REQUEST[$bbk]); |
| 266 | 266 | if (stripos($bbv, 'id') !== false) { |
| 267 | 267 | $browseby .= ' AND m.'.$bbv.' = '.$bbs; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | ) |
| 414 | 414 | ); |
| 415 | 415 | |
| 416 | - if (! empty($res)) { |
|
| 416 | + if (!empty($res)) { |
|
| 417 | 417 | foreach ($res as $arr) { |
| 418 | 418 | $startTime = now(); |
| 419 | 419 | $usedAmazon = false; |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $h = trim(preg_replace('/\s\s+/', ' ', $g)); |
| 487 | 487 | $newname = trim(preg_replace('/ [a-z]{2}$| [a-z]{3} \d{2,}$|\d{5,} \d{5,}$|-WEB$/i', '', $h)); |
| 488 | 488 | |
| 489 | - if (! preg_match('/^[a-z0-9]+$/i', $newname) && strlen($newname) > 10) { |
|
| 489 | + if (!preg_match('/^[a-z0-9]+$/i', $newname) && strlen($newname) > 10) { |
|
| 490 | 490 | $result['name'] = $newname; |
| 491 | 491 | |
| 492 | 492 | return $result; |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | $path = $params[0]; |
| 50 | 50 | |
| 51 | 51 | // Check if the path ends with dir separator. |
| 52 | - if (! Str::endsWith($path, '/')) { |
|
| 52 | + if (!Str::endsWith($path, '/')) { |
|
| 53 | 53 | $path .= '/'; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Check if it's a directory. |
| 57 | - if (! File::isDirectory($path)) { |
|
| 57 | + if (!File::isDirectory($path)) { |
|
| 58 | 58 | $this->echoOut('Folder does not exist: '.$path); |
| 59 | 59 | |
| 60 | 60 | return $this->returnValue(); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Check if we can write to it. |
| 64 | - if (! is_writable($path)) { |
|
| 64 | + if (!is_writable($path)) { |
|
| 65 | 65 | $this->echoOut('Folder is not writable: '.$path); |
| 66 | 66 | |
| 67 | 67 | return $this->returnValue(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // Check if the from date is the proper format. |
| 71 | 71 | if (isset($params[1]) && $params[1] !== '') { |
| 72 | - if (! $this->checkDate($params[1])) { |
|
| 72 | + if (!$this->checkDate($params[1])) { |
|
| 73 | 73 | return $this->returnValue(); |
| 74 | 74 | } |
| 75 | 75 | $fromDate = $params[1]; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | // Check if the to date is the proper format. |
| 79 | 79 | if (isset($params[2]) && $params[2] !== '') { |
| 80 | - if (! $this->checkDate($params[2])) { |
|
| 80 | + if (!$this->checkDate($params[2])) { |
|
| 81 | 81 | return $this->returnValue(); |
| 82 | 82 | } |
| 83 | 83 | $toDate = $params[2]; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Check if the group_id exists. |
| 87 | 87 | if (isset($params[3]) && $params[3] !== 0) { |
| 88 | - if (! is_numeric($params[3])) { |
|
| 88 | + if (!is_numeric($params[3])) { |
|
| 89 | 89 | $this->echoOut('The group ID is not a number: '.$params[3]); |
| 90 | 90 | |
| 91 | 91 | return $this->returnValue(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | // Create a path to store the new NZB files. |
| 122 | 122 | $currentPath = $path.$this->safeFilename($group['name']).'/'; |
| 123 | - if (! File::isDirectory($currentPath) && ! File::makeDirectory($currentPath) && ! File::isDirectory($currentPath)) { |
|
| 123 | + if (!File::isDirectory($currentPath) && !File::makeDirectory($currentPath) && !File::isDirectory($currentPath)) { |
|
| 124 | 124 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $currentPath)); |
| 125 | 125 | } |
| 126 | 126 | foreach ($releases as $release) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | // Check if the user wants them in gzip, copy it if so. |
| 142 | 142 | if ($gzip) { |
| 143 | - if (! copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
| 143 | + if (!copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
| 144 | 144 | if ($this->echoCLI) { |
| 145 | 145 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
| 146 | 146 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | // If not, decompress it and create a file to store it in. |
| 151 | 151 | } else { |
| 152 | 152 | $nzbContents = Utility::unzipGzipFile($nzbFile); |
| 153 | - if (! $nzbContents) { |
|
| 153 | + if (!$nzbContents) { |
|
| 154 | 154 | if ($this->echoCLI) { |
| 155 | 155 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
| 156 | 156 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | protected function checkDate($date): bool |
| 192 | 192 | { |
| 193 | - if (! preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
| 193 | + if (!preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
| 194 | 194 | $this->echoOut('Wrong date format: '.$date); |
| 195 | 195 | |
| 196 | 196 | return false; |
@@ -687,7 +687,7 @@ |
||
| 687 | 687 | { |
| 688 | 688 | $sharing = (array) Arr::first(DB::select('SELECT enabled, posting, fetching FROM sharing')); |
| 689 | 689 | |
| 690 | - if (! empty($sharing) && (int) $sharing['enabled'] === 1 && (int) $runVar['settings']['run_sharing'] === 1 && ((int) $sharing['posting'] === 1 || (int) $sharing['fetching'] === 1) && shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:{$pane} | grep ^0 | grep -c dead") == 1) { |
|
| 690 | + if (!empty($sharing) && (int) $sharing['enabled'] === 1 && (int) $runVar['settings']['run_sharing'] === 1 && ((int) $sharing['posting'] === 1 || (int) $sharing['fetching'] === 1) && shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:{$pane} | grep ^0 | grep -c dead") == 1) { |
|
| 691 | 691 | shell_exec( |
| 692 | 692 | "tmux respawnp -t{$runVar['constants']['tmux_session']}:{$pane}.0 ' \ |
| 693 | 693 | {$runVar['commands']['_php']} {$runVar['paths']['misc']}/update/multiprocessing/postprocess.php sha; \ |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | protected function generic(): array |
| 108 | 108 | { |
| 109 | 109 | // For non music groups. |
| 110 | - if (! preg_match('/\.(flac|lossless|mp3|music|sounds)/', $this->groupName)) { |
|
| 110 | + if (!preg_match('/\.(flac|lossless|mp3|music|sounds)/', $this->groupName)) { |
|
| 111 | 111 | // File/part count. |
| 112 | 112 | // File extensions. |
| 113 | 113 | // File extensions - If it was not in quotes. |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | { |
| 276 | 276 | $browseBy = ' '; |
| 277 | 277 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
| 278 | - if (! empty($_REQUEST[$bbk])) { |
|
| 278 | + if (!empty($_REQUEST[$bbk])) { |
|
| 279 | 279 | $bbs = stripslashes($_REQUEST[$bbk]); |
| 280 | 280 | $browseBy .= ' AND con.'.$bbv.' LIKE '.escapeString('%'.$bbs.'%'); |
| 281 | 281 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $con['esrb'] = (string) $amaz->ItemAttributes->ESRBAgeRating; |
| 401 | 401 | $con['releasedate'] = (string) $amaz->ItemAttributes->ReleaseDate; |
| 402 | 402 | |
| 403 | - if (! isset($con['releasedate'])) { |
|
| 403 | + if (!isset($con['releasedate'])) { |
|
| 404 | 404 | $con['releasedate'] = ''; |
| 405 | 405 | } |
| 406 | 406 | |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | if (config('config.credentials.client_id') !== '' && config('config.credentials.client_secret') !== '') { |
| 629 | 629 | try { |
| 630 | 630 | $result = Game::where('name', $gameInfo)->get(); |
| 631 | - if (! empty($result)) { |
|
| 631 | + if (!empty($result)) { |
|
| 632 | 632 | $bestMatchPct = 0; |
| 633 | 633 | foreach ($result as $res) { |
| 634 | 634 | similar_text(strtolower($gameInfo), strtolower($res->name), $percent); |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | ])->where('id', $bestMatch)->first(); |
| 647 | 647 | |
| 648 | 648 | $publishers = []; |
| 649 | - if (! empty($game->involved_companies)) { |
|
| 649 | + if (!empty($game->involved_companies)) { |
|
| 650 | 650 | foreach ($game->involved_companies as $publisher) { |
| 651 | 651 | if ($publisher['publisher'] === true) { |
| 652 | 652 | $company = Company::find($publisher['company']); |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | $genres = []; |
| 659 | 659 | |
| 660 | - if (! empty($game->themes)) { |
|
| 660 | + if (!empty($game->themes)) { |
|
| 661 | 661 | foreach ($game->themes as $theme) { |
| 662 | 662 | $genres[] = $theme['name']; |
| 663 | 663 | } |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | $platform = ''; |
| 669 | 669 | |
| 670 | - if (! empty($game->platforms)) { |
|
| 670 | + if (!empty($game->platforms)) { |
|
| 671 | 671 | foreach ($game->platforms as $platforms) { |
| 672 | 672 | $percentCurrent = 0; |
| 673 | 673 | $gamePlatforms = Platform::where('id', $platforms)->get(); |
@@ -686,13 +686,13 @@ discard block |
||
| 686 | 686 | 'title' => $game->name, |
| 687 | 687 | 'asin' => $game->id, |
| 688 | 688 | 'review' => $game->summary ?? '', |
| 689 | - 'coverurl' => ! empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
| 690 | - 'releasedate' => ! empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
| 691 | - 'esrb' => ! empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
| 689 | + 'coverurl' => !empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
| 690 | + 'releasedate' => !empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
| 691 | + 'esrb' => !empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
| 692 | 692 | 'url' => $game->url ?? '', |
| 693 | - 'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
| 693 | + 'publisher' => !empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
| 694 | 694 | 'platform' => $platform ?? '', |
| 695 | - 'consolegenre' => ! empty($genres) ? implode(',', $genres) : 'Unknown', |
|
| 695 | + 'consolegenre' => !empty($genres) ? implode(',', $genres) : 'Unknown', |
|
| 696 | 696 | 'consolegenreid' => $genreKey ?? '', |
| 697 | 697 | 'salesrank' => '', |
| 698 | 698 | ]; |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | $platform = 'PSX'; |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - if (! empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
| 838 | + if (!empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
| 839 | 839 | $platform = 'XBOX360'; |
| 840 | 840 | } |
| 841 | 841 | |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | Other option is to pass the $release->categories_id here if we don't find a platform but that |
| 851 | 851 | would require an extra lookup to determine the name. In either case we should have a title at the minimum. */ |
| 852 | 852 | |
| 853 | - return (isset($result['title'], $result['platform']) && ! empty($result['title'])) ? $result : false; |
|
| 853 | + return (isset($result['title'], $result['platform']) && !empty($result['title'])) ? $result : false; |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | public function getBrowseNode($platform): string |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function deleteRegex(int $id): void |
| 151 | 151 | { |
| 152 | - DB::transaction(function () use ($id) { |
|
| 152 | + DB::transaction(function() use ($id) { |
|
| 153 | 153 | DB::delete(sprintf('DELETE FROM %s WHERE id = %d', $this->tableName, $id)); |
| 154 | 154 | }, 3); |
| 155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | { |
| 167 | 167 | $groupID = UsenetGroup::getIDByName($groupName); |
| 168 | 168 | |
| 169 | - if (! $groupID) { |
|
| 169 | + if (!$groupID) { |
|
| 170 | 170 | return []; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | ksort($hits); |
| 189 | 189 | $string = $string2 = ''; |
| 190 | 190 | foreach ($hits as $key => $hit) { |
| 191 | - if (! \is_int($key)) { |
|
| 191 | + if (!\is_int($key)) { |
|
| 192 | 192 | $string .= $hit; |
| 193 | 193 | $string2 .= '<br/>'.$key.': '.$hit; |
| 194 | 194 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | $groupID = UsenetGroup::getIDByName($groupName); |
| 229 | 229 | |
| 230 | - if (! $groupID) { |
|
| 230 | + if (!$groupID) { |
|
| 231 | 231 | return []; |
| 232 | 232 | } |
| 233 | 233 | |