From da151c31dad6406f95a40b1680e6dd73fbe0319e Mon Sep 17 00:00:00 2001 From: Henry Gross-Hellsen <6283258+cowpod@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:44:36 -0700 Subject: [PATCH] send_mods.php: change existing mod to info instead of error --- functions/send_mods.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/send_mods.php b/functions/send_mods.php index 190f774..d6bf4ac 100644 --- a/functions/send_mods.php +++ b/functions/send_mods.php @@ -143,10 +143,10 @@ function processFile(string $filePath, string $fileName, array $modinfo): int { // continue; } // if we have another mod of same version, name, mcversion, type, loadertype - $query_mod_exists = $db->query("SELECT 1 FROM mods WHERE version = '".$db->sanitize($modinfo['version'])."' AND name = '".$db->sanitize($modinfo['modid'])."' AND mcversion = '".$db->sanitize($modinfo['mcversion'])."' AND `type` = 'mod' AND `loadertype` = '".$db->sanitize($modinfo['loadertype'])."' LIMIT 1"); + $query_mod_exists = $db->query("SELECT id,name FROM mods WHERE version = '".$db->sanitize($modinfo['version'])."' AND name = '".$db->sanitize($modinfo['modid'])."' AND mcversion = '".$db->sanitize($modinfo['mcversion'])."' AND `type` = 'mod' AND `loadertype` = '".$db->sanitize($modinfo['loadertype'])."' LIMIT 1"); if ($query_mod_exists && sizeof($query_mod_exists)>0) { - error_log('{"status": "error","message":"Mod already in database!"}'); - die('{"status": "error","message":"Mod already in database!"}'); + error_log('{"status": "info","message":"Mod already in database!","modid":"'.$query_mod_exists[0]['id'].'","name":"'.$query_mod_exists[0]['name'].'"}'); + die('{"status": "info","message":"Mod already in database!","modid":"'.$query_mod_exists[0]['id'].'","name":"'.$query_mod_exists[0]['name'].'"}'); } // consequence: we allow multiple loadertypes (ie fabric, forge) of the exact same mod $result_mod_id = processFile($file_tmp, $file_name, $modinfo);