name) && file_exists(modules::modulesDir."/".$newModInfo->name."/module.json")) { $exModInfo=json_decode(file_get_contents(modules::modulesDir."/".$newModInfo->name."/module.json")); if (!empty($exModInfo)) { $modInstalled=true; $needUpdate=(property_exists($exModInfo, "hash") && $exModInfo->hash!=$newModInfo->hash); } } print "Module ".$newModInfo->name.": ".($modInstalled?"Installed, ".($needUpdate?"Outdated":"Actual"):"Not installed").".\n"; if ($modInstalled && $needUpdate) { system("rm -rf \"".modules::modulesDir."/".$newModInfo->name."\""); } if (!$modInstalled || $needUpdate) { print "Install..."; $zip = new \ZipArchive(); $zip->open(modules::packagesDir . "/" . $file); mkdir (modules::modulesDir."/".$newModInfo->name); $zip->extractTo(modules::modulesDir."/".$newModInfo->name); if (file_exists(modules::modulesDir."/".$newModInfo->name."/fox-start.d")) { system("chmod a+x \"".modules::modulesDir."/".$newModInfo->name."/fox-start.d/\"*"); } $mods = moduleInfo::getAll(); foreach($mods as $mod) { if ($newModInfo->name==$mod->instanceOf) { $mod->modVersion=$newModInfo->version; $mod->modBuild=$newModInfo->build; $mod->save(); } } print "OK\n"; } } print "Packages installer completed\n";