Skip to content

Commit

Permalink
send_mods.php: change existing mod to info instead of error
Browse files Browse the repository at this point in the history
  • Loading branch information
cowpod committed Oct 31, 2024
1 parent ffea599 commit da151c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions functions/send_mods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit da151c3

Please sign in to comment.