TechnicSolder icon indicating copy to clipboard operation
TechnicSolder copied to clipboard

Mod ID's not removing from Modpack

Open bastrian opened this issue 5 years ago • 2 comments

Describe the bug When deleting a Mod from the Mod librarythe ID still stays in the modpack. It will show a blank entry in the Mod list of the Modpack

To Reproduce Steps to reproduce the behavior:

  1. Go to the Mod library
  2. Select a Mod that is in a Modpack and delete it
  3. Go to the Modpack and edit it
  4. See a blank entry

Expected behavior The Mod should be removed from the Modpack too. (Search all Modpacks, check for the ID and remove it)

Screenshots unknown

bastrian avatar Feb 11 '20 17:02 bastrian

I know it's almost a year later, but this bug would be quite hard to patch evidently as the system would need to scan every version from every modpack for the mods that are left behind. It can be done, but the easiest thing to do is to just not remove versions from the mod library and to just remove the mod in the next version you release. I've talked with TheGameSpider on this one and it does seem like something that could be done, but likely is a large amount of work that can be a little resource-intense if used in hundreds of versions across multiple packs. Just wondering, why would you want to remove something from the mod library in the first place instead of just making a new version without it?

ZandercraftGames avatar Feb 11 '21 19:02 ZandercraftGames

Maybe try something like:

$id = ;# mod ID that was removed
$modpacks = mysqli_get_array(mysqli_query($connect, "SELECT * FROM builds"));
foreach ($modpacks as $modpack) {
    $modpackId=$modpack['id']; 
    $modpackMods = explode(',', $modpack['mods']) ;
    if (in_array($id, $modpackMods) {
        $indexOfId=array_search($id, $modpackMods);# this and below may not work.
        unset($indexOfId, $modpackMods);  
        $modpackMods=array_values($modpackMods); 
        mysqli_query($connect, "UPDATE builds SET mods = ".$modpackMods." WHERE id = ".$modpackId)
    }
}

cowpod avatar May 11 '21 05:05 cowpod