From f3cde99e379b8e46d3bbf9abb316dbbafdb7763c Mon Sep 17 00:00:00 2001 From: DariusIII Date: Wed, 2 Dec 2020 10:55:09 +0100 Subject: [PATCH] Rename $match and variations to $hit for PHP 8 compatibility --- Blacklight/Binaries.php | 4 +- Blacklight/CollectionsCleaning.php | 8 +- Blacklight/Games.php | 4 +- Blacklight/IRCClient.php | 28 ++--- Blacklight/NNTP.php | 14 +-- Blacklight/NZB.php | 12 +- Blacklight/NZBGet.php | 4 +- Blacklight/NameFixer.php | 60 +++++----- Blacklight/Nfo.php | 12 +- Blacklight/Regexes.php | 22 ++-- Blacklight/ReleaseCleaning.php | 112 +++++++++--------- Blacklight/Sharing.php | 24 ++-- Blacklight/libraries/Forking.php | 8 +- Blacklight/processing/ProcessReleases.php | 4 +- Blacklight/processing/adult/ADE.php | 12 +- Blacklight/processing/adult/AEBN.php | 4 +- Blacklight/processing/adult/Popporn.php | 4 +- Blacklight/processing/post/AniDB.php | 24 ++-- app/Http/Controllers/AnimeController.php | 4 +- app/Http/Controllers/SeriesController.php | 4 +- app/Models/Settings.php | 8 +- misc/testing/PostProc/updateBookImages.php | 8 +- misc/testing/PostProc/updateConsoleImages.php | 8 +- misc/testing/PostProc/updateGamesImages.php | 8 +- misc/testing/PostProc/updateMovieImages.php | 8 +- misc/testing/PostProc/updateMusicImages.php | 8 +- misc/testing/PostProc/updateXXXImages.php | 8 +- misc/update/tmux/bin/groupfixrelnames.php | 8 +- 28 files changed, 216 insertions(+), 216 deletions(-) diff --git a/Blacklight/Binaries.php b/Blacklight/Binaries.php index 6819961ad..94675c967 100755 --- a/Blacklight/Binaries.php +++ b/Blacklight/Binaries.php @@ -795,8 +795,8 @@ class Binaries $tempHeaderXrefs = []; foreach (explode(' ', $this->header['Xref']) as $headerXref) { - if (preg_match('/(^[a-zA-Z]{2,3}\.(bin(aries|arios|aer))\.[a-zA-Z0-9]?.+)(\:\d+)/', $headerXref, $match) || preg_match('/(^[a-zA-Z]{2,3}\.(bin(aries|arios|aer))\.[a-zA-Z0-9]?.+)/', $headerXref, $match)) { - $tempHeaderXrefs[] = $match[0]; + if (preg_match('/(^[a-zA-Z]{2,3}\.(bin(aries|arios|aer))\.[a-zA-Z0-9]?.+)(\:\d+)/', $headerXref, $hit) || preg_match('/(^[a-zA-Z]{2,3}\.(bin(aries|arios|aer))\.[a-zA-Z0-9]?.+)/', $headerXref, $hit)) { + $tempHeaderXrefs[] = $hit[0]; } } diff --git a/Blacklight/CollectionsCleaning.php b/Blacklight/CollectionsCleaning.php index 42ec5b06b..63b7dd544 100755 --- a/Blacklight/CollectionsCleaning.php +++ b/Blacklight/CollectionsCleaning.php @@ -166,8 +166,8 @@ class CollectionsCleaning // If the subject is too similar to another because it is so short, try to extract info from the subject. if (\strlen($cleanSubject) <= 10 || preg_match('/^[\-a-z0-9$ ]{1,7}yEnc$/i', $cleanSubject)) { $x = ''; - if (preg_match('/.*("[A-Z0-9]+).*?"/i', $this->subject, $match)) { - $x = $match[1]; + if (preg_match('/.*("[A-Z0-9]+).*?"/i', $this->subject, $hit)) { + $x = $hit[1]; } if (preg_match_all('/[^A-Z0-9]/i', $this->subject, $match1)) { $start = 0; @@ -200,8 +200,8 @@ class CollectionsCleaning protected function musicSubject() { //Broderick_Smith-Unknown_Country-2009-404 "00-broderick_smith-unknown_country-2009.sfv" yEnc - if (preg_match('/^(\w{10,}-[a-zA-Z0-9]+ ")\d\d-.+?" yEnc$/', $this->subject, $match)) { - return $match[1]; + if (preg_match('/^(\w{10,}-[a-zA-Z0-9]+ ")\d\d-.+?" yEnc$/', $this->subject, $hit)) { + return $hit[1]; } return false; diff --git a/Blacklight/Games.php b/Blacklight/Games.php index d888d6e2d..71a856dc7 100755 --- a/Blacklight/Games.php +++ b/Blacklight/Games.php @@ -836,10 +836,10 @@ class Games { // Get name of the game from name of release. - if (preg_match(self::GAMES_TITLE_PARSE_REGEX, preg_replace('/\sMulti\d?\s/i', '', $releaseName), $matches)) { + if (preg_match(self::GAMES_TITLE_PARSE_REGEX, preg_replace('/\sMulti\d?\s/i', '', $releaseName), $hits)) { // Replace dots, underscores, colons, or brackets with spaces. $result = []; - $result['title'] = str_replace(' RF ', ' ', preg_replace('/(\-|\:|\.|_|\%20|\[|\])/', ' ', $matches['title'])); + $result['title'] = str_replace(' RF ', ' ', preg_replace('/(\-|\:|\.|_|\%20|\[|\])/', ' ', $hits['title'])); // Replace any foreign words at the end of the release $result['title'] = preg_replace('/(brazilian|chinese|croatian|danish|deutsch|dutch|english|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|latin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)$/i', '', $result['title']); // Remove PC ISO) ( from the beginning bad regex from Games category? diff --git a/Blacklight/IRCClient.php b/Blacklight/IRCClient.php index 069d0f88a..9c89dc1b7 100755 --- a/Blacklight/IRCClient.php +++ b/Blacklight/IRCClient.php @@ -340,18 +340,18 @@ class IRCClient $this->_readSocket(); // We got pinged, reply with a pong. - if (preg_match('/^PING\s*:(.+?)$/', $this->_buffer, $matches)) { - $this->_pong($matches[1]); - } elseif (preg_match('/^:(.*?)\s+(\d+).*?(:.+?)?$/', $this->_buffer, $matches)) { + if (preg_match('/^PING\s*:(.+?)$/', $this->_buffer, $hits)) { + $this->_pong($hits[1]); + } elseif (preg_match('/^:(.*?)\s+(\d+).*?(:.+?)?$/', $this->_buffer, $hits)) { // We found 001, which means we are logged in. - if ((int) $matches[2] === 1) { - $this->_remote_host_received = $matches[1]; + if ((int) $hits[2] === 1) { + $this->_remote_host_received = $hits[1]; break; // We got 464, which means we need to send a password. } - if ((int) $matches[2] === 464) { + if ((int) $hits[2] === 464) { // Before the lower check, set the password : username:password $tempPass = $userName.':'.$password; @@ -364,7 +364,7 @@ class IRCClient return false; } - if (isset($matches[3]) && stripos($matches[3], 'invalid password') !== false) { + if (isset($hits[3]) && stripos($hits[3], 'invalid password') !== false) { echo 'Invalid password or username for ('.$this->_remote_host.').'; return false; @@ -407,23 +407,23 @@ class IRCClient $this->_readSocket(); // If the server pings us, return it a pong. - if (preg_match('/^PING\s*:(.+?)$/', $this->_buffer, $matches)) { - if ($matches[1] === $this->_remote_host_received) { - $this->_pong($matches[1]); + if (preg_match('/^PING\s*:(.+?)$/', $this->_buffer, $hits)) { + if ($hits[1] === $this->_remote_host_received) { + $this->_pong($hits[1]); } // Check for a channel message. } elseif (preg_match( '/^:(?P.+?)\!.+?\s+PRIVMSG\s+(?P#.+?)\s+:\s*(?P.+?)\s*$/', $this->_stripControlCharacters($this->_buffer), - $matches + $hits ) ) { $this->_channelData = [ - 'nickname' => $matches['nickname'], - 'channel' => $matches['channel'], - 'message' => $matches['message'], + 'nickname' => $hits['nickname'], + 'channel' => $hits['channel'], + 'message' => $hits['message'], ]; $this->processChannelMessages(); diff --git a/Blacklight/NNTP.php b/Blacklight/NNTP.php index 387fdae2a..5db71e614 100755 --- a/Blacklight/NNTP.php +++ b/Blacklight/NNTP.php @@ -672,12 +672,12 @@ class NNTP extends \Net_NNTP_Client } // Use the line type of the article as the array key (From, Subject, etc..). - if (preg_match('/([A-Z-]+?): (.*)/i', $line, $matches)) { + if (preg_match('/([A-Z-]+?): (.*)/i', $line, $hits)) { // If the line type takes more than 1 line, append the rest of the content to the same key. - if (array_key_exists($matches[1], $ret)) { - $ret[$matches[1]] .= $matches[2]; + if (array_key_exists($hits[1], $ret)) { + $ret[$hits[1]] .= $hits[2]; } else { - $ret[$matches[1]] = $matches[2]; + $ret[$hits[1]] = $hits[2]; } } @@ -739,10 +739,10 @@ class NNTP extends \Net_NNTP_Client $ret = []; // Use the line types of the header as array keys (From, Subject, etc). foreach ($header as $line) { - if (preg_match('/([A-Z-]+?): (.*)/i', $line, $matches)) { + if (preg_match('/([A-Z-]+?): (.*)/i', $line, $hits)) { // If the line type takes more than 1 line, re-use the same array key. - if (array_key_exists($matches[1], $ret)) { - $ret[$matches[1]] .= $matches[2]; + if (array_key_exists($hits[1], $ret)) { + $ret[$hits[1]] .= $matches[2]; } else { $ret[$matches[1]] = $matches[2]; } diff --git a/Blacklight/NZB.php b/Blacklight/NZB.php index bd0adb4d1..68914ad68 100755 --- a/Blacklight/NZB.php +++ b/Blacklight/NZB.php @@ -186,14 +186,14 @@ class NZB $XMLWriter->writeAttribute('date', $collection->udate); $XMLWriter->writeAttribute('subject', $subject); $XMLWriter->startElement('groups'); - if (preg_match_all('#(\S+):\S+#', $collection->xref, $matches)) { - $matches = array_values(array_unique($matches[1])); - foreach ($matches as $group) { + if (preg_match_all('#(\S+):\S+#', $collection->xref, $hits)) { + $hits = array_values(array_unique($hits[1])); + foreach ($hits as $group) { $XMLWriter->writeElement('group', $group); } - } elseif (preg_match_all('#(\S+)#', $collection->xref, $matches)) { - $matches = array_values(array_unique($matches[1])); - foreach ($matches as $group) { + } elseif (preg_match_all('#(\S+)#', $collection->xref, $hits)) { + $hits = array_values(array_unique($hits[1])); + foreach ($hits as $group) { $XMLWriter->writeElement('group', $group); } } else { diff --git a/Blacklight/NZBGet.php b/Blacklight/NZBGet.php index 4248a26bf..f7b9cd705 100755 --- a/Blacklight/NZBGet.php +++ b/Blacklight/NZBGet.php @@ -411,8 +411,8 @@ class NZBGet */ public function verifyURL($url) { - if (preg_match('/(?Phttps?):\/\/(?P.+?)(:(?P\d+\/)|\/)$/i', $url, $matches)) { - return $matches['protocol'].'://'.$this->userName.':'.$this->password.'@'.$matches['url'].(isset($matches['port']) ? ':'.$matches['port'] : (substr($matches['url'], -1) === '/' ? '' : '/')).'xmlrpc/'; + if (preg_match('/(?Phttps?):\/\/(?P.+?)(:(?P\d+\/)|\/)$/i', $url, $hits)) { + return $hits['protocol'].'://'.$this->userName.':'.$this->password.'@'.$hits['url'].(isset($hits['port']) ? ':'.$hits['port'] : (substr($hits['url'], -1) === '/' ? '' : '/')).'xmlrpc/'; } return false; diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php index bfdc18cff..845d7e730 100755 --- a/Blacklight/NameFixer.php +++ b/Blacklight/NameFixer.php @@ -927,8 +927,8 @@ class NameFixer if ($type === 'PAR2, ') { $newName = ucwords($newName); - if (preg_match('/(.+?)\.[a-z0-9]{2,3}(PAR2)?$/i', $name, $match)) { - $newName = $match[1]; + if (preg_match('/(.+?)\.[a-z0-9]{2,3}(PAR2)?$/i', $name, $hit)) { + $newName = $hit[1]; } } @@ -1454,10 +1454,10 @@ class NameFixer $total = \count($res); $this->consoletools->primary(number_format($total).' releases to process.'); foreach ($res as $row) { - if (preg_match('/[a-fA-F0-9]{32,40}/i', $row->name, $matches)) { - $updated += $this->matchPredbHash($matches[0], $row, $echo, $nameStatus, $show); - } elseif (preg_match('/[a-fA-F0-9]{32,40}/i', $row->filename, $matches)) { - $updated += $this->matchPredbHash($matches[0], $row, $echo, $nameStatus, $show); + if (preg_match('/[a-fA-F0-9]{32,40}/i', $row->name, $hits)) { + $updated += $this->matchPredbHash($hits[0], $row, $echo, $nameStatus, $show); + } elseif (preg_match('/[a-fA-F0-9]{32,40}/i', $row->filename, $hits)) { + $updated += $this->matchPredbHash($hits[0], $row, $echo, $nameStatus, $show); } if ($show === 2) { $this->consoletools->overWritePrimary('Renamed Releases: ['.number_format($updated).'] '.$this->consoletools->percentString($checked++, $total)); @@ -1488,9 +1488,9 @@ class NameFixer public function checkName($release, $echo, $type, $nameStatus, $show, $preid = false): bool { // Get pre style name from releases.name - if (preg_match_all(self::PREDB_REGEX, $release->textstring, $matches) && ! preg_match('/Source\s\:/i', $release->textstring)) { - foreach ($matches as $match) { - foreach ($match as $val) { + if (preg_match_all(self::PREDB_REGEX, $release->textstring, $hits) && ! preg_match('/Source\s\:/i', $release->textstring)) { + foreach ($hits as $hit) { + foreach ($hit as $val) { $title = Predb::query()->where('title', trim($val))->select(['title', 'id'])->first(); if ($title !== null) { $this->updateRelease($release, $title['title'], 'preDB: Match', $echo, $type, $nameStatus, $show, $title['id']); @@ -2192,12 +2192,12 @@ class NameFixer { $newName = ''; if (! $this->done && $this->relid !== (int) $release->releases_id) { - if (preg_match('/(.+)<\/Movie_name>/i', $release->mediainfo, $match)) { - $media = $match[1]; - if (preg_match(self::PREDB_REGEX, $media, $match)) { - $newName = $match[1]; - } elseif (preg_match('/(.+)[\,](\sRMZ\.cr)?$/i', $media, $match)) { - $newName = $match[1]; + if (preg_match('/(.+)<\/Movie_name>/i', $release->mediainfo, $hit)) { + $media = $hit[1]; + if (preg_match(self::PREDB_REGEX, $media, $hit)) { + $newName = $hit[1]; + } elseif (preg_match('/(.+)[\,](\sRMZ\.cr)?$/i', $media, $hit)) { + $newName = $hit[1]; } else { $newName = $media; } @@ -2247,10 +2247,10 @@ class NameFixer ); foreach ($result as $res) { - if (preg_match('/^.+?SDPORN/i', $res->textstring, $match)) { + if (preg_match('/^.+?SDPORN/i', $res->textstring, $hit)) { $this->updateRelease( $release, - $match['0'], + $hit['0'], 'fileCheck: XXX SDPORN', $echo, $type, @@ -2300,10 +2300,10 @@ class NameFixer ); foreach ($result as $res) { - if (preg_match('/^(.*)\.srr$/i', $res->textstring, $match)) { + if (preg_match('/^(.*)\.srr$/i', $res->textstring, $hit)) { $this->updateRelease( $release, - $match['1'], + $hit['1'], 'fileCheck: SRR extension', $echo, $type, @@ -2438,9 +2438,9 @@ class NameFixer */ private function preMatch($fileName): array { - $result = preg_match('/(\d{2}\.\d{2}\.\d{2})+([\w\-.]+[\w]$)/i', $fileName, $match); + $result = preg_match('/(\d{2}\.\d{2}\.\d{2})+([\w\-.]+[\w]$)/i', $fileName, $hit); - return [$result === 1, $match[0] ?? '']; + return [$result === 1, $hit[0] ?? '']; } /** @@ -2460,17 +2460,17 @@ class NameFixer if (! empty($this->_fileName)) { if (config('nntmux.elasticsearch_enabled') === true) { $results = $this->elasticsearch->searchPreDb($this->_fileName); - foreach ($results as $match) { - if (! empty($match)) { - $this->updateRelease($release, $match['title'], 'PreDb: Filename match', $echo, $type, $nameStatus, $show, $match['id']); + foreach ($results as $hit) { + if (! empty($hit)) { + $this->updateRelease($release, $hit['title'], 'PreDb: Filename match', $echo, $type, $nameStatus, $show, $hit['id']); return true; } } } else { - foreach ($this->sphinx->searchIndexes('predb_rt', $this->_fileName, ['filename', 'title']) as $match) { - if (! empty($match)) { - $this->updateRelease($release, $match['title'], 'PreDb: Filename match', $echo, $type, $nameStatus, $show, $match['id']); + foreach ($this->sphinx->searchIndexes('predb_rt', $this->_fileName, ['filename', 'title']) as $hit) { + if (! empty($hit)) { + $this->updateRelease($release, $hit['title'], 'PreDb: Filename match', $echo, $type, $nameStatus, $show, $hit['id']); return true; } @@ -2498,9 +2498,9 @@ class NameFixer if (! empty($this->_fileName)) { if (config('nntmux.elasticsearch_enabled') === true) { $results = $this->elasticsearch->searchPreDb($this->_fileName); - foreach ($results as $match) { - if (! empty($match)) { - $this->updateRelease($release, $match['title'], 'PreDb: Title match', $echo, $type, $nameStatus, $show, $match['id']); + foreach ($results as $hit) { + if (! empty($hit)) { + $this->updateRelease($release, $hit['title'], 'PreDb: Title match', $echo, $type, $nameStatus, $show, $hit['id']); return true; } diff --git a/Blacklight/Nfo.php b/Blacklight/Nfo.php index 1fb58cffa..955b4b31c 100755 --- a/Blacklight/Nfo.php +++ b/Blacklight/Nfo.php @@ -90,26 +90,26 @@ class Nfo { $return = false; - if (preg_match('/tvmaze\.com\/shows\/(\d{1,6})/i', $str, $matches)) { + if (preg_match('/tvmaze\.com\/shows\/(\d{1,6})/i', $str, $hits)) { $return = [ - 'showid' => trim($matches[1]), + 'showid' => trim($hits[1]), 'site' => 'tvmaze', ]; } - if (preg_match('/imdb\.com\/title\/(tt\d{1,8})/i', $str, $matches)) { + if (preg_match('/imdb\.com\/title\/(tt\d{1,8})/i', $str, $hits)) { $return = [ - 'showid' => trim($matches[1]), + 'showid' => trim($hits[1]), 'site' => 'imdb', ]; } - if (preg_match('/thetvdb\.com\/\?tab=series&id=(\d{1,8})/i', $str, $matches)) { + if (preg_match('/thetvdb\.com\/\?tab=series&id=(\d{1,8})/i', $str, $hits)) { $return = [ - 'showid' => trim($matches[1]), + 'showid' => trim($hits[1]), 'site' => 'thetvdb', ]; } diff --git a/Blacklight/Regexes.php b/Blacklight/Regexes.php index 287ad0267..24b571cf9 100755 --- a/Blacklight/Regexes.php +++ b/Blacklight/Regexes.php @@ -205,13 +205,13 @@ class Regexes $limit--; $hashes = []; foreach ($rows as $row) { - if (preg_match($regex, $row->name, $matches)) { - ksort($matches); + if (preg_match($regex, $row->name, $hits)) { + ksort($hits); $string = $string2 = ''; - foreach ($matches as $key => $match) { + foreach ($hits as $key => $hit) { if (! \is_int($key)) { - $string .= $match; - $string2 .= '
'.$key.': '.$match; + $string .= $hit; + $string2 .= '
'.$key.': '.$hit; } } $files = 0; @@ -268,12 +268,12 @@ class Regexes if ($rows !== null) { $limit = 1; foreach ($rows as $row) { - $match = $this->_matchRegex($regex, $row['name']); - if ($match) { + $hit = $this->_matchRegex($regex, $row['name']); + if ($hit) { $data[$row['id']] = [ 'subject' => $row['name'], 'old_name' => $row['searchname'], - 'new_name' => $match, + 'new_name' => $hit, ]; if ((int) $displayLimit > 0 && $limit++ >= (int) $displayLimit) { break; @@ -360,10 +360,10 @@ class Regexes protected function _matchRegex($regex, $subject): string { $returnString = ''; - if (preg_match($regex, $subject, $matches) && \count($matches) > 0) { + if (preg_match($regex, $subject, $hits) && \count($hits) > 0) { // Sort the keys, the named key matches will be concatenated in this order. - ksort($matches); - foreach ($matches as $key => $value) { + ksort($hits); + foreach ($hits as $key => $value) { switch ($this->tableName) { case 'collection_regexes': // Put this at the top since it's the most important for performance. case 'release_naming_regexes': diff --git a/Blacklight/ReleaseCleaning.php b/Blacklight/ReleaseCleaning.php index f3d31ec2a..fd55fc79f 100755 --- a/Blacklight/ReleaseCleaning.php +++ b/Blacklight/ReleaseCleaning.php @@ -100,18 +100,18 @@ class ReleaseCleaning */ public function releaseCleaner($subject, $fromName, $groupName, $usePre = false) { - $match = $matches = []; + $hit = $hits = []; // Get pre style name from releases.name if (preg_match_all( '/([\w\(\)]+[\s\._-]([\w\(\)]+[\s\._-])+[\w\(\)]+-\w+)/', $subject, - $matches + $hits )) { - foreach ($matches as $match) { - foreach ($match as $val) { + foreach ($hits as $hit) { + foreach ($hit as $val) { $title = Predb::query()->where('title', trim($val))->first(['title', 'id']); // don't match against ab.teevee if title is for just the season - if (! empty($title) && $groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $match)) { + if (! empty($title) && $groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $hit)) { $title = null; } if ($title !== null) { @@ -127,12 +127,12 @@ class ReleaseCleaning } } // Get pre style name from requestid - if (preg_match('/^\[ ?(\d{4,6}) ?\]/', $subject, $match) || - preg_match('/^REQ\s*(\d{4,6})/i', $subject, $match) || - preg_match('/^(\d{4,6})-\d{1}\[/', $subject, $match) || - preg_match('/(\d{4,6}) -/', $subject, $match) + if (preg_match('/^\[ ?(\d{4,6}) ?\]/', $subject, $hit) || + preg_match('/^REQ\s*(\d{4,6})/i', $subject, $hit) || + preg_match('/^(\d{4,6})-\d{1}\[/', $subject, $hit) || + preg_match('/(\d{4,6}) -/', $subject, $hit) ) { - $title = Predb::query()->where(['predb.requestid'=> $match[1], 'g.name' => $groupName])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); + $title = Predb::query()->where(['predb.requestid'=> $hit[1], 'g.name' => $groupName])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); //check for predb title matches against other groups where it matches relative size / fromname //known crossposted requests only atm $reqGname = ''; @@ -156,10 +156,10 @@ class ReleaseCleaning break; } if ($title === null && ! empty($reqGname)) { - $title = Predb::query()->where(['predb.requestid'=> $match[1], 'g.name' => $reqGname])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); + $title = Predb::query()->where(['predb.requestid'=> $hit[1], 'g.name' => $reqGname])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); } // don't match against ab.teevee if title is for just the season - if ($groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $match)) { + if ($groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $hit)) { $title = null; } if ($title !== null) { @@ -225,172 +225,172 @@ class ReleaseCleaning // >> www.ssl-news.info <<< > [05/87] - "Deep.Black.Ass.5.XXX.1080p.WEBRip.x264-TBP.part03.rar" - 7,87 GB yEnc // [02/24] - "Dragons.Den.UK.S11E02.HDTV.x264-ANGELiC.nfo" - 288,96 MB yEnc // [6/6] - "TTT.Magazine.2013.08.vol0+1.par2" - 33,47 MB yEnc - if (preg_match('/^.+?town\.ag.+?(www\..+?|News)\.[iI]nfo.+? \[\d+\/\d+\]( -)? "(.+?)(-sample)?'.$this->e0.' - \d+[.,]\d+ [kKmMgG][bB]M? yEnc$/', $this->subject, $match)) { - return $match[3]; + if (preg_match('/^.+?town\.ag.+?(www\..+?|News)\.[iI]nfo.+? \[\d+\/\d+\]( -)? "(.+?)(-sample)?'.$this->e0.' - \d+[.,]\d+ [kKmMgG][bB]M? yEnc$/', $this->subject, $hit)) { + return $hit[3]; } //[ TOWN ]-[ www.town.ag ]-[ partner of www.ssl-news.info ]-[ 1080p ] - [320/352] - "Gq7YGEWLy8wAA2NhbZx5LukEa.vol000+5.par2" - 17.09 GB yEnc - if (preg_match('/^\[\s*TOWN\s*\][\-_\s]{0,3}\[\s*www\.town\.ag\s*\][\-_\s]{0,3}\[\s*partner of www\.ssl-news\.info\s*\][\-_\s]{0,3}\[\s* .*\s*\][\-_\s]{0,3}\[\d+\/\d+\][\-_\s]{0,4}"([\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}#-]{8,}?\b.?)'.$this->e2, $this->subject, $match)) { - return $match[1]; + if (preg_match('/^\[\s*TOWN\s*\][\-_\s]{0,3}\[\s*www\.town\.ag\s*\][\-_\s]{0,3}\[\s*partner of www\.ssl-news\.info\s*\][\-_\s]{0,3}\[\s* .*\s*\][\-_\s]{0,3}\[\d+\/\d+\][\-_\s]{0,4}"([\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}#-]{8,}?\b.?)'.$this->e2, $this->subject, $hit)) { + return $hit[1]; } // >> www.ssl-news.info <<< >IP Scanner Pro 3.21-Sebaro - [1/3] - "IP Scanner Pro 3.21-Sebaro.rar" yEnc if (preg_match( '/^.+?town\.ag.+?(www\..+?|News)\.[iI]nfo.+? \[\d+\/\d+\]( -)? "(.+?)(-sample)?'. $this->e1, $this->subject, - $match + $hit ) ) { - return $match[3]; + return $hit[3]; } //(05/10) - - "D.Olivier.Wer Boeses.saet-gsx-.part4.rar" - 741,51 kB - yEnc if (preg_match( '/^\(\d+\/\d+\) -\s+ - ("|#34;)([\w. ()-]{8,}?\b)(\.par2|-\.part\d+\.rar|\.nfo)("|#34;) - \d+[.,]\d+ [kKmMgG][bB]( -)? yEnc$/', $this->subject, - $match + $hit ) ) { - return $match[2]; + return $hit[2]; } //[ TOWN ]-[ www.town.ag ]-[ partner of www.ssl-news.info ]-[ MOVIE ] [14/19] - "Night.Vision.2011.DVDRip.x264-IGUANA.part12.rar" - 660,80 MB yEnc if (preg_match( '/^\[ TOWN \][ _-]{0,3}\[ www\.town\.ag \][ _-]{0,3}\[ partner of www\.ssl-news\.info \][ _-]{0,3}\[ .* \] \[\d+\/\d+\][ _-]{0,3}("|#34;)(.+)((\.part\d+\.rar)|(\.vol\d+\+\d+\.par2))("|#34;)[ _-]{0,3}\d+[.,]\d+ [kKmMgG][bB][ _-]{0,3}yEnc$/i', $this->subject, - $match + $hit ) ) { - return $match[2]; + return $hit[2]; } //[ TOWN ]-[ www.town.ag ]-[ partner of www.ssl-news.info ]-[ MOVIE ] [01/84] - "The.Butterfly.Effect.2.2006.1080p.BluRay.x264-LCHD.par2" - 7,49 GB yEnc if (preg_match( '/^\[ TOWN \][ _-]{0,3}\[ www\.town\.ag \][ _-]{0,3}\[ partner of www\.ssl-news\.info \][ _-]{0,3}\[ .* \] \[\d+\/\d+\][ _-]{0,3}("|#34;)(.+)\.(par2|rar|nfo|nzb)("|#34;)[ _-]{0,3}\d+[.,]\d+ [kKmMgG][bB][ _-]{0,3}yEnc$/i', $this->subject, - $match + $hit ) ) { - return $match[2]; + return $hit[2]; } //[ TOWN ]-[ www.town.ag ]-[ partner of www.ssl-news.info ] [22/22] - "Arsenio.Hall.2013.09.11.Magic.Johnson.720p.HDTV.x264-2HD.vol31+11.par2" - 1,45 GB yEnc if (preg_match( '/^\[ TOWN \][ _-]{0,3}\[ www\.town\.ag \][ _-]{0,3}\[ partner of www\.ssl-news\.info \][ _-]{0,3}(\[ TV \] )?\[\d+\/\d+\][ _-]{0,3}("|#34;)(.+)((\.part\d+\.rar)|(\.vol\d+\+\d+\.par2)|\.nfo|\.vol\d+\+\.par2)("|#34;)[ _-]{0,3}\d+[.,]\d+ [kKmMgG][bB][ _-]{0,3}yEnc$/i', $this->subject, - $match + $hit ) ) { - return $match[3]; + return $hit[3]; } //[ TOWN ]-[ www.town.ag ]-[ partner of www.ssl-news.info ] [01/28] - "Arsenio.Hall.2013.09.18.Dr.Phil.McGraw.HDTV.x264-2HD.par2" - 352,58 MB yEnc if (preg_match( '/^\[ TOWN \][ _-]{0,3}\[ www\.town\.ag \][ _-]{0,3}\[ partner of www\.ssl-news\.info \][ _-]{0,3}(\[ TV \] )?\[\d+\/\d+\][ _-]{0,3}("|#34;)(.+)\.par2("|#34;)[ _-]{0,3}\d+[.,]\d+ [kKmMgG][bB][ _-]{0,3}yEnc$/i', $this->subject, - $match + $hit ) ) { - return $match[3]; + return $hit[3]; } //4675.-.Wedding.Planner.multi3.(EU) [01/10] - "4675.-.Wedding.Planner.multi3.(EU).par2" - 72,80 MB - yEnc if (preg_match( '/^\d+\.-\.(.+) \s+\s+<.+>\s+\[\d+\/\d+\] - ("|#34;).+("|#34;).+yEnc$/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } //4675.-.Wedding.Planner.multi3.(EU) [01/10] - "4675.-.Wedding.Planner.multi3.(EU).par2" - 72,80 MB - yEnc // Some have no yEnc if (preg_match( '/^\d+\.-\.(.+) \s+\s+<.+>\s+\[\d+\/\d+\] - ("|#34;).+/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } //Marco.Fehr.-.In.the.Mix.at.Der.Club-09-01-SAT-2012-XDS [01/13] - "Marco.Fehr.-.In.the.Mix.at.Der.Club-09-01-SAT-2012-XDS.par2" - 92,12 MB - yEnc if (preg_match( '/^(\w.+) \s+\s+\[\d+\/\d+\] - ("|#34;).+("|#34;).+yEnc$/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } //Marco.Fehr.-.In.the.Mix.at.Der.Club-09-01-SAT-2012-XDS [01/13] - "Marco.Fehr.-.In.the.Mix.at.Der.Club-09-01-SAT-2012-XDS.par2" - 92,12 MB - yEnc // Some have no yEnc if (preg_match( '/^(\w.+) \s+\s+\[\d+\/\d+\] - ("|#34;).+/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } // JetBrains.IntelliJ.IDEA.v11.1.4.Ultimate.Edition.MacOSX.Incl.Keymaker-EMBRACE [01/18] - "JetBrains.IntelliJ.IDEA.v11.1.4.Ultimate.Edition.MacOSX.Incl.Keymaker-EMBRACE.par2" - 200,77 MB - yEnc if (preg_match( '/^\s+\s+(.+)\s+\[\d+\/\d+\] - ("|#34;).+("|#34;).+yEnc$/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } // JetBrains.IntelliJ.IDEA.v11.1.4.Ultimate.Edition.MacOSX.Incl.Keymaker-EMBRACE [01/18] - "JetBrains.IntelliJ.IDEA.v11.1.4.Ultimate.Edition.MacOSX.Incl.Keymaker-EMBRACE.par2" - 200,77 MB - yEnc // Some have no yEnc if (preg_match( '/^\s+\s+(.+)\s+\[\d+\/\d+\] - ("|#34;).+/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } // [01/18] - "2012-11.-.Supurbia.-.Volume.Tw o.Digital-1920.K6-Empire.par2" - 421,98 MB yEnc if (preg_match( '/^[ <\[]{0,2}TOWN[ >\]]{0,2}[ _-]{0,3}[ <\[]{0,2}www\.town\.ag[ >\]]{0,2}[ _-]{0,3}[ <\[]{0,2}partner of www.ssl-news\.info[ >\]]{0,2}[ _-]{0,3}\[\d+\/\d+\][ _-]{0,3}("|#34;)(.+)\.(par|vol|rar|nfo).*?("|#34;).+?yEnc$/i', $this->subject, - $match + $hit ) ) { - return $match[2]; + return $hit[2]; } // www.town.ag > sponsored by www.ssl-news.info > (1/3) "HolzWerken_40.par2" - 43,89 MB - yEnc if (preg_match( '/^ www\.town\.ag > sponsored by www\.ssl-news\.info > \(\d+\/\d+\) "([\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}#-]{8,}?\b.?)'. $this->e0.' - \d+[,.]\d+ [mMkKgG][bB] - yEnc$/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } //(1/9)<<>> sponsored by ssl-news.info<<<[HorribleSubs]_AIURA_-_01_[480p].mkv "[HorribleSubs]_AIURA_-_01_[480p].par2" yEnc if (preg_match( '/^\(\d+\/\d+\).+?www\.town\.ag.+?sponsored by (www\.)?ssl-news\.info<+?.+? "([\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}#-]{8,}?\b.?)'. $this->e1, $this->subject, - $match + $hit ) ) { - return $match[2]; + return $hit[2]; } //[ TOWN ]-[ www.town.ag ]-[ Assassins.Creed.IV.Black.Flag.XBOX360-COMPLEX ]-[ partner of www.ssl-news.info ] [074/195]- "complex-ac4.bf.d1.r71" yEnc if (preg_match( '/^\[ TOWN \][ _-]{0,3}\[ www\.town\.ag \][ _-]{0,3}\[ (.+?) \][ _-]{0,3}\[ partner of www\.ssl-news\.info \][ _-]{0,3}\[\d+\/(\d+\])[ _-]{0,3}"(.+)(\.part\d*|\.rar)?(\.vol.+ \(\d+\/\d+\) "|\.[A-Za-z0-9]{2,4}")[ _-]{0,3}yEnc$/i', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } //(TOWN)(www.town.ag ) (partner of www.ssl-news.info ) Twinz-Conversation-CD-FLAC-1995-CUSTODES [01/23] - #34;Twinz-Conversation-CD-FLAC-1995-CUSTODES.par2#34; - 266,00 MB - yEnc if (preg_match( '/^\(TOWN\)\(www\.town\.ag \)[ _-]{0,3}\(partner of www\.ssl-news\.info \)[ _-]{0,3} (.+?) \[\d+\/(\d+\][ _-]{0,3}("|#34;).+?)\.(par2|rar|nfo|nzb)("|#34;)[ _-]{0,3}\d+[.,]\d+ [kKmMgG][bB][ _-]{0,3}yEnc$/', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } // Greek.S04E06.Katerstimmung.German.DL.Dubbed.WEB-DL.XviD-GEZ [01/22] - "Greek.S04E06.Katerstimmung.German.DL.Dubbed.WEB-DL.XviD-GEZ.par2" - 526,99 MB - yEnc if (preg_match( '/^ (.+) \[\d+\/\d+\][ _-]{0,3}("|#34;).+?("|#34;).+?yEnc$/i', $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } //[ TOWN ]-[ www.town.ag ]-[ ANIME ] [01/17] - "[Chyuu] Nanatsu no Taizai - 12 [720p][D1F49539].par2" - 585,03 MB yEnc if (preg_match( '/^\[ TOWN \][ _-]{0,3}\[ www\.town\.ag \][ _-]{0,3}\[ .* \][ _-]{0,3}\[\d+\/\d+\][ _-]{0,3}"([\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}#-]{8,}?\b.?)'.$this->e2, $this->subject, - $match + $hit ) ) { - return $match[1]; + return $hit[1]; } return [ @@ -410,10 +410,10 @@ class ReleaseCleaning if (preg_match( '/^\[\d+\][\-_\s]{0,3}(\[(reup|full|repost.+?|part|re-repost|xtr|sample)(\])?[\-_\s]{0,3}\[[\- #@\.\w]+\][\-_\s]{0,3}|\[[\- #@\.\w]+\][\-_\s]{0,3}\[(reup|full|repost.+?|part|re-repost|xtr|sample)(\])?[\-_\s]{0,3}|\[.+?efnet\][\-_\s]{0,3}|\[(reup|full|repost.+?|part|re-repost|xtr|sample)(\])?[\-_\s]{0,3})(\[FULL\])?[\-_\s]{0,3}(\[ )?(\[)? ?(\/sz\/)?(F: - )?(?P[\- _!@\.\'\w\(\)~]{10,}) ?(\])?[\-_\s]{0,3}(\[)? ?(REPOST|REPACK|SCENE|EXTRA PARS|REAL)? ?(\])?[\-_\s]{0,3}?(\[\d+[\-\/~]\d+\])?[\-_\s]{0,3}["|#34;]*.+["|#34;]* ?[yEnc]{0,4}/i', $this->subject, - $match + $hit ) ) { - return $match['title']; + return $hit['title']; } return [ diff --git a/Blacklight/Sharing.php b/Blacklight/Sharing.php index 27703a4f9..b4b5fced4 100755 --- a/Blacklight/Sharing.php +++ b/Blacklight/Sharing.php @@ -397,13 +397,13 @@ class Sharing break; } - $matches = []; + $hits = []; //(_nZEDb_)nZEDb_533f16e46a5091.73152965_3d12d7c1169d468aaf50d5541ef02cc88f3ede10 - [1/1] "92ba694cebc4fbbd0d9ccabc8604c71b23af1131" (1/1) yEnc if ($header['From'] === '<anon@anon.com>' && - preg_match('/^\(_nZEDb_\)(?P<site>.+?)_(?P<guid>[a-f0-9]{40}) - \[1\/1\] "(?P<sid>[a-f0-9]{40})" yEnc \(1\/1\)$/i', $header['Subject'], $matches)) { + preg_match('/^\(_nZEDb_\)(?P<site>.+?)_(?P<guid>[a-f0-9]{40}) - \[1\/1\] "(?P<sid>[a-f0-9]{40})" yEnc \(1\/1\)$/i', $header['Subject'], $hits)) { // Check if this is from our own site. - if ($matches['guid'] === $this->siteSettings->site_guid) { + if ($hits['guid'] === $this->siteSettings->site_guid) { continue; } @@ -411,7 +411,7 @@ class Sharing $check = DB::selectOne( sprintf( 'SELECT id FROM release_comments WHERE shareid = %s', - escapeString($matches['sid']) + escapeString($hits['sid']) ) ); @@ -422,7 +422,7 @@ class Sharing $check = DB::selectOne( sprintf( 'SELECT enabled FROM sharing_sites WHERE site_guid = %s', - escapeString($matches['guid']) + escapeString($hits['guid']) ) ); @@ -436,8 +436,8 @@ class Sharing INSERT INTO sharing_sites (site_name, site_guid, last_time, first_time, enabled, comments) VALUES (%s, %s, NOW(), NOW(), 0, 0)', - escapeString($matches['site']), - escapeString($matches['guid']) + escapeString($hits['site']), + escapeString($hits['guid']) ) ); continue; @@ -450,8 +450,8 @@ class Sharing INSERT INTO sharing_sites (site_name, site_guid, last_time, first_time, enabled, comments) VALUES (%s, %s, NOW(), NOW(), 1, 0)', - escapeString($matches['site']), - escapeString($matches['guid']) + escapeString($hits['site']), + escapeString($hits['guid']) ) ); } elseif ((int) $check->enabled === 0) { @@ -459,13 +459,13 @@ class Sharing } // Insert the comment, if we got it, update the site to increment comment count. - if ($this->insertNewComment($header['Message-ID'], $matches['guid'])) { + if ($this->insertNewComment($header['Message-ID'], $hits['guid'])) { DB::update( sprintf( ' UPDATE sharing_sites SET comments = comments + 1, last_time = NOW(), site_name = %s WHERE site_guid = %s', - escapeString($matches['site']), - escapeString($matches['guid']) + escapeString($hits['site']), + escapeString($hits['guid']) ) ); $found++; diff --git a/Blacklight/libraries/Forking.php b/Blacklight/libraries/Forking.php index 2f771fd20..e5409d17f 100755 --- a/Blacklight/libraries/Forking.php +++ b/Blacklight/libraries/Forking.php @@ -500,12 +500,12 @@ class Forking $this->processWork(); foreach ($queues as $queue) { - preg_match('/alt\..+/i', $queue, $match); + preg_match('/alt\..+/i', $queue, $hit); $pool->add(function () use ($queue) { $this->_executeCommand($this->dnr_path.$queue.'"'); - }, 100000)->then(function () use ($match) { - if (! empty($match)) { - $this->colorCli->primary('Updated group '.$match[0]); + }, 100000)->then(function () use ($hit) { + if (! empty($hit)) { + $this->colorCli->primary('Updated group '.$hit[0]); } })->catch(function (\Throwable $exception) { echo $exception->getMessage(); diff --git a/Blacklight/processing/ProcessReleases.php b/Blacklight/processing/ProcessReleases.php index ad453bc2f..f8b44d9b4 100755 --- a/Blacklight/processing/ProcessReleases.php +++ b/Blacklight/processing/ProcessReleases.php @@ -546,8 +546,8 @@ class ProcessReleases 'naming_regex_id' => $cleanedName['id'] ?? 0, ]); - if (preg_match_all('#(\S+):\S+#', $collection->xref, $matches)) { - foreach ($matches[1] as $grp) { + if (preg_match_all('#(\S+):\S+#', $collection->xref, $hits)) { + foreach ($hits[1] as $grp) { //check if the group name is in a valid format $grpTmp = UsenetGroup::isValidGroup($grp); if ($grpTmp !== false) { diff --git a/Blacklight/processing/adult/ADE.php b/Blacklight/processing/adult/ADE.php index 8e50fb2fd..f3b2084e6 100755 --- a/Blacklight/processing/adult/ADE.php +++ b/Blacklight/processing/adult/ADE.php @@ -60,23 +60,23 @@ class ADE extends AdultMovies { $this->_response = getRawHtml(self::ADE.$this->_trailers.$this->_directUrl); $this->_html->loadHtml($this->_response); - if (preg_match("/([\"|'])(?P<swf>[^\"']+.swf)([\"|'])/i", $this->_response, $matches)) { - $this->_res['trailers']['url'] = self::ADE.trim(trim($matches['swf']), '"'); + if (preg_match("/([\"|'])(?P<swf>[^\"']+.swf)([\"|'])/i", $this->_response, $hits)) { + $this->_res['trailers']['url'] = self::ADE.trim(trim($hits['swf']), '"'); if (preg_match( '#(?:streamID:\s\")(?P<streamid>[0-9A-Z]+)(?:\")#', $this->_response, - $matches + $hits ) ) { - $this->_res['trailers']['streamid'] = trim($matches['streamid']); + $this->_res['trailers']['streamid'] = trim($hits['streamid']); } if (preg_match( '#(?:BaseStreamingUrl:\s\")(?P<baseurl>[\d]+.[\d]+.[\d]+.[\d]+)(?:\")#', $this->_response, - $matches + $hits ) ) { - $this->_res['trailers']['baseurl'] = $matches['baseurl']; + $this->_res['trailers']['baseurl'] = $hits['baseurl']; } } diff --git a/Blacklight/processing/adult/AEBN.php b/Blacklight/processing/adult/AEBN.php index 4d74780a3..40804f6da 100755 --- a/Blacklight/processing/adult/AEBN.php +++ b/Blacklight/processing/adult/AEBN.php @@ -69,8 +69,8 @@ class AEBN extends AdultMovies protected function trailers() { $ret = $this->_html->find('a[itemprop=trailer]', 0); - if (! empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $matches)) { - $movieid = $matches['movieid']; + if (! empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $hits)) { + $movieid = $hits['movieid']; $this->_res['trailers']['url'] = self::AEBNSURL.self::TRAILERURL.$movieid; } diff --git a/Blacklight/processing/adult/Popporn.php b/Blacklight/processing/adult/Popporn.php index 8c476da55..413d7bdab 100755 --- a/Blacklight/processing/adult/Popporn.php +++ b/Blacklight/processing/adult/Popporn.php @@ -120,8 +120,8 @@ class Popporn extends AdultMovies $ret->value = str_replace('..', '', $ret->value); $tmprsp = $this->_response; $this->_trailUrl = $ret->value; - if (preg_match_all('/productID="\+(?<id>\d+),/', $this->_response, $matches)) { - $productid = $matches['id'][0]; + if (preg_match_all('/productID="\+(?<id>\d+),/', $this->_response, $hits)) { + $productid = $hits['id'][0]; $random = ((float) mt_rand() / (float) mt_getrandmax()) * 5400000000000000; $this->_trailUrl = '/com/tlavideo/vod/FlvAjaxSupportService.cfc?random='.$random; $this->_postParams = 'method=pipeStreamLoc&productID='.$productid; diff --git a/Blacklight/processing/post/AniDB.php b/Blacklight/processing/post/AniDB.php index e5d7dcc13..db6fa2cad 100755 --- a/Blacklight/processing/post/AniDB.php +++ b/Blacklight/processing/post/AniDB.php @@ -153,7 +153,7 @@ class AniDB * * @param string $cleanName * - * @return array $matches + * @return array $hits */ private function extractTitleEpisode($cleanName = ''): array { @@ -162,31 +162,31 @@ class AniDB if (preg_match( '/(^|.*\")(\[[a-zA-Z\.\!?-]+\][\s_]*)?(\[BD\][\s_]*)?(\[\d{3,4}[ip]\][\s_]*)?(?P<title>[\w\s_.+!?\'\-\(\)]+)(New Edit|(Blu-?ray)?( ?Box)?( ?Set)?)?([ _]\-[ _]|([ ._-]Epi?(sode)?[ ._-]?0?)?[ ._-]?|[ ._-]Vol\.|[ ._-]E)(?P<epno>\d{1,3}|Movie|OVA|Complete Series)(v\d|-\d+)?[\-_. ].*[\[\(\"]/i', $cleanName, - $matches + $hits ) ) { - $matches['epno'] = (int) $matches['epno']; - if (\in_array($matches['epno'], ['Movie', 'OVA'], false)) { - $matches['epno'] = 1; + $hits['epno'] = (int) $hits['epno']; + if (\in_array($hits['epno'], ['Movie', 'OVA'], false)) { + $hits['epno'] = 1; } } elseif (preg_match( '/^(\[[a-zA-Z\.\-!?]+\][\s_]*)?(\[BD\])?(\[\d{3,4}[ip]\])?(?P<title>[\w\s_.+!?\'\-\(\)]+)(New Edit|(Blu-?ray)?( ?Box)?( ?Set)?)?\s*[\(\[](BD|\d{3,4}[ipx])/i', $cleanName, - $matches + $hits ) ) { - $matches['epno'] = 1; - } elseif (preg_match('#^(\[[a-zA-Z\.\-!?]+\][\s_]*)?(?P<title>[\w -]+)?\s+-\s+(?P<epno>\d+)\s*(\[\d+p\])?$#', $cleanName, $matches)) { - $matches['epno'] = (int) $matches['epno']; + $hits['epno'] = 1; + } elseif (preg_match('#^(\[[a-zA-Z\.\-!?]+\][\s_]*)?(?P<title>[\w -]+)?\s+-\s+(?P<epno>\d+)\s*(\[\d+p\])?$#', $cleanName, $hits)) { + $hits['epno'] = (int) $hits['epno']; } else { $this->status = self::PROC_EXTFAIL; } - if (! empty($matches['title'])) { - $matches['title'] = trim(str_replace(['_', '.'], ' ', $matches['title'])); + if (! empty($hits['title'])) { + $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); } - return $matches; + return $hits; } /** diff --git a/app/Http/Controllers/AnimeController.php b/app/Http/Controllers/AnimeController.php index 1f3bef19d..630ae6c42 100644 --- a/app/Http/Controllers/AnimeController.php +++ b/app/Http/Controllers/AnimeController.php @@ -110,8 +110,8 @@ class AnimeController extends BasePageController if (preg_match('/^[0-9]/', $s->title)) { $thisrange = '0-9'; } else { - preg_match('/([A-Z]).*/i', $s->title, $matches); - $thisrange = strtoupper($matches[1]); + preg_match('/([A-Z]).*/i', $s->title, $hits); + $thisrange = strtoupper($hits[1]); } $animelist[$thisrange][] = $s; } diff --git a/app/Http/Controllers/SeriesController.php b/app/Http/Controllers/SeriesController.php index 7f7153f3d..bd68a2664 100644 --- a/app/Http/Controllers/SeriesController.php +++ b/app/Http/Controllers/SeriesController.php @@ -126,8 +126,8 @@ class SeriesController extends BasePageController if (preg_match('/^[0-9]/', $s['title'])) { $thisrange = '0-9'; } else { - preg_match('/([A-Z]).*/i', $s['title'], $matches); - $thisrange = strtoupper($matches[1]); + preg_match('/([A-Z]).*/i', $s['title'], $hits); + $thisrange = strtoupper($hits[1]); } $serieslist[$thisrange][] = $s; } diff --git a/app/Models/Settings.php b/app/Models/Settings.php index 2c24015e0..7f0156bf3 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -168,12 +168,12 @@ class Settings extends Model */ public static function settingValue($setting) { - preg_match('/(\w+)?\.(\w+)?\.(\w+)/i', $setting, $match); + preg_match('/(\w+)?\.(\w+)?\.(\w+)/i', $setting, $hit); $result = self::query()->where( [ - 'section' => $match[1] ?? '', - 'subsection' => $match[2] ?? '', - 'name' => $match[3] ?? '', + 'section' => $hit[1] ?? '', + 'subsection' => $hit[2] ?? '', + 'name' => $hit[3] ?? '', ] )->value('value'); diff --git a/misc/testing/PostProc/updateBookImages.php b/misc/testing/PostProc/updateBookImages.php index 5672fb874..b90488d70 100644 --- a/misc/testing/PostProc/updateBookImages.php +++ b/misc/testing/PostProc/updateBookImages.php @@ -19,13 +19,13 @@ $path2covers = NN_COVERS.'book'.DS; $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { if (is_file($filePath->getPathname()) && preg_match('/\d+\.jpg$/', $filePath->getPathname())) { - preg_match('/(\d+)\.jpg$/', $filePath->getPathname(), $match); - if (isset($match[1])) { - $run = BookInfo::query()->where('cover', '=', 0)->where('id', $match[1])->update(['cover' => 1]); + preg_match('/(\d+)\.jpg$/', $filePath->getPathname(), $hit); + if (isset($hit[1])) { + $run = BookInfo::query()->where('cover', '=', 0)->where('id', $hit[1])->update(['cover' => 1]); if ($run >= 1) { $covers++; } else { - $run = BookInfo::query()->where('id', $match[1])->select(['id'])->get(); + $run = BookInfo::query()->where('id', $hit[1])->select(['id'])->get(); if ($run->count() === 0) { $colorCli->info($filePath.' not found in db.'); } diff --git a/misc/testing/PostProc/updateConsoleImages.php b/misc/testing/PostProc/updateConsoleImages.php index e48d602e5..2a707fb51 100644 --- a/misc/testing/PostProc/updateConsoleImages.php +++ b/misc/testing/PostProc/updateConsoleImages.php @@ -19,18 +19,18 @@ $path2covers = NN_COVERS.'console'.DS; $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { if (is_file($filePath->getPathname()) && preg_match('/\d+\.jpg$/', $filePath->getPathname())) { - preg_match('/(\d+)\.jpg$/', $filePath->getPathname(), $match); - if (isset($match[1])) { + preg_match('/(\d+)\.jpg$/', $filePath->getPathname(), $hit); + if (isset($hit[1])) { $run = ConsoleInfo::query()->where( [ 'cover' => 0, - 'id' => $match[1], + 'id' => $hit[1], ] )->update(['cover' => 1]); if ($run >= 1) { $covers++; } else { - $run = ConsoleInfo::query()->where('id', $match[1])->value('id'); + $run = ConsoleInfo::query()->where('id', $hit[1])->value('id'); if ($run === 0) { $colorCli->info($filePath.' not found in db.'); } diff --git a/misc/testing/PostProc/updateGamesImages.php b/misc/testing/PostProc/updateGamesImages.php index 182fba4ef..7be83c00b 100644 --- a/misc/testing/PostProc/updateGamesImages.php +++ b/misc/testing/PostProc/updateGamesImages.php @@ -30,14 +30,14 @@ $path2covers = NN_COVERS.'games'.DS; $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { if (is_file($filePath->getPathname()) && preg_match('/\d+\.jpg$/', $filePath->getPathname())) { - preg_match('/(\d+)\.jpg$/', basename($filePath->getPathname()), $match); - if (isset($match[1])) { - $run = GamesInfo::query()->where('cover', '=', 0)->where('id', $match[1])->update(['cover' => 1]); + preg_match('/(\d+)\.jpg$/', basename($filePath->getPathname()), $hit); + if (isset($hit[1])) { + $run = GamesInfo::query()->where('cover', '=', 0)->where('id', $hit[1])->update(['cover' => 1]); if ($run !== false) { if ($run >= 1) { $covers++; } else { - $run = GamesInfo::query()->where('id', $match[1])->select(['id'])->get(); + $run = GamesInfo::query()->where('id', $hit[1])->select(['id'])->get(); if ($run !== null && $run === 0) { $colorCli->info($filePath->getPathname().' not found in db.'); } diff --git a/misc/testing/PostProc/updateMovieImages.php b/misc/testing/PostProc/updateMovieImages.php index 58b8aff35..7f88b683d 100644 --- a/misc/testing/PostProc/updateMovieImages.php +++ b/misc/testing/PostProc/updateMovieImages.php @@ -27,13 +27,13 @@ $path2covers = NN_COVERS.'movies'.DS; $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { if (is_file($filePath->getPathname()) && preg_match('/-cover\.jpg$/', $filePath->getPathname())) { - preg_match('/(\d+)-cover\.jpg$/', $filePath->getPathname(), $match); - if (isset($match[1])) { - $run = MovieInfo::query()->where('cover', '=', 0)->where('imdbid', $match[1])->update(['cover' => 1]); + preg_match('/(\d+)-cover\.jpg$/', $filePath->getPathname(), $hit); + if (isset($hit[1])) { + $run = MovieInfo::query()->where('cover', '=', 0)->where('imdbid', $hit[1])->update(['cover' => 1]); if ($run >= 1) { $covers++; } else { - $run = MovieInfo::query()->where('imdbid', '=', $match[1])->select(['imdbid'])->get(); + $run = MovieInfo::query()->where('imdbid', '=', $hit[1])->select(['imdbid'])->get(); if ($run->count() === 0) { $colorCli->info($filePath.' not found in db.'); } diff --git a/misc/testing/PostProc/updateMusicImages.php b/misc/testing/PostProc/updateMusicImages.php index 15dafd306..897d68edd 100644 --- a/misc/testing/PostProc/updateMusicImages.php +++ b/misc/testing/PostProc/updateMusicImages.php @@ -19,13 +19,13 @@ $path2covers = NN_COVERS.'music'.DS; $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { if (is_file($filePath->getPathname()) && preg_match('/\d+\.jpg$/', $filePath->getPathname())) { - preg_match('/(\d+)\.jpg$/', $filePath->getPathname(), $match); - if (isset($match[1])) { - $run = MusicInfo::query()->where('cover', '=', 0)->where('id', $match[1])->update(['cover' => 1]); + preg_match('/(\d+)\.jpg$/', $filePath->getPathname(), $hit); + if (isset($hit[1])) { + $run = MusicInfo::query()->where('cover', '=', 0)->where('id', $hit[1])->update(['cover' => 1]); if ($run >= 1) { $covers++; } else { - $run = MusicInfo::query()->where('id', $match[1])->select(['id'])->get(); + $run = MusicInfo::query()->where('id', $hit[1])->select(['id'])->get(); if ($run->count() === 0) { $colorCli->info($filePath->getPathname().' not found in db.'); } diff --git a/misc/testing/PostProc/updateXXXImages.php b/misc/testing/PostProc/updateXXXImages.php index da7e883d8..19e116361 100644 --- a/misc/testing/PostProc/updateXXXImages.php +++ b/misc/testing/PostProc/updateXXXImages.php @@ -19,13 +19,13 @@ $path2covers = NN_COVERS.'xxx'.DS; $itr = File::allFiles($path2covers); foreach ($itr as $filePath) { if (is_file($filePath->getPathname()) && preg_match('/-cover\.jpg$/', $filePath->getPathname())) { - preg_match('/(\d+)-cover\.jpg$/', $filePath->getPathname(), $match); - if (isset($match[1])) { - $run = XxxInfo::query()->where('cover', '=', 0)->where('id', $match[1])->update(['cover' => 1]); + preg_match('/(\d+)-cover\.jpg$/', $filePath->getPathname(), $hit); + if (isset($hit[1])) { + $run = XxxInfo::query()->where('cover', '=', 0)->where('id', $hit[1])->update(['cover' => 1]); if ($run >= 1) { $covers++; } else { - $run = XxxInfo::query()->where('id', $match[1])->select(['id'])->get(); + $run = XxxInfo::query()->where('id', $hit[1])->select(['id'])->get(); if ($run->count() === 0) { $colorCli->info($filePath->getPathname().' not found in db.'); } diff --git a/misc/update/tmux/bin/groupfixrelnames.php b/misc/update/tmux/bin/groupfixrelnames.php index b0cc5140b..b3be586a8 100644 --- a/misc/update/tmux/bin/groupfixrelnames.php +++ b/misc/update/tmux/bin/groupfixrelnames.php @@ -91,12 +91,12 @@ switch (true) { if ((int) $release->ishashed === 1 && (int) $release->dehashstatus >= -6 && (int) $release->dehashstatus <= 0) { $colorCli->primaryOver('d'); - if (preg_match('/[a-fA-F0-9]{32,40}/i', $release->name, $matches)) { - $nameFixer->matchPredbHash($matches[0], $release, true, 1, true); + if (preg_match('/[a-fA-F0-9]{32,40}/i', $release->name, $hits)) { + $nameFixer->matchPredbHash($hits[0], $release, true, 1, true); } - if ($nameFixer->matched === false && ! empty($release->filehash) && preg_match('/[a-fA-F0-9]{32,40}/i', $release->filehash, $matches)) { + if ($nameFixer->matched === false && ! empty($release->filehash) && preg_match('/[a-fA-F0-9]{32,40}/i', $release->filehash, $hits)) { $colorCli->primaryOver('h'); - $nameFixer->matchPredbHash($matches[0], $release, true, 1, true); + $nameFixer->matchPredbHash($hits[0], $release, true, 1, true); } }