mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update the fix_filesize.php script
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user