diff --git a/misc/testing/fix_filesize.php b/misc/testing/fix_filesize.php index 6d454dd4d..dda1e7689 100644 --- a/misc/testing/fix_filesize.php +++ b/misc/testing/fix_filesize.php @@ -10,19 +10,17 @@ require_once dirname(__FILE__) . '/../../www/config.php'; use newznab\db\Settings; -$db = new Settings; -$s = New Sites; +$pdo = new Settings; $nzb = new NZB; -$items = $db->query("SELECT ID,guid FROM releases WHERE size = 0"); +$items = $pdo->query("SELECT id,guid FROM releases WHERE size = 0"); $total = count($items); $compl = 0; echo "Updating file size for " . count($items) . " release(s)\n"; -$site = $s->get(); while ($item = array_pop($items)) { - $nzbpath = $nzb->getNZBPath($item['guid'], $site->nzbpath); + $nzbpath = $nzb->getNZBPath($item['guid'], $pdo->getSetting('nzbpath')); ob_start(); @readgzfile($nzbpath); @@ -37,7 +35,7 @@ while ($item = array_pop($items)) $filesize = bcadd($filesize, $file['size']); } - $db->exec("UPDATE releases SET size = '{$filesize}' WHERE `ID` = '{$item['ID']}' LIMIT 1"); + $pdo->queryExec("UPDATE releases SET size = '{$filesize}' WHERE id = '{$item['id']}' LIMIT 1"); $compl++; echo sprintf("[%6d / %6d] %0.2f",$compl, $total, ($compl/$total) * 100) . '%' . "\n";