@@ -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] ?? '', |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | ): Invitation { |
| 23 | 23 | // Get the user sending the invitation |
| 24 | 24 | $user = User::find($invitedBy); |
| 25 | - if (! $user) { |
|
| 25 | + if (!$user) { |
|
| 26 | 26 | throw new \Exception('User not found.'); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $invitation = Invitation::findOrFail($invitationId); |
| 83 | 83 | |
| 84 | - if (! $invitation->isValid()) { |
|
| 84 | + if (!$invitation->isValid()) { |
|
| 85 | 85 | throw new \Exception('Cannot resend an invalid invitation.'); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $invitation = Invitation::findValidByToken($token); |
| 115 | 115 | |
| 116 | - if (! $invitation) { |
|
| 116 | + if (!$invitation) { |
|
| 117 | 117 | throw new \Exception('Invalid or expired invitation token.'); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | { |
| 198 | 198 | $invitation = Invitation::findByToken($token); |
| 199 | 199 | |
| 200 | - if (! $invitation) { |
|
| 200 | + if (!$invitation) { |
|
| 201 | 201 | return null; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | public function getUserInvitationDetails(int $userId): array |
| 219 | 219 | { |
| 220 | 220 | $user = User::find($userId); |
| 221 | - if (! $user) { |
|
| 221 | + if (!$user) { |
|
| 222 | 222 | return []; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -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 | /** |
@@ -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 | |
@@ -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 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | public function ensureMainTempPath(string $basePath, string $guidChar = '', string $groupID = ''): string |
| 15 | 15 | { |
| 16 | 16 | // Normalize separator at end |
| 17 | - if (! Str::endsWith($basePath, ['/', '\\'])) { |
|
| 17 | + if (!Str::endsWith($basePath, ['/', '\\'])) { |
|
| 18 | 18 | $basePath .= '/'; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | $basePath .= $guidChar.'/'; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if (! File::isDirectory($basePath)) { |
|
| 28 | - if (! File::makeDirectory($basePath, 0777, true, true) && ! File::isDirectory($basePath)) { |
|
| 27 | + if (!File::isDirectory($basePath)) { |
|
| 28 | + if (!File::makeDirectory($basePath, 0777, true, true) && !File::isDirectory($basePath)) { |
|
| 29 | 29 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $basePath)); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | public function createReleaseTempFolder(string $mainTmpPath, string $guid): string |
| 40 | 40 | { |
| 41 | 41 | $tmpPath = rtrim($mainTmpPath, '/\\').'/'.$guid.'/'; |
| 42 | - if (! File::isDirectory($tmpPath)) { |
|
| 43 | - if (! File::makeDirectory($tmpPath, 0777, true, false) && ! File::isDirectory($tmpPath)) { |
|
| 42 | + if (!File::isDirectory($tmpPath)) { |
|
| 43 | + if (!File::makeDirectory($tmpPath, 0777, true, false) && !File::isDirectory($tmpPath)) { |
|
| 44 | 44 | // Try again once in case of transient FS issues |
| 45 | - if (! File::makeDirectory($tmpPath, 0777, true, false) && ! File::isDirectory($tmpPath)) { |
|
| 45 | + if (!File::makeDirectory($tmpPath, 0777, true, false) && !File::isDirectory($tmpPath)) { |
|
| 46 | 46 | throw new \RuntimeException('Unable to create directory: '.$tmpPath); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function clearDirectory(string $path, bool $preserveRoot = true): void |
| 58 | 58 | { |
| 59 | - if ($path === '' || ! File::exists($path)) { |
|
| 59 | + if ($path === '' || !File::exists($path)) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | foreach (File::directories($path) as $dir) { |
| 70 | 70 | File::deleteDirectory($dir); |
| 71 | 71 | } |
| 72 | - if (! $preserveRoot) { |
|
| 72 | + if (!$preserveRoot) { |
|
| 73 | 73 | File::deleteDirectory($path); |
| 74 | 74 | } |
| 75 | 75 | } elseif (File::isFile($path)) { |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | public function analyze(string $compressedData): array |
| 16 | 16 | { |
| 17 | 17 | $ok = $this->archiveInfo->setData($compressedData, true); |
| 18 | - if (! $ok) { |
|
| 18 | + if (!$ok) { |
|
| 19 | 19 | return ['ok' => false, 'error' => $this->archiveInfo->error ?: 'Unknown error', 'summary' => null, 'is_encrypted' => false]; |
| 20 | 20 | } |
| 21 | 21 | if ($this->archiveInfo->error !== '') { |
| 22 | 22 | return ['ok' => false, 'error' => $this->archiveInfo->error, 'summary' => null, 'is_encrypted' => false]; |
| 23 | 23 | } |
| 24 | 24 | $summary = $this->archiveInfo->getSummary(true); |
| 25 | - $isEncrypted = ! empty($this->archiveInfo->isEncrypted) || (isset($summary['is_encrypted']) && (int) $summary['is_encrypted'] !== 0); |
|
| 25 | + $isEncrypted = !empty($this->archiveInfo->isEncrypted) || (isset($summary['is_encrypted']) && (int) $summary['is_encrypted'] !== 0); |
|
| 26 | 26 | |
| 27 | 27 | return ['ok' => true, 'error' => null, 'summary' => $summary, 'is_encrypted' => $isEncrypted]; |
| 28 | 28 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if (preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
| 58 | 58 | if ($numbers[3] > 0) { |
| 59 | 59 | $numbers[3]--; |
| 60 | - } elseif (! empty($numbers[1])) { |
|
| 60 | + } elseif (!empty($numbers[1])) { |
|
| 61 | 61 | $numbers[2]--; |
| 62 | 62 | $numbers[3] = '99'; |
| 63 | 63 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function createSampleImage(string $guid, string $fileLocation, string $tmpPath, bool $enabled, int $width = 800, int $height = 600): bool |
| 118 | 118 | { |
| 119 | - if (! $enabled) { |
|
| 119 | + if (!$enabled) { |
|
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | - if (! File::isFile($fileLocation)) { |
|
| 122 | + if (!File::isFile($fileLocation)) { |
|
| 123 | 123 | return false; |
| 124 | 124 | } |
| 125 | 125 | $fileName = ($tmpPath.'zzzz'.random_int(5, 12).random_int(5, 12).'.jpg'); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | - if (! File::isFile($fileName)) { |
|
| 138 | + if (!File::isFile($fileName)) { |
|
| 139 | 139 | return false; |
| 140 | 140 | } |
| 141 | 141 | $saved = $this->releaseImage->saveImage( |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | public function createVideoSample(string $guid, string $fileLocation, string $tmpPath, bool $enabled, int $durationSeconds): bool |
| 157 | 157 | { |
| 158 | - if (! $enabled) { |
|
| 158 | + if (!$enabled) { |
|
| 159 | 159 | return false; |
| 160 | 160 | } |
| 161 | - if (! File::isFile($fileLocation)) { |
|
| 161 | + if (!File::isFile($fileLocation)) { |
|
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | 164 | $fileName = ($tmpPath.'zzzz'.$guid.'.ogv'); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 197 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 198 | 198 | try { |
| 199 | 199 | $video = $this->ffmpeg->open($fileLocation); |
| 200 | 200 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($durationSeconds)); |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | - if (! File::isFile($fileName)) { |
|
| 211 | + if (!File::isFile($fileName)) { |
|
| 212 | 212 | return false; |
| 213 | 213 | } |
| 214 | 214 | $newFile = ($this->releaseImage->vidSavePath.$guid.'.ogv'); |
| 215 | - if (! @File::move($fileName, $newFile)) { |
|
| 215 | + if (!@File::move($fileName, $newFile)) { |
|
| 216 | 216 | $copied = @File::copy($fileName, $newFile); |
| 217 | 217 | File::delete($fileName); |
| 218 | - if (! $copied) { |
|
| 218 | + if (!$copied) { |
|
| 219 | 219 | return false; |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | public function addVideoMediaInfo(int $releaseId, string $fileLocation): bool |
| 229 | 229 | { |
| 230 | - if (! File::isFile($fileLocation)) { |
|
| 230 | + if (!File::isFile($fileLocation)) { |
|
| 231 | 231 | return false; |
| 232 | 232 | } |
| 233 | 233 | try { |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | string $audioSavePath |
| 253 | 253 | ): array { |
| 254 | 254 | // Mirror original behavior: defaults depend on flags, not file presence |
| 255 | - $retVal = ! $processAudioInfo ? true : false; |
|
| 256 | - $audVal = ! $processAudioSample ? true : false; |
|
| 255 | + $retVal = !$processAudioInfo ? true : false; |
|
| 256 | + $audVal = !$processAudioSample ? true : false; |
|
| 257 | 257 | |
| 258 | 258 | // Only proceed with file-dependent operations if file exists |
| 259 | 259 | if (File::isFile($fileLocation)) { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | if ($track->get('album') !== null && $track->get('performer') !== null) { |
| 266 | 266 | if ((int) $release->predb_id === 0 && config('nntmux.rename_music_mediainfo')) { |
| 267 | 267 | $ext = strtoupper($fileExtension); |
| 268 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 268 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 269 | 269 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
| 270 | 270 | } else { |
| 271 | 271 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |