mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Fix bad logic for namefixer release update function
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2017-04-19 DariusIII
|
||||
* Fix: Fix bad logic for namefixer release update function
|
||||
* Fix: Cast $release['releases_id'] as integer when comparing to $this->relid in NameFixer class
|
||||
* Chg: Declare PHP7 return types, remove duplicated TV naming regex in NameFixer class
|
||||
* Chg: Declare PHP7 return types in Categorize class and add PHPDOC blocks to functions
|
||||
|
||||
@@ -4,15 +4,13 @@ require_once dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||
use nntmux\ColorCLI;
|
||||
use nntmux\NameFixer;
|
||||
|
||||
$cli = new ColorCLI();
|
||||
|
||||
if (!isset($argv[1]) && ($argv[1] !== 'full' || !is_numeric($argv[1]))) {
|
||||
exit(
|
||||
$cli->error(PHP_EOL
|
||||
. "This script tries to match release filenames to PreDB filenames." . PHP_EOL
|
||||
. "To display the changes, use 'show' as the second argument. The optional third argument will limit the amount of filenames to attempt to match." . PHP_EOL . PHP_EOL
|
||||
. "php match_prefiles.php full show ...: to run on full database and show renames." . PHP_EOL
|
||||
. "php match_prefiles.php 2000 show ...: to run against 2000 distinct releases and show renames." . PHP_EOL
|
||||
ColorCLI::error(PHP_EOL
|
||||
. 'This script tries to match release filenames to PreDB filenames.' . PHP_EOL
|
||||
. 'To display the changes, use "show" as the second argument. The optional third argument will limit the amount of filenames to attempt to match.' . PHP_EOL . PHP_EOL
|
||||
. 'php match_prefiles.php full show ...: to run on full database and show renames.' . PHP_EOL
|
||||
. 'php match_prefiles.php 2000 show ...: to run against 2000 distinct releases and show renames.' . PHP_EOL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -757,9 +757,9 @@ class NameFixer
|
||||
* @param int $show
|
||||
* @param int $preId
|
||||
*/
|
||||
public function updateRelease($release, $name, $method, $echo, $type, $nameStatus, $show, $preId = 0): void
|
||||
public function updateRelease($release, $name, $method, $echo, $type, int $nameStatus, int $show, int $preId = 0): void
|
||||
{
|
||||
$release['releases_id'] = ($release['releases_id'] ?? $release['releaseid']);
|
||||
$release['releases_id'] = $release['releases_id'] ?? $release['releaseid'];
|
||||
if ($this->relid !== (int)$release['releases_id']) {
|
||||
$releaseCleaning = new ReleaseCleaning($this->pdo);
|
||||
$newName = $releaseCleaning->fixerCleaner($name);
|
||||
@@ -817,13 +817,13 @@ class NameFixer
|
||||
}
|
||||
|
||||
if ($type !== 'PAR2, ') {
|
||||
echo "\n";
|
||||
echo PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
$newTitle = $this->pdo->escapeString(substr($newName, 0, 255));
|
||||
|
||||
if ($echo === true) {
|
||||
if ($echo === 1) {
|
||||
if ($nameStatus === 1) {
|
||||
$status = '';
|
||||
switch ($type) {
|
||||
@@ -851,7 +851,7 @@ class NameFixer
|
||||
$status = 'isrenamed = 1, iscategorized = 1, proc_uid = 1,';
|
||||
break;
|
||||
}
|
||||
$this->pdo->queryExec(
|
||||
$end = $this->pdo->queryExec(
|
||||
sprintf('
|
||||
UPDATE releases
|
||||
SET videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfo_id = NULL,
|
||||
@@ -1033,7 +1033,7 @@ class NameFixer
|
||||
*
|
||||
* @param array $args The CLI script arguments
|
||||
*/
|
||||
public function getPreFileNames(array $args = array()): void
|
||||
public function getPreFileNames(array $args = []): void
|
||||
{
|
||||
$n = PHP_EOL;
|
||||
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Reference in New Issue
Block a user