@@ -151,7 +151,7 @@ |
||
| 151 | 151 | */ |
| 152 | 152 | public function hasPending(): bool |
| 153 | 153 | { |
| 154 | - return ! empty($this->parts); |
|
| 154 | + return !empty($this->parts); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | try { |
| 81 | - DB::transaction(static function () use ($groupId, $sql) { |
|
| 81 | + DB::transaction(static function() use ($groupId, $sql) { |
|
| 82 | 82 | DB::delete(rtrim($sql, ',').') AND groups_id = '.$groupId); |
| 83 | 83 | }, 10); |
| 84 | 84 | } catch (\Throwable $e) { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function cleanupExhaustedParts(int $groupId): void |
| 169 | 169 | { |
| 170 | - DB::transaction(function () use ($groupId) { |
|
| 170 | + DB::transaction(function() use ($groupId) { |
|
| 171 | 171 | DB::delete( |
| 172 | 172 | sprintf( |
| 173 | 173 | 'DELETE FROM missed_parts WHERE attempts >= %d AND groups_id = %d', |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | private function cleanupParts(): void |
| 133 | 133 | { |
| 134 | 134 | $numbers = $this->partHandler->getInsertedNumbers(); |
| 135 | - if (! empty($numbers)) { |
|
| 135 | + if (!empty($numbers)) { |
|
| 136 | 136 | $placeholders = implode(',', array_fill(0, \count($numbers), '?')); |
| 137 | 137 | DB::statement("DELETE FROM parts WHERE number IN ({$placeholders})", $numbers); |
| 138 | 138 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | private function cleanupBinaries(): void |
| 142 | 142 | { |
| 143 | 143 | $ids = $this->binaryHandler->getInsertedIds(); |
| 144 | - if (! empty($ids)) { |
|
| 144 | + if (!empty($ids)) { |
|
| 145 | 145 | $placeholders = implode(',', array_fill(0, \count($ids), '?')); |
| 146 | 146 | DB::statement("DELETE FROM binaries WHERE id IN ({$placeholders})", $ids); |
| 147 | 147 | } |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | $allIds = $this->collectionHandler->getAllIds(); |
| 154 | 154 | $hashes = $this->collectionHandler->getBatchHashes(); |
| 155 | 155 | |
| 156 | - $ids = ! empty($insertedIds) ? $insertedIds : $allIds; |
|
| 156 | + $ids = !empty($insertedIds) ? $insertedIds : $allIds; |
|
| 157 | 157 | |
| 158 | - if (! empty($ids)) { |
|
| 158 | + if (!empty($ids)) { |
|
| 159 | 159 | $placeholders = implode(',', array_fill(0, \count($ids), '?')); |
| 160 | 160 | |
| 161 | 161 | // Remove parts and binaries referencing these collections, then collections |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ); |
| 166 | 166 | DB::statement("DELETE FROM binaries WHERE collections_id IN ({$placeholders})", $ids); |
| 167 | 167 | DB::statement("DELETE FROM collections WHERE id IN ({$placeholders})", $ids); |
| 168 | - } elseif (! empty($hashes)) { |
|
| 168 | + } elseif (!empty($hashes)) { |
|
| 169 | 169 | $placeholders = implode(',', array_fill(0, \count($hashes), '?')); |
| 170 | 170 | |
| 171 | 171 | DB::statement( |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // Process each header |
| 74 | 74 | foreach ($headers as $header) { |
| 75 | - if (! $this->processHeader($header, $groupMySQL, $transaction)) { |
|
| 75 | + if (!$this->processHeader($header, $groupMySQL, $transaction)) { |
|
| 76 | 76 | if ($addToPartRepair && isset($header['Number'])) { |
| 77 | 77 | $this->failedInserts[] = $header['Number']; |
| 78 | 78 | } |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | // Flush remaining parts |
| 83 | 83 | if ($this->partHandler->hasPending()) { |
| 84 | - if (! $this->partHandler->flush()) { |
|
| 84 | + if (!$this->partHandler->flush()) { |
|
| 85 | 85 | $transaction->markError(); |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // Flush binary aggregate updates |
| 90 | - if (! $transaction->hasErrors()) { |
|
| 91 | - if (! $this->binaryHandler->flushUpdates($this->config->binariesUpdateChunkSize)) { |
|
| 90 | + if (!$transaction->hasErrors()) { |
|
| 91 | + if (!$this->binaryHandler->flushUpdates($this->config->binariesUpdateChunkSize)) { |
|
| 92 | 92 | $transaction->markError(); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // Finish transaction |
| 97 | - if (! $transaction->finish()) { |
|
| 97 | + if (!$transaction->finish()) { |
|
| 98 | 98 | // All failed |
| 99 | 99 | if ($addToPartRepair) { |
| 100 | 100 | return array_unique(array_merge( |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Add part |
| 156 | - if (! $this->partHandler->addPart($binaryId, $header)) { |
|
| 156 | + if (!$this->partHandler->addPart($binaryId, $header)) { |
|
| 157 | 157 | $transaction->markError(); |
| 158 | 158 | |
| 159 | 159 | return false; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | private function getFileCount(string $subject): array |
| 166 | 166 | { |
| 167 | - if (! preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])[\s$:]/i', $subject, $fileCount)) { |
|
| 167 | + if (!preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])[\s$:]/i', $subject, $fileCount)) { |
|
| 168 | 168 | $fileCount[1] = $fileCount[3] = 0; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -52,20 +52,20 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | foreach ($headers as $header) { |
| 54 | 54 | // Check if we got the article |
| 55 | - if (! isset($header['Number'])) { |
|
| 55 | + if (!isset($header['Number'])) { |
|
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // For part repair, only process missing parts |
| 60 | 60 | if ($partRepair && $missingParts !== null) { |
| 61 | - if (! \in_array($header['Number'], $missingParts, false)) { |
|
| 61 | + if (!\in_array($header['Number'], $missingParts, false)) { |
|
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | $headersRepaired[] = $header['Number']; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Parse subject to get base name and part/total like "(12/45)" |
| 68 | - if (! preg_match('/^\s*(?!"Usenet Index Post)(.+)\s+\((\d+)\/(\d+)\)/', $header['Subject'], $matches)) { |
|
| 68 | + if (!preg_match('/^\s*(?!"Usenet Index Post)(.+)\s+\((\d+)\/(\d+)\)/', $header['Subject'], $matches)) { |
|
| 69 | 69 | $this->notYEnc++; |
| 70 | 70 | |
| 71 | 71 | continue; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | public function flushBlacklistUpdates(): void |
| 111 | 111 | { |
| 112 | 112 | $ids = $this->blacklistService->getAndClearIdsToUpdate(); |
| 113 | - if (! empty($ids)) { |
|
| 113 | + if (!empty($ids)) { |
|
| 114 | 114 | $this->blacklistService->updateBlacklistUsage($ids); |
| 115 | 115 | } |
| 116 | 116 | } |