mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Remove Blacklight\db\DB class from many scripts in misc/testing folder
This commit is contained in:
@@ -5,18 +5,20 @@
|
||||
// --------------------------------------------------------------
|
||||
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
|
||||
|
||||
use App\Models\Settings;
|
||||
use Blacklight\ColorCLI;
|
||||
use Blacklight\NZB;
|
||||
use Blacklight\db\DB;
|
||||
use Blacklight\Releases;
|
||||
use Blacklight\ConsoleTools;
|
||||
use Blacklight\ReleaseImage;
|
||||
use Blacklight\utility\Utility;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
$pdo = new DB();
|
||||
$pdo = DB::connection()->getPdo();
|
||||
|
||||
$row = $pdo->queryOneRow("SELECT value FROM settings WHERE setting = 'coverspath'");
|
||||
if ($row !== false) {
|
||||
Utility::setCoversConstant($row['value']);
|
||||
$row = Settings::settingValue('site.main.coverspath');
|
||||
if ($row !== null) {
|
||||
Utility::setCoversConstant($row);
|
||||
} else {
|
||||
die("Unable to determine covers path!\n");
|
||||
}
|
||||
@@ -24,7 +26,7 @@ if ($row !== false) {
|
||||
$path2preview = NN_COVERS.'preview'.DS;
|
||||
|
||||
if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
|
||||
$releases = new Releases(['Settings' => $pdo]);
|
||||
$releases = new Releases();
|
||||
$nzb = new NZB();
|
||||
$releaseImage = new ReleaseImage();
|
||||
$consoletools = new ConsoleTools();
|
||||
@@ -33,16 +35,16 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
|
||||
if (isset($argv[2]) && is_numeric($argv[2])) {
|
||||
$limit = $argv[2];
|
||||
}
|
||||
echo $pdo->log->header('Scanning for releases missing previews');
|
||||
$res = $pdo->queryDirect('SELECT id, guid FROM releases where nzbstatus = 1 AND haspreview = 1');
|
||||
echo ColorCLI::header('Scanning for releases missing previews');
|
||||
$res = $pdo->query('SELECT id, guid FROM releases where nzbstatus = 1 AND haspreview = 1');
|
||||
if ($res instanceof \Traversable) {
|
||||
foreach ($res as $row) {
|
||||
$nzbpath = $path2preview.$row['guid'].'_thumb.jpg';
|
||||
if (! file_exists($nzbpath)) {
|
||||
$counterfixed++;
|
||||
echo $pdo->log->warning('Missing preview '.$nzbpath);
|
||||
echo ColorCLI::warning('Missing preview '.$nzbpath);
|
||||
if ($argv[1] === 'true') {
|
||||
$pdo->queryExec(
|
||||
$pdo->exec(
|
||||
sprintf('UPDATE releases SET consoleinfo_id = NULL, gamesinfo_id = 0, imdbid = NULL, musicinfo_id = NULL, bookinfo_id = NULL, videos_id = 0, xxxinfo_id = 0, passwordstatus = -1, haspreview = -1, jpgstatus = 0, videostatus = 0, audiostatus = 0, nfostatus = -1 WHERE id = %s', $row['id'])
|
||||
);
|
||||
}
|
||||
@@ -50,12 +52,12 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
|
||||
|
||||
if (($limit > 0) && ($counterfixed >= $limit)) {
|
||||
break;
|
||||
} // QUAD!
|
||||
}
|
||||
}
|
||||
}
|
||||
echo $pdo->log->header('Total releases missing previews that '.$couldbe.'reset for reprocessing= '.number_format($counterfixed));
|
||||
echo ColorCLI::header('Total releases missing previews that '.$couldbe.'reset for reprocessing= '.number_format($counterfixed));
|
||||
} else {
|
||||
exit($pdo->log->header("\nThis script checks if release previews actually exist on disk.\n\n"
|
||||
exit(ColorCLI::header("\nThis script checks if release previews actually exist on disk.\n\n"
|
||||
."Releases without previews may be reset for post-processing, thus regenerating them and related meta data.\n\n"
|
||||
."Useful for recovery after filesystem corruption, or as an alternative re-postprocessing tool.\n\n"
|
||||
."Optional LIMIT parameter restricts number of releases to be reset.\n\n"
|
||||
|
||||
Reference in New Issue
Block a user