@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $rememberMe = $request->has('rememberme') && $request->input('rememberme') === 'on'; |
| 86 | 86 | |
| 87 | - if (! $user->isVerified() || $user->isPendingVerification()) { |
|
| 87 | + if (!$user->isVerified() || $user->isPendingVerification()) { |
|
| 88 | 88 | $request->session()->flash('message', 'You have not verified your email address!'); |
| 89 | 89 | |
| 90 | 90 | return redirect()->to('login'); |
@@ -204,14 +204,14 @@ discard block |
||
| 204 | 204 | if ($remainingMinutes > 0) { |
| 205 | 205 | // Create a cookie with proper settings for persistence |
| 206 | 206 | $cookie = cookie( |
| 207 | - '2fa_trusted_device', // name |
|
| 208 | - $trustedDeviceCookie, // value |
|
| 209 | - $remainingMinutes, // minutes remaining |
|
| 210 | - '/', // path |
|
| 207 | + '2fa_trusted_device', // name |
|
| 208 | + $trustedDeviceCookie, // value |
|
| 209 | + $remainingMinutes, // minutes remaining |
|
| 210 | + '/', // path |
|
| 211 | 211 | config('session.domain'), // use session domain config |
| 212 | 212 | config('session.secure'), // use session secure config |
| 213 | - false, // httpOnly |
|
| 214 | - false, // raw |
|
| 213 | + false, // httpOnly |
|
| 214 | + false, // raw |
|
| 215 | 215 | config('session.same_site', 'lax') // use session same_site config |
| 216 | 216 | ); |
| 217 | 217 | |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | try { |
| 36 | 36 | $data = @json_decode($cookie, true); |
| 37 | 37 | |
| 38 | - if (! is_array($data)) { |
|
| 38 | + if (!is_array($data)) { |
|
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // Validate all required fields |
| 43 | - if (! isset($data['user_id'], $data['token'], $data['expires_at'])) { |
|
| 43 | + if (!isset($data['user_id'], $data['token'], $data['expires_at'])) { |
|
| 44 | 44 | return false; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | protected function canPassWithoutCheckingOTP(): bool |
| 65 | 65 | { |
| 66 | - if (! $this->getUser()->passwordSecurity) { |
|
| 66 | + if (!$this->getUser()->passwordSecurity) { |
|
| 67 | 67 | return true; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return |
| 71 | - ! $this->getUser()->passwordSecurity->google2fa_enable || |
|
| 72 | - ! $this->isEnabled() || |
|
| 71 | + !$this->getUser()->passwordSecurity->google2fa_enable || |
|
| 72 | + !$this->isEnabled() || |
|
| 73 | 73 | $this->noUserIsAuthenticated() || |
| 74 | 74 | $this->twoFactorAuthStillValid() || |
| 75 | 75 | $this->isDeviceTrusted(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $cookie = request()->cookie('2fa_trusted_device'); |
| 85 | 85 | $user = $this->getUser(); |
| 86 | 86 | |
| 87 | - if (! $cookie) { |
|
| 87 | + if (!$cookie) { |
|
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // Validate the required fields silently |
| 99 | - if (! isset($data['user_id'], $data['token'], $data['expires_at'])) { |
|
| 99 | + if (!isset($data['user_id'], $data['token'], $data['expires_at'])) { |
|
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | // Check database connection and detect database type |
| 32 | 32 | $dbType = $this->checkDatabaseConnection(); |
| 33 | - if (! $dbType) { |
|
| 33 | + if (!$dbType) { |
|
| 34 | 34 | $this->error('Database connection failed'); |
| 35 | 35 | |
| 36 | 36 | return Command::FAILURE; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $this->warn("⚠️ Rolling back $steps migrations..."); |
| 125 | 125 | |
| 126 | - if (! $this->confirm('Are you sure you want to rollback migrations? This may cause data loss.')) { |
|
| 126 | + if (!$this->confirm('Are you sure you want to rollback migrations? This may cause data loss.')) { |
|
| 127 | 127 | $this->info('Rollback cancelled'); |
| 128 | 128 | |
| 129 | 129 | return Command::SUCCESS; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public static function hasFileChanged(string $filePath, ?string $cacheKey = null): bool |
| 15 | 15 | { |
| 16 | - if (! File::exists($filePath)) { |
|
| 16 | + if (!File::exists($filePath)) { |
|
| 17 | 17 | return false; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // Check PHP extensions |
| 145 | 145 | $requiredExtensions = ['pdo', 'mbstring', 'openssl', 'json', 'curl']; |
| 146 | 146 | foreach ($requiredExtensions as $ext) { |
| 147 | - if (! extension_loaded($ext)) { |
|
| 147 | + if (!extension_loaded($ext)) { |
|
| 148 | 148 | $recommendations[] = "Missing PHP extension: $ext"; |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -162,14 +162,14 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $memInfo = @file_get_contents('/proc/meminfo'); |
| 165 | - if (! $memInfo) { |
|
| 165 | + if (!$memInfo) { |
|
| 166 | 166 | return null; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | preg_match('/MemTotal:\s+(\d+)/', $memInfo, $totalMatch); |
| 170 | 170 | preg_match('/MemAvailable:\s+(\d+)/', $memInfo, $availableMatch); |
| 171 | 171 | |
| 172 | - if (! isset($totalMatch[1]) || ! isset($availableMatch[1])) { |
|
| 172 | + if (!isset($totalMatch[1]) || !isset($availableMatch[1])) { |
|
| 173 | 173 | return null; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'search' => ['available' => 'yes', 'supportedParams' => 'id'], |
| 53 | 53 | 'tv-search' => ['available' => 'yes', 'supportedParams' => 'id,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], |
| 54 | 54 | 'movie-search' => ['available' => 'yes', 'supportedParams' => 'id, imdbid, tmdbid, traktid'], |
| 55 | - 'audio-search' => ['available' => 'no', 'supportedParams' => ''], |
|
| 55 | + 'audio-search' => ['available' => 'no', 'supportedParams' => ''], |
|
| 56 | 56 | ], |
| 57 | 57 | 'categories' => fractal($category, new CategoryTransformer), |
| 58 | 58 | ]; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ->with('role') // Eager load role to avoid N+1 |
| 76 | 76 | ->first(); |
| 77 | 77 | |
| 78 | - if (! $user) { |
|
| 78 | + if (!$user) { |
|
| 79 | 79 | return response()->json(['error' => 'Invalid API key'], 403); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $engine = $this->getSelectedEngine(); |
| 61 | 61 | $index = $this->getSelectedIndex(); |
| 62 | 62 | |
| 63 | - if (! $engine || ! $index) { |
|
| 63 | + if (!$engine || !$index) { |
|
| 64 | 64 | $this->error('You must specify both an engine (--manticore or --elastic) and an index (--releases or --predb).'); |
| 65 | 65 | $this->info('Use --help to see all available options.'); |
| 66 | 66 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | $methodName = "{$engine}".ucfirst($index); |
| 136 | 136 | |
| 137 | - if (! method_exists($this, $methodName)) { |
|
| 137 | + if (!method_exists($this, $methodName)) { |
|
| 138 | 138 | $this->error("Method {$methodName} not implemented."); |
| 139 | 139 | |
| 140 | 140 | return Command::FAILURE; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $manticore->truncateRTIndex(Arr::wrap($indexName)); |
| 162 | 162 | |
| 163 | 163 | $total = Release::count(); |
| 164 | - if (! $total) { |
|
| 164 | + if (!$total) { |
|
| 165 | 165 | $this->warn('Releases table is empty. Nothing to do.'); |
| 166 | 166 | |
| 167 | 167 | return Command::SUCCESS; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $indexName, |
| 191 | 191 | $total, |
| 192 | 192 | $query, |
| 193 | - function ($item) { |
|
| 193 | + function($item) { |
|
| 194 | 194 | return [ |
| 195 | 195 | 'id' => (string) $item->id, |
| 196 | 196 | 'name' => (string) ($item->name ?: ''), |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $manticore->truncateRTIndex([$indexName]); |
| 216 | 216 | |
| 217 | 217 | $total = Predb::count(); |
| 218 | - if (! $total) { |
|
| 218 | + if (!$total) { |
|
| 219 | 219 | $this->warn('PreDB table is empty. Nothing to do.'); |
| 220 | 220 | |
| 221 | 221 | return Command::SUCCESS; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $indexName, |
| 230 | 230 | $total, |
| 231 | 231 | $query, |
| 232 | - function ($item) { |
|
| 232 | + function($item) { |
|
| 233 | 233 | return [ |
| 234 | 234 | 'id' => $item->id, |
| 235 | 235 | 'title' => (string) ($item->title ?? ''), |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $batchData = []; |
| 271 | 271 | |
| 272 | 272 | try { |
| 273 | - $query->chunk($chunkSize, function ($items) use ($manticore, $indexName, $transformer, $bar, &$processedCount, &$errorCount, $batchSize, &$batchData) { |
|
| 273 | + $query->chunk($chunkSize, function($items) use ($manticore, $indexName, $transformer, $bar, &$processedCount, &$errorCount, $batchSize, &$batchData) { |
|
| 274 | 274 | foreach ($items as $item) { |
| 275 | 275 | try { |
| 276 | 276 | $batchData[] = $transformer($item); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | }); |
| 293 | 293 | |
| 294 | 294 | // Process remaining items |
| 295 | - if (! empty($batchData)) { |
|
| 295 | + if (!empty($batchData)) { |
|
| 296 | 296 | $this->processBatch($manticore, $indexName, $batchData); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | private function elasticReleases(): int |
| 325 | 325 | { |
| 326 | 326 | $total = Release::count(); |
| 327 | - if (! $total) { |
|
| 327 | + if (!$total) { |
|
| 328 | 328 | $this->warn('Releases table is empty. Nothing to do.'); |
| 329 | 329 | |
| 330 | 330 | return Command::SUCCESS; |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | 'releases', |
| 356 | 356 | $total, |
| 357 | 357 | $query, |
| 358 | - function ($item) { |
|
| 358 | + function($item) { |
|
| 359 | 359 | $searchName = str_replace(['.', '-'], ' ', $item->searchname ?? ''); |
| 360 | 360 | |
| 361 | 361 | return [ |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | private function elasticPredb(): int |
| 379 | 379 | { |
| 380 | 380 | $total = Predb::count(); |
| 381 | - if (! $total) { |
|
| 381 | + if (!$total) { |
|
| 382 | 382 | $this->warn('PreDB table is empty. Nothing to do.'); |
| 383 | 383 | |
| 384 | 384 | return Command::SUCCESS; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | 'predb', |
| 393 | 393 | $total, |
| 394 | 394 | $query, |
| 395 | - function ($item) { |
|
| 395 | + function($item) { |
|
| 396 | 396 | return [ |
| 397 | 397 | 'id' => $item->id, |
| 398 | 398 | 'title' => $item->title, |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $errorCount = 0; |
| 431 | 431 | |
| 432 | 432 | try { |
| 433 | - $query->chunk($chunkSize, function ($items) use ($indexName, $transformer, $bar, &$processedCount, &$errorCount, $batchSize) { |
|
| 433 | + $query->chunk($chunkSize, function($items) use ($indexName, $transformer, $bar, &$processedCount, &$errorCount, $batchSize) { |
|
| 434 | 434 | // Process in optimized batches for ElasticSearch |
| 435 | 435 | foreach ($items->chunk($batchSize) as $batch) { |
| 436 | 436 | $data = ['body' => []]; |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | $bar->advance(); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - if (! empty($data['body'])) { |
|
| 461 | + if (!empty($data['body'])) { |
|
| 462 | 462 | $this->processElasticBatch($data, $errorCount); |
| 463 | 463 | } |
| 464 | 464 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $engine = $this->getSelectedEngine(); |
| 55 | 55 | $index = $this->getSelectedIndex(); |
| 56 | 56 | |
| 57 | - if (! $engine || ! $index) { |
|
| 57 | + if (!$engine || !$index) { |
|
| 58 | 58 | $this->error('Engine and index must be specified'); |
| 59 | 59 | |
| 60 | 60 | return Command::FAILURE; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $manticore = new ManticoreSearch; |
| 96 | 96 | $batchData = []; |
| 97 | 97 | |
| 98 | - $query->chunk($batchSize, function ($items) use ($manticore, $indexName, $transformer, &$processed, &$errors, &$batchData, $batchSize, $workerId) { |
|
| 98 | + $query->chunk($batchSize, function($items) use ($manticore, $indexName, $transformer, &$processed, &$errors, &$batchData, $batchSize, $workerId) { |
|
| 99 | 99 | $this->info("Worker {$workerId}: Processing chunk of {$items->count()} items"); |
| 100 | 100 | |
| 101 | 101 | foreach ($items as $item) { |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | }); |
| 117 | 117 | |
| 118 | 118 | // Process remaining items |
| 119 | - if (! empty($batchData)) { |
|
| 119 | + if (!empty($batchData)) { |
|
| 120 | 120 | $this->processManticoreBatch($manticore, $indexName, $batchData, $workerId); |
| 121 | 121 | $this->info("Worker {$workerId}: Inserted final batch of ".count($batchData).' records'); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | } else { // ElasticSearch |
| 125 | - $query->chunk($batchSize, function ($items) use ($indexName, $transformer, &$processed, &$errors, $workerId) { |
|
| 125 | + $query->chunk($batchSize, function($items) use ($indexName, $transformer, &$processed, &$errors, $workerId) { |
|
| 126 | 126 | $this->info("Worker {$workerId}: Processing chunk of {$items->count()} items"); |
| 127 | 127 | $data = ['body' => []]; |
| 128 | 128 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if (! empty($data['body'])) { |
|
| 148 | + if (!empty($data['body'])) { |
|
| 149 | 149 | $this->processElasticBatch($data, $workerId); |
| 150 | 150 | $this->info("Worker {$workerId}: Inserted batch of ".(count($data['body']) / 2).' records'); |
| 151 | 151 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | if ($index === 'releases') { |
| 195 | 195 | if ($engine === 'manticore') { |
| 196 | - return function ($item) { |
|
| 196 | + return function($item) { |
|
| 197 | 197 | return [ |
| 198 | 198 | 'id' => (string) $item->id, |
| 199 | 199 | 'name' => (string) ($item->name ?: ''), |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | ]; |
| 206 | 206 | }; |
| 207 | 207 | } else { |
| 208 | - return function ($item) { |
|
| 208 | + return function($item) { |
|
| 209 | 209 | $searchName = str_replace(['.', '-'], ' ', $item->searchname ?? ''); |
| 210 | 210 | |
| 211 | 211 | return [ |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | }; |
| 222 | 222 | } |
| 223 | 223 | } else { // predb |
| 224 | - return function ($item) { |
|
| 224 | + return function($item) { |
|
| 225 | 225 | return [ |
| 226 | 226 | 'id' => $item->id, |
| 227 | 227 | 'title' => (string) ($item->title ?? ''), |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $engine = $this->getSelectedEngine(); |
| 47 | 47 | $index = $this->getSelectedIndex(); |
| 48 | 48 | |
| 49 | - if (! $engine || ! $index) { |
|
| 49 | + if (!$engine || !$index) { |
|
| 50 | 50 | $this->error('You must specify both an engine (--manticore or --elastic) and an index (--releases or --predb).'); |
| 51 | 51 | |
| 52 | 52 | return Command::FAILURE; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | private function populateIndexParallel(string $engine, string $index): int |
| 72 | 72 | { |
| 73 | 73 | $total = $this->getTotalRecords($index); |
| 74 | - if (! $total) { |
|
| 74 | + if (!$total) { |
|
| 75 | 75 | $this->warn("{$index} table is empty. Nothing to do."); |
| 76 | 76 | |
| 77 | 77 | return Command::SUCCESS; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | continue; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if (! $process->running()) { |
|
| 199 | + if (!$process->running()) { |
|
| 200 | 200 | $completedProcesses[] = $processId; |
| 201 | 201 | $completed++; |
| 202 | 202 | $bar->advance(); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $bar->finish(); |
| 235 | 235 | $this->newLine(); |
| 236 | 236 | |
| 237 | - if (! empty($failedProcesses)) { |
|
| 237 | + if (!empty($failedProcesses)) { |
|
| 238 | 238 | $this->error('Failed workers: '.implode(', ', $failedProcesses)); |
| 239 | 239 | } |
| 240 | 240 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $engine = $this->getSelectedEngine(); |
| 34 | 34 | $index = $this->getSelectedIndex(); |
| 35 | 35 | |
| 36 | - if (! $engine || ! $index) { |
|
| 36 | + if (!$engine || !$index) { |
|
| 37 | 37 | $this->error('You must specify both an engine (--manticore or --elastic) and an index (--releases or --predb).'); |
| 38 | 38 | |
| 39 | 39 | return Command::FAILURE; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | // Check if index exists |
| 66 | 66 | $exists = \Elasticsearch::indices()->exists(['index' => $index]); |
| 67 | 67 | |
| 68 | - if (! $exists) { |
|
| 68 | + if (!$exists) { |
|
| 69 | 69 | $this->error("ElasticSearch index '{$index}' does not exist."); |
| 70 | 70 | |
| 71 | 71 | return; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $this->info("\nTable structure:"); |
| 215 | 215 | $this->table( |
| 216 | 216 | ['Field', 'Type', 'Properties'], |
| 217 | - array_map(function ($row) { |
|
| 217 | + array_map(function($row) { |
|
| 218 | 218 | return [ |
| 219 | 219 | $row['Field'] ?? $row[0] ?? '', |
| 220 | 220 | $row['Type'] ?? $row[1] ?? '', |