Switch to category constants from category numbers, part 1

This commit is contained in:
DariusIII
2016-02-09 12:37:30 +01:00
parent 222b6b93e1
commit 9fc39bf490
13 changed files with 115 additions and 50 deletions
+5 -3
View File
@@ -1,9 +1,11 @@
<?php
require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use newznab\Category;
use newznab\ConsoleTools;
use newznab\db\Settings;
$category = new Category();
$pdo = new Settings();
$consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]);
$ran = false;
@@ -61,7 +63,7 @@ if (isset($argv[1]) && ($argv[1] === "consoles" || $argv[1] === "all")) {
$where = ' WHERE consoleinfoid IS NOT NULL';
} else {
echo $pdo->log->header("Resetting all failed Console postprocessing");
$where = " WHERE consoleinfoid IN (-2, 0) AND categoryid BETWEEN 1000 AND 1999";
$where = " WHERE consoleinfoid IN (-2, 0) AND categoryid BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -117,7 +119,7 @@ if (isset($argv[1]) && ($argv[1] === "movies" || $argv[1] === "all")) {
$where = ' WHERE imdbid IS NOT NULL';
} else {
echo $pdo->log->header("Resetting all failed Movie postprocessing");
$where = " WHERE imdbid IN (-2, 0) AND categoryid BETWEEN 2000 AND 2999";
$where = " WHERE imdbid IN (-2, 0) AND categoryid BETWEEN " . Category::MOVIE_ROOT . " AND " . Category::MOVIE_OTHER;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -145,7 +147,7 @@ if (isset($argv[1]) && ($argv[1] === "music" || $argv[1] === "all")) {
$where = ' WHERE musicinfoid IS NOT NULL';
} else {
echo $pdo->log->header("Resetting all failed Music postprocessing");
$where = " WHERE musicinfoid IN (-2, 0) AND categoryid BETWEEN 3000 AND 3999";
$where = " WHERE musicinfoid IN (-2, 0) AND categoryid BETWEEN " . Category::MUSIC_ROOT . " AND " . Category::MUSIC_OTHER;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);