mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-10-17 13:03:12 -04:00
56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
<?php
|
|
|
|
require_once(__DIR__.'/../classes/config.php');
|
|
require_once(__DIR__.'/../classes/classloader.php');
|
|
require_once(__DIR__.'/../classes/util.php');
|
|
|
|
$Debug = new DEBUG;
|
|
$Debug->handle_errors();
|
|
|
|
ini_set('max_execution_time', -1);
|
|
|
|
$DB = new DB_MYSQL;
|
|
$Cache = new CACHE;
|
|
|
|
define('CHUNK', 100);
|
|
|
|
$offset = 0;
|
|
$processed = 0;
|
|
$newLog = 0;
|
|
$newHtml = 0;
|
|
|
|
$logFiler = new \Gazelle\File\RipLog;
|
|
$htmlFiler = new \Gazelle\File\RipLogHTML;
|
|
|
|
while (true) {
|
|
$DB->prepared_query('
|
|
SELECT LogID, TorrentID, Log
|
|
FROM torrents_logs
|
|
WHERE LogID > ?
|
|
ORDER BY LogID
|
|
LIMIT ?
|
|
', $offset, CHUNK
|
|
);
|
|
if (!$DB->has_results()) {
|
|
break;
|
|
}
|
|
|
|
$list = $DB->to_array();
|
|
foreach ($list as $torrent) {
|
|
list($logId, $torrentId, $log) = $torrent;
|
|
$last = $logId;
|
|
++$processed;
|
|
if (!file_exists($logFiler->path([$torrentId, $logId]))) {
|
|
copy($logFiler->pathLegacy([$torrentId, $logId]), $logFiler->path([$torrentId, $logId]));
|
|
++$newLog;
|
|
}
|
|
if (!file_exists($htmlFiler->path([$torrentId, $logId]))) {
|
|
$htmlFiler->put($log, [$torrentId, $logId]);
|
|
++$newHtml;
|
|
}
|
|
}
|
|
|
|
printf("begin %7d end %7d processed %7d log %7d html %7d\n", $offset, $last, $processed, $newLog, $newHtml);
|
|
$offset = $last;
|
|
}
|