} else { output("`\$Failed!`0`n"); } install_module($modulename); break; case "activate": output("`3Activating `#{$modulename}`3: "); if (activate_module($modulename)) { output("`@OK!`0`n"); } else { output("`\$Failed!`0`n"); } break; case "deactivate": output("`3Deactivating `#{$modulename}`3: "); if (deactivate_module($modulename)) { output("`@OK!`0`n"); } else { output("`\$Failed!`0`n"); } break; case "donothing": break; } } $session['moduleoperations'][$modulename] = "donothing"; } rawoutput("</div>"); } output("`n`2Finally, I'll clean up old data.`n"); rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
$op = ""; httpset('op', ""); } elseif ($op == "uninstall") { if (uninstall_module($module)) { } else { output("Unable to inject module. Module not uninstalled.`n"); } $op = ""; httpset('op', ""); } elseif ($op == "activate") { activate_module($module); $op = ""; httpset('op', ""); invalidatedatacache("injections/inject_{$module}"); } elseif ($op == "deactivate") { deactivate_module($module); $op = ""; httpset('op', ""); invalidatedatacache("injections/inject_{$module}"); } elseif ($op == "reinstall") { $sql = "UPDATE " . db_prefix("modules") . " SET filemoddate='0000-00-00 00:00:00' WHERE modulename='{$module}'"; db_query($sql); // We don't care about the return value here at all. injectmodule($module, true); $op = ""; httpset('op', ""); invalidatedatacache("injections/inject_{$module}"); } } $install_status = get_module_install_status(); $uninstmodules = $install_status['uninstalledmodules'];
//---------------------------------- // TODO improve status message and backlog display switch ($cmd) { case 'activ': list($backlog, $success) = activate_module($module_id); $details = $backlog->output(); if ($success) { $summary = get_lang('Module activation succeeded'); $dialogBox->success(Backlog_Reporter::report($summary, $details)); } else { $summary = get_lang('Module activation failed'); $dialogBox->error(Backlog_Reporter::report($summary, $details)); } break; case 'desactiv': list($backlog, $success) = deactivate_module($module_id); $details = $backlog->output(); if ($success) { $summary = get_lang('Module desactivation succeeded'); $dialogBox->success(Backlog_Reporter::report($summary, $details)); } else { $summary = get_lang('Module desactivation failed'); $dialogBox->error(Backlog_Reporter::report($summary, $details)); } break; case 'mvUp': if (!is_null($courseToolId)) { move_module_tool($courseToolId, 'up'); } break; case 'mvDown':
<?php //Pages add_apage(array('code' => 'modules_panel', 'title' => 'Модули', 'rule' => 'admin_modules, admin_settings', 'category' => 'admin', 'priority' => 15, 'function' => function () { set_glob_content(array('pagi' => true, 'limit' => 10, 'all' => get_modules_count(), 'handler' => function () { global $PAGE; return array('body' => get_modules_list($PAGE->content['limit'], $PAGE->content['offset'])); })); get_template('modules/panel.php'); })); //Others add_action(array('code' => 'ajax_deactivate_module', 'rule' => 'admin_ajax', 'category' => 'admin', 'function' => function ($params = null) { if (isset($params['button']['pre']['value'])) { $params = $params['button']['pre']['value']; } if ($params && deactivate_module($params)) { echo ajax_make_res('reload', "Модуль {$params} успешно деактивирован", 'Успех!'); } else { echo ajax_make_res('error', 'Произошла неизвестная ошибка', 'Ошибка!'); } })); add_action(array('code' => 'ajax_activate_module', 'rule' => 'admin_ajax', 'category' => 'admin', 'function' => function ($params = null) { if (isset($params['button']['pre']['value'])) { $params = $params['button']['pre']['value']; } if ($params && activate_module($params)) { echo ajax_make_res('reload', "Модуль {$params} успешно активирован", 'Успех!'); } else { echo ajax_make_res('error', 'Произошла неизвестная ошибка', 'Ошибка!'); } }));
if (isset($_REQUEST['cmd']) && $_REQUEST['cmd'] == 'run') { // DB tables definition $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_module = $tbl_mdb_names['module']; $tbl_module_info = $tbl_mdb_names['module_info']; $tbl_module_contexts = $tbl_mdb_names['module_contexts']; $modules = claro_sql_query_fetch_all("SELECT label, id, name FROM `{$tbl_module}`"); $deactivatedModules = array(); $readOnlyModules = array('CLDOC', 'CLGRP', 'CLUSR'); $version = ''; foreach ($modules as $module) { $manifest = readModuleManifest(get_module_path($module['label'])); if ($manifest) { $version = array_key_exists('CLAROLINE_MAX_VERSION', $manifest) ? $manifest['CLAROLINE_MAX_VERSION'] : $manifest['CLAROLINE_MIN_VERSION']; if (!in_array($module['label'], $readOnlyModules) && !preg_match($patternVarVersion, $version)) { deactivate_module($module['id']); $deactivatedModules[] = $module; } } } $display = DISPLAY_RESULT_SUCCESS_PANEL; } // Display Header echo upgrade_disp_header(); // Display Content switch ($display) { case DISPLAY_WELCOME_PANEL: echo '<h2>Step 4 of 4: disable incompatible modules</h2> <p>The <em>Claroline Upgrade Tool</em> is going to deactivate modules not compatible with the new Claroline version. You can reactivate those modules in the platform administration. </p>
$dialogBox->success(get_lang('Module activation at course creation set to MANUAL')); $module['activateInCourses'] = 'MANUAL'; } else { $dialogBox->error(get_lang('Cannot change module activation on course creation')); } break; case 'activ': if (activate_module($moduleId)) { $dialogBox->success(get_lang('Module activation succeeded')); $module['activation'] = 'activated'; } else { $dialogBox->error(get_lang('Cannot activate module')); } break; case 'deactiv': if (deactivate_module($moduleId)) { $dialogBox->success(get_lang('Module deactivation succeeded')); $module['activation'] = 'deactivated'; } else { $dialogBox->error(get_lang('Cannot deactivate module')); $module['activation'] = 'activated'; } break; case 'movedock': if (is_array($dockList)) { if (isset($_REQUEST['displayDockList']) && is_array($_REQUEST['displayDockList'])) { foreach ($dockList as $dockId => $dockName) { if (in_array($dockId, $_REQUEST['displayDockList'])) { add_module_in_dock($moduleId, $dockId); } else { remove_module_dock($moduleId, $dockId);