@@ -154,7 +154,7 @@ |
||
| 154 | 154 | */ |
| 155 | 155 | public function isUsed(): bool |
| 156 | 156 | { |
| 157 | - return ! is_null($this->used_at); |
|
| 157 | + return !is_null($this->used_at); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $res = self::query()->where('email', '<>', '[email protected]'); |
| 252 | 252 | |
| 253 | - if (! empty($role)) { |
|
| 253 | + if (!empty($role)) { |
|
| 254 | 254 | $res->where('roles_id', $role); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | 'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60, |
| 292 | 292 | ]; |
| 293 | 293 | |
| 294 | - if (! empty($email)) { |
|
| 294 | + if (!empty($email)) { |
|
| 295 | 295 | $email = trim($email); |
| 296 | 296 | $sql += ['email' => $email]; |
| 297 | 297 | } |
@@ -340,10 +340,10 @@ discard block |
||
| 340 | 340 | { |
| 341 | 341 | $user = self::find($uid); |
| 342 | 342 | $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString(); |
| 343 | - if (! empty($date)) { |
|
| 343 | + if (!empty($date)) { |
|
| 344 | 344 | $user->update(['rolechangedate' => $date]); |
| 345 | 345 | } |
| 346 | - if (empty($date) && ! empty($addYear)) { |
|
| 346 | + if (empty($date) && !empty($addYear)) { |
|
| 347 | 347 | $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]); |
| 348 | 348 | } |
| 349 | 349 | } |
@@ -400,10 +400,10 @@ discard block |
||
| 400 | 400 | return self::fromQuery( |
| 401 | 401 | sprintf( |
| 402 | 402 | $query, |
| 403 | - ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 404 | - ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 405 | - ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 406 | - (! empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 403 | + !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 404 | + !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 405 | + !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 406 | + (!empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 407 | 407 | $order[0], |
| 408 | 408 | $order[1], |
| 409 | 409 | ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start)) |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | public static function isValidUrl($url): bool |
| 517 | 517 | { |
| 518 | - return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 518 | + return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | /** |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | |
| 552 | 552 | // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. |
| 553 | 553 | $invitedBy = 0; |
| 554 | - if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 554 | + if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 555 | 555 | if ($inviteCode === '') { |
| 556 | 556 | return self::ERR_SIGNUP_BADINVITECODE; |
| 557 | 557 | } |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | public static function checkAndUseInvite(string $inviteCode): int |
| 572 | 572 | { |
| 573 | 573 | $invite = Invitation::findValidByToken($inviteCode); |
| 574 | - if (! $invite) { |
|
| 574 | + if (!$invite) { |
|
| 575 | 575 | return -1; |
| 576 | 576 | } |
| 577 | 577 | |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0) |
| 588 | 588 | { |
| 589 | 589 | $password = self::hashPassword($password); |
| 590 | - if (! $password) { |
|
| 590 | + if (!$password) { |
|
| 591 | 591 | return false; |
| 592 | 592 | } |
| 593 | 593 | |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | |
| 630 | 630 | $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other']; |
| 631 | 631 | |
| 632 | - if (! empty($allowed)) { |
|
| 632 | + if (!empty($allowed)) { |
|
| 633 | 633 | foreach ($cats as $cat) { |
| 634 | - if (! \in_array($cat, $allowed, false)) { |
|
| 634 | + if (!\in_array($cat, $allowed, false)) { |
|
| 635 | 635 | $ret[] = match ($cat) { |
| 636 | 636 | 'view console' => 1000, |
| 637 | 637 | 'view movies' => 2000, |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function isBlackListed(array $msg, string $groupName): bool |
| 28 | 28 | { |
| 29 | - if (! isset($this->listsFound[$groupName])) { |
|
| 29 | + if (!isset($this->listsFound[$groupName])) { |
|
| 30 | 30 | $this->retrieveLists($groupName); |
| 31 | 31 | } |
| 32 | - if (! $this->listsFound[$groupName]) { |
|
| 32 | + if (!$this->listsFound[$groupName]) { |
|
| 33 | 33 | return false; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (! $blackListed && $this->blackList[$groupName]) { |
|
| 55 | + if (!$blackListed && $this->blackList[$groupName]) { |
|
| 56 | 56 | foreach ($this->blackList[$groupName] as $blackList) { |
| 57 | 57 | if (@preg_match('/'.$blackList->regex.'/i', $field[$blackList->msgcol])) { |
| 58 | 58 | $blackListed = true; |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | private function retrieveLists(string $groupName): void |
| 157 | 157 | { |
| 158 | - if (! isset($this->blackList[$groupName])) { |
|
| 158 | + if (!isset($this->blackList[$groupName])) { |
|
| 159 | 159 | $this->blackList[$groupName] = $this->getBlacklist(true, \Blacklight\Binaries::OPTYPE_BLACKLIST, $groupName, true); |
| 160 | 160 | } |
| 161 | - if (! isset($this->whiteList[$groupName])) { |
|
| 161 | + if (!isset($this->whiteList[$groupName])) { |
|
| 162 | 162 | $this->whiteList[$groupName] = $this->getBlacklist(true, \Blacklight\Binaries::OPTYPE_WHITELIST, $groupName, true); |
| 163 | 163 | } |
| 164 | 164 | $this->listsFound[$groupName] = ($this->blackList[$groupName] || $this->whiteList[$groupName]); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $collectionsQuery = Collection::query() |
| 44 | 44 | ->where('collections.filecheck', ProcessReleases::COLLFC_SIZED) |
| 45 | 45 | ->where('collections.filesize', '>', 0); |
| 46 | - if (! empty($groupID)) { |
|
| 46 | + if (!empty($groupID)) { |
|
| 47 | 47 | $collectionsQuery->where('collections.groups_id', $groupID); |
| 48 | 48 | } |
| 49 | 49 | $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $determinedCategory = $categorize->determineCategory($collection->groups_id, $cleanedName); |
| 100 | 100 | |
| 101 | - $searchName = ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName; |
|
| 101 | + $searchName = !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName; |
|
| 102 | 102 | |
| 103 | 103 | $releaseID = Release::insertRelease([ |
| 104 | 104 | 'name' => $cleanRelName, |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | ]); |
| 118 | 118 | |
| 119 | 119 | if ($releaseID !== null) { |
| 120 | - DB::transaction(static function () use ($collection, $releaseID) { |
|
| 120 | + DB::transaction(static function() use ($collection, $releaseID) { |
|
| 121 | 121 | Collection::query()->where('id', $collection->id)->update([ |
| 122 | 122 | 'filecheck' => ProcessReleases::COLLFC_INSERTED, |
| 123 | 123 | 'releases_id' => $releaseID, |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } else { |
| 173 | - DB::transaction(static function () use ($collection) { |
|
| 173 | + DB::transaction(static function() use ($collection) { |
|
| 174 | 174 | Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); |
| 175 | 175 | }, 10); |
| 176 | 176 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // Validate |
| 94 | 94 | $invalid = $this->invalidCategories($normalized); |
| 95 | - if (! empty($invalid)) { |
|
| 95 | + if (!empty($invalid)) { |
|
| 96 | 96 | $this->error('Unknown category option(s): '.implode(', ', $invalid)); |
| 97 | 97 | $this->line('Allowed: '.implode(', ', self::$allowedCategories).' (or omit --category to reset all).'); |
| 98 | 98 | |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | private function normalizeCategories(array $raw): array |
| 151 | 151 | { |
| 152 | 152 | $normalized = collect($raw) |
| 153 | - ->flatMap(function ($opt) { |
|
| 153 | + ->flatMap(function($opt) { |
|
| 154 | 154 | $opt = is_array($opt) ? implode(',', $opt) : (string) $opt; |
| 155 | 155 | |
| 156 | 156 | return preg_split('/[\s,]+/', $opt, -1, PREG_SPLIT_NO_EMPTY); |
| 157 | 157 | }) |
| 158 | - ->map(function ($opt) { |
|
| 158 | + ->map(function($opt) { |
|
| 159 | 159 | $opt = trim((string) $opt); |
| 160 | 160 | // If the token contains '=', take the substring after the last '=' |
| 161 | 161 | if (str_contains($opt, '=')) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | private function invalidCategories(array $normalized): array |
| 187 | 187 | { |
| 188 | 188 | return collect($normalized) |
| 189 | - ->reject(function ($opt) { |
|
| 189 | + ->reject(function($opt) { |
|
| 190 | 190 | return in_array($opt, self::$allowedCategories, true) || $opt === 'all'; |
| 191 | 191 | }) |
| 192 | 192 | ->values() |
@@ -274,7 +274,7 @@ |
||
| 274 | 274 | |
| 275 | 275 | // Loop through the files. |
| 276 | 276 | foreach ($files as $file) { |
| 277 | - if (! isset($file['name'])) { |
|
| 277 | + if (!isset($file['name'])) { |
|
| 278 | 278 | continue; |
| 279 | 279 | } |
| 280 | 280 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $this->info(' |
@@ -88,16 +88,16 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $steps = 3; // prepare, finalize, cleanup |
| 90 | 90 | |
| 91 | - if (! $this->option('skip-git')) { |
|
| 91 | + if (!$this->option('skip-git')) { |
|
| 92 | 92 | $steps++; |
| 93 | 93 | } |
| 94 | - if (! $this->option('skip-composer')) { |
|
| 94 | + if (!$this->option('skip-composer')) { |
|
| 95 | 95 | $steps++; |
| 96 | 96 | } |
| 97 | - if (! $this->option('skip-npm')) { |
|
| 97 | + if (!$this->option('skip-npm')) { |
|
| 98 | 98 | $steps += 2; |
| 99 | 99 | } // install + build |
| 100 | - if (! $this->option('skip-db')) { |
|
| 100 | + if (!$this->option('skip-db')) { |
|
| 101 | 101 | $steps++; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | // Check if app is in maintenance mode |
| 118 | 118 | $this->wasInMaintenance = App::isDownForMaintenance(); |
| 119 | - if (! $this->wasInMaintenance) { |
|
| 119 | + if (!$this->wasInMaintenance) { |
|
| 120 | 120 | $this->call('down', [ |
| 121 | 121 | '--render' => 'errors::maintenance', |
| 122 | 122 | '--retry' => 120, |
@@ -140,22 +140,22 @@ discard block |
||
| 140 | 140 | private function executeUpdateSteps(): void |
| 141 | 141 | { |
| 142 | 142 | // Git operations |
| 143 | - if (! $this->option('skip-git')) { |
|
| 143 | + if (!$this->option('skip-git')) { |
|
| 144 | 144 | $this->performGitUpdate(); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Composer operations |
| 148 | - if (! $this->option('skip-composer')) { |
|
| 148 | + if (!$this->option('skip-composer')) { |
|
| 149 | 149 | $this->performComposerUpdate(); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // Database migrations |
| 153 | - if (! $this->option('skip-db')) { |
|
| 153 | + if (!$this->option('skip-db')) { |
|
| 154 | 154 | $this->performDatabaseUpdate(); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | // NPM operations |
| 158 | - if (! $this->option('skip-npm')) { |
|
| 158 | + if (!$this->option('skip-npm')) { |
|
| 159 | 159 | $this->performNpmOperations(); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | // Check if package.json has changed |
| 220 | 220 | $packageLockExists = File::exists(base_path('package-lock.json')); |
| 221 | - $shouldInstall = ! $packageLockExists || $this->option('force'); |
|
| 221 | + $shouldInstall = !$packageLockExists || $this->option('force'); |
|
| 222 | 222 | |
| 223 | 223 | if ($shouldInstall) { |
| 224 | 224 | $this->info(' |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | $this->checkSystemResources(); |
| 44 | 44 | |
| 45 | 45 | // Check if session already exists |
| 46 | - if (! $this->option('force') && $this->isSessionRunning($tmuxSession)) { |
|
| 46 | + if (!$this->option('force') && $this->isSessionRunning($tmuxSession)) { |
|
| 47 | 47 | $this->error("❌ Tmux session '$tmuxSession' is already running"); |
| 48 | 48 | |
| 49 | - if (! $this->confirm('Would you like to restart the session?')) { |
|
| 49 | + if (!$this->confirm('Would you like to restart the session?')) { |
|
| 50 | 50 | return Command::FAILURE; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $recommendations = UpdatePerformanceHelper::checkSystemResources(); |
| 81 | 81 | |
| 82 | - if (! empty($recommendations)) { |
|
| 82 | + if (!empty($recommendations)) { |
|
| 83 | 83 | $this->warn('⚠️ System resource information:'); |
| 84 | 84 | foreach ($recommendations as $recommendation) { |
| 85 | 85 | $this->line(" • $recommendation"); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $runScript = base_path('misc/update/tmux/run.php'); |
| 109 | 109 | |
| 110 | - if (! file_exists($runScript)) { |
|
| 110 | + if (!file_exists($runScript)) { |
|
| 111 | 111 | throw new \Exception("Tmux run script not found: $runScript"); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $this->info(' |