recover ptGen

This commit is contained in:
xiaomlove
2025-05-16 02:43:45 +07:00
parent 47f453335d
commit d123e8a849
19 changed files with 140 additions and 41 deletions

View File

@@ -8,7 +8,7 @@ $id = intval($_GET['id'] ?? 0);
if (!$id)
die();
$res = sql_query("SELECT torrents.*, categories.mode as cat_mode, torrent_extras.media_info as technical_info, torrent_extras.descr FROM torrents LEFT JOIN categories ON category = categories.id left join torrent_extras on torrents.id = torrent_extras.torrent_id WHERE torrents.id = $id");
$res = sql_query("SELECT torrents.*, categories.mode as cat_mode, torrent_extras.media_info as technical_info, torrent_extras.descr, torrent_extras.pt_gen FROM torrents LEFT JOIN categories ON category = categories.id left join torrent_extras on torrents.id = torrent_extras.torrent_id WHERE torrents.id = $id");
$row = mysql_fetch_assoc($res);
if (!$row) die();

View File

@@ -51,7 +51,7 @@ switch ($siteid)
{
$ptGen = new \Nexus\PTGen\PTGen();
try {
$ptGen->updateTorrentPtGen($row, $siteid);
$ptGen->updateTorrentPtGen($id);
} catch (\Exception $e) {
$log = $e->getMessage() . ", trace: " . $e->getTraceAsString();
do_log($log, 'error');

View File

@@ -47,19 +47,19 @@ $url = parse_imdb_id($_POST['url'] ?? '');
* add PT-Gen
* @since 1.6
*
* @deprecated
* @since 1.9
*/
//if (!empty($_POST['pt_gen'])) {
// $postPtGen = $_POST['pt_gen'];
// $existsPtGenInfo = json_decode($row['pt_gen'], true) ?? [];
// $ptGen = new \Nexus\PTGen\PTGen();
// if ($postPtGen != $ptGen->getLink($existsPtGenInfo)) {
if (!empty($_POST['pt_gen'])) {
$postPtGen = $_POST['pt_gen'];
$existsPtGenInfo = json_decode($row['pt_gen'], true) ?? [];
$ptGen = new \Nexus\PTGen\PTGen();
if ($postPtGen != $ptGen->getLink($existsPtGenInfo)) {
// $updateset[] = "pt_gen = " . sqlesc($postPtGen);
// }
//} else {
$extraUpdate["pt_gen"] = $postPtGen;
}
} else {
// $updateset[] = "pt_gen = ''";
//}
$extraUpdate["pt_gen"] = "";
}
//$updateset[] = "technical_info = " . sqlesc($_POST['technical_info'] ?? '');
$extraUpdate["media_info"] = $_POST['technical_info'] ?? '';

View File

@@ -353,13 +353,14 @@ $insert = [
'cache_stamp' => time(),
];
/**
* migrate to extra table and remove pt_gen field
* migrate to extra table
* @since 1.9
*/
$extra = [
'descr' => $descr,
'media_info' => $_POST['technical_info'] ?? '',
'nfo' => $nfo,
'pt_gen' => $_POST['pt_gen'] ?? '',
];
if (isset($_POST['hr'][$catmod]) && isset(\App\Models\Torrent::$hrStatus[$_POST['hr'][$catmod]]) && user_can('torrent_hr')) {
$insert['hr'] = $_POST['hr'][$catmod];