$new_rev = cot_apply_patches("./setup/{$branch}", $rev); // Update installed modules and plugins $updated_ext = false; if (count($cot_modules) > 0) { foreach ($cot_modules as $code => $mod) { $ret = cot_extension_install($code, true, true); if ($ret === true) { $updated_ext = true; } elseif ($ret === false) { cot_error(cot_rc('ext_update_error', array('type' => $L['Module'], 'name' => $code))); } } } if (count($cot_plugins_enabled) > 0) { foreach ($cot_plugins_enabled as $code => $plug) { $ret = cot_extension_install($code, false, true); if ($ret === true) { $updated_ext = true; } elseif ($ret === false) { cot_error(cot_rc('ext_update_error', array('type' => $L['Plugin'], 'name' => $code))); } } } if ($new_rev === false || cot_error_found()) { // Display error message $t->assign('UPDATE_TITLE', $L['install_update_error']); } elseif ($new_rev === true && !$updated_config && !$updated_ext) { $t->assign('UPDATE_TITLE', $L['install_update_nothing']); $t->assign('UPDATE_COMPLETED_NOTE', ''); $t->parse('MAIN.COMPLETED'); } else {
while ($row = $res->fetch()) { $cot_groups[$row['grp_id']] = array('id' => $row['grp_id'], 'alias' => $row['grp_alias'], 'level' => $row['grp_level'], 'disabled' => $row['grp_disabled'], 'hidden' => $row['grp_hidden'], 'state' => $row['grp_state'], 'name' => htmlspecialchars($row['grp_name']), 'title' => htmlspecialchars($row['grp_title'])); } $res->closeCursor(); $usr['id'] = 1; // Install all at once // Note: installation statuses are ignored in this installer $selected_modules = cot_install_sort_extensions($selected_modules, true); foreach ($selected_modules as $ext) { if (!cot_extension_install($ext, true)) { cot_error("Installing {$ext} module has failed"); } } $selected_plugins = cot_install_sort_extensions($selected_plugins, false); foreach ($selected_plugins as $ext) { if (!cot_extension_install($ext, false)) { cot_error("Installing {$ext} plugin has failed"); } } } break; case 5: // End credits break; default: // Error cot_redirect(cot_url('index')); exit; } $inst_func_name = "cot_install_step" . $step . "_setup"; function_exists($inst_func_name) && $inst_func_name();
cot_message('ext_old_format', 'warning'); } } else { $info = array('Name' => $code); } switch ($b) { case 'install': $installed_modules = $db->query("SELECT ct_code FROM {$db_core} WHERE ct_plug = 0")->fetchAll(PDO::FETCH_COLUMN); $installed_plugins = $db->query("SELECT ct_code FROM {$db_core} WHERE ct_plug = 1")->fetchAll(PDO::FETCH_COLUMN); $dependencies_satisfied = cot_extension_dependencies_statisfied($code, $is_module, $installed_modules, $installed_plugins); if ($dependencies_satisfied) { $result = cot_extension_install($code, $is_module); } break; case 'update': $result = cot_extension_install($code, $is_module, true, true); break; case 'uninstall': /* === Hook === */ foreach (cot_getextplugins('admin.extensions.uninstall.first') as $pl) { include $pl; } /* ===== */ if (cot_check_xg(false)) { // Check if there are extensions installed depending on this one $dependencies_satisfied = true; $res = $db->query("SELECT ct_code, ct_plug FROM {$db_core} ORDER BY ct_plug, ct_code"); foreach ($res->fetchAll() as $row) { $ext = $row['ct_code']; $dir_ext = $row['ct_plug'] ? $cfg['plugins_dir'] : $cfg['modules_dir']; $dep_ext_info = $dir_ext . '/' . $ext . '/' . $ext . '.setup.php';