function exec_ogp_module()
{
    global $db;
    global $view;
    print "<h2>" . get_lang_f('uninstalling_module', $_REQUEST['module']) . "</h2>";
    require_once 'modules/modulemanager/module_handling.php';
    if (isset($_REQUEST['id']) && isset($_REQUEST['module']) && uninstall_module($db, $_REQUEST['id'], $_REQUEST['module']) === TRUE) {
        print_success(get_lang_f("successfully_uninstalled_module", $_REQUEST['module']));
    } else {
        print_failure(get_lang_f("failed_to_uninstall_module", $_REQUEST['module']));
    }
    $view->refresh("?m=modulemanager");
}
output("`3Installing `#$modulename`\$`n");
install_module($modulename, false);
}
rawoutput("</div>");
*/
if (!$session['skipmodules']) {
    output("`n`2Now I'll install and configure your modules.");
    rawoutput("<div style='width: 100%; height: 150px; max-height: 150px; overflow: auto;'>");
    foreach ($session['moduleoperations'] as $modulename => $val) {
        $ops = explode(",", $val);
        reset($ops);
        while (list($trash, $op) = each($ops)) {
            switch ($op) {
                case "uninstall":
                    output("`3Uninstalling `#{$modulename}`3: ");
                    if (uninstall_module($modulename)) {
                        output("`@OK!`0`n");
                    } else {
                        output("`\$Failed!`0`n");
                    }
                    break;
                case "install":
                    output("`3Installing `#{$modulename}`3: ");
                    if (install_module($modulename)) {
                        output("`@OK!`0`n");
                    } else {
                        output("`\$Failed!`0`n");
                    }
                    install_module($modulename);
                    break;
                case "activate":
function upgrade_chat_to_19()
{
    global $includePath;
    // activate new module to replace the old one
    $tool = 'CLCHAT_19';
    switch ($step = get_upgrade_status($tool)) {
        case 1:
            // install new chat
            if (!file_exists($includePath . '/../../module/CLCHAT')) {
                log_message('New Chat module not found : keep the old one !');
                $step = set_upgrade_status($tool, 0);
                return $step;
            }
            list($backLog, $moduleId) = install_module($includePath . '/../../module/CLCHAT', true);
            log_message($backLog->output());
            if ($moduleId) {
                list($backLog, $success) = activate_module_in_platform($moduleId);
                log_message($backLog->output());
            } else {
                return $step;
            }
            if ($success) {
                $step = set_upgrade_status($tool, $step + 1);
            } else {
                return $step;
            }
        case 2:
            // remove old chat
            $moduleId = get_module_data('CLCHT', 'id');
            if ($moduleId) {
                list($backLog, $success) = uninstall_module($moduleId);
                log_message($backLog->output());
            } else {
                $success = true;
            }
            if ($success) {
                $step = set_upgrade_status($tool, $step + 1);
            } else {
                return $step;
            }
        default:
            $step = set_upgrade_status($tool, 0);
            return $step;
    }
    return false;
}
        $modules = array();
    }
}
reset($modules);
while (list($key, $module) = each($modules)) {
    $op = $theOp;
    output("`2Performing `^%s`2 on `%%s`0`n", translate_inline($op), $module);
    if ($op == "install") {
        if (install_module($module)) {
        } else {
            httpset('cat', '');
        }
        $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}");
Beispiel #5
0
 case 'byDefaultVisible':
 case 'byDefaultInvisible':
     $visibility = 'byDefaultVisible' == $cmd ? true : false;
     $success = set_tool_visibility_at_course_creation($module_id, $visibility);
     if ($success) {
         $dialogBox->success(get_lang('Default module visibility updated'));
     } else {
         $dialogBox->error(get_lang('Failed to update default module visibility'));
     }
     break;
 case 'exUninstall':
     $moduleInfo = get_module_info($module_id);
     if (in_array($moduleInfo['label'], $old_tool_array)) {
         $dialogBox->error(get_lang('This tool can not be uninstalled.'));
     } else {
         list($backlog, $success) = uninstall_module($module_id, $deleteModuleDatabase);
         $details = $backlog->output();
         if ($success) {
             $summary = get_lang('Module uninstallation succeeded');
             $dialogBox->success(Backlog_Reporter::report($summary, $details));
         } else {
             $summary = get_lang('Module uninstallation failed');
             $dialogBox->error(Backlog_Reporter::report($summary, $details));
         }
     }
     break;
 case 'rqUninstall':
     $moduleInfo = get_module_info($module_id);
     $dialogBox->form('<p>' . get_lang('Are you sure you want to delete module %module% ?', array('%module%' => $moduleInfo['module_name'])) . '</p>' . '<form enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . '<input type="hidden" name="module_id" value="' . $module_id . '" />' . '<input name="cmd" type="hidden" value="exUninstall" />' . "\n" . '<input name="deleteModuleDatabase" id="deleteModuleDatabase" type="checkbox" checked="checked" />' . '<label for="deleteModuleDatabase">' . get_lang('Also delete module main database') . '</label>' . '<br />' . "\n" . '<br />' . "\n" . '<input value="' . get_lang('Continue') . '" type="submit" onclick="return confirmation(\'' . $moduleInfo['module_name'] . '\');" />' . '&nbsp;' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</form>' . "\n");
     break;
 case 'exInstall':
Beispiel #6
0
 public function uninstall($e = '', $namespace = '')
 {
     if ($e == 'module') {
         current_user()->cannot('system@manage_modules') ? $this->url->redirect(array('admin', 'index?notice=accessDenied')) : false;
         $this->load->library('form_validation');
         $this->form_validation->set_rules('module_namespace', '', 'required|trim|alpha_dash|min_length[1]');
         if ($this->form_validation->run()) {
             set_core_vars('module', $module = get_modules('filter_namespace', $this->input->post('module_namespace')), 'read_only');
             if (uninstall_module($module['namespace'])) {
                 $this->url->redirect(array('admin', 'modules', 'main', 1, 'module-has-been-installed'));
             }
         }
         set_core_vars('module', $module = get_modules('filter_namespace', $namespace), 'read_only');
         if ($module) {
             set_page('title', translate('Uninstall') . ' : ' . $module['name'] . ' - ' . translate('Dashboard'));
             set_core_vars('body', $this->load->view('admin/modules/uninstall', $this->data, true), 'read_only');
             $this->load->view('admin/header', $this->data, false, false);
             $this->load->view('admin/global_body', $this->data, false, false);
         } else {
             // $this->url->redirect(array('error','code','unactive-or-unknow-module'));
         }
     }
 }
Beispiel #7
0
/**
 * Uninstall an addon.
 *
 * @param  string			Name of the addon
 */
function uninstall_addon($name)
{
    $addon_row = read_addon_info($name);
    require_code('zones2');
    require_code('zones3');
    require_code('abstract_file_manager');
    // Clear some cacheing
    require_code('view_modes');
    require_code('zones2');
    require_code('zones3');
    erase_comcode_page_cache();
    erase_tempcode_cache();
    persistant_cache_empty();
    erase_cached_templates();
    erase_cached_language();
    global $HOOKS_CACHE;
    $HOOKS_CACHE = array();
    // Remove addon info from database, modules, blocks, and files
    $last = array();
    foreach ($addon_row['addon_files'] as $filename) {
        if (@file_exists(get_file_base() . '/' . $filename)) {
            $test = $GLOBALS['SITE_DB']->query_value('addons_files', 'COUNT(*)', array('filename' => $filename));
            if ($test <= 1) {
                if (substr($filename, 0, 37) == 'sources/hooks/systems/addon_registry/') {
                    $last[] = $filename;
                    continue;
                }
                $matches = array();
                if (preg_match('#([^/]*)/?pages/modules(_custom)?/(.*)\\.php#', $filename, $matches) != 0) {
                    uninstall_module($matches[1], $matches[3]);
                }
                if (preg_match('#sources(_custom)?/blocks/(.*)\\.php#', $filename, $matches) != 0) {
                    uninstall_block($matches[2]);
                }
                if (preg_match('#^([^/]*)/index.php#', $filename, $matches) != 0) {
                    actual_delete_zone_lite($matches[1]);
                }
                if ($filename != 'mod.inf' && $filename != 'mod.php' && $filename != '' && substr($filename, -1) != '/') {
                    $last[] = $filename;
                }
            }
        }
    }
    foreach ($last as $filename) {
        afm_delete_file($filename);
    }
    $GLOBALS['SITE_DB']->query_delete('addons_files', array('addon_name' => $addon_row['addon_name']));
    $GLOBALS['SITE_DB']->query_delete('addons_dependencies', array('addon_name' => $addon_row['addon_name']));
    $GLOBALS['SITE_DB']->query_delete('addons', array('addon_name' => $addon_row['addon_name']), '', 1);
    global $ADDON_INSTALLED_CACHE;
    unset($ADDON_INSTALLED_CACHE[$addon_row['addon_name']]);
    if (function_exists('persistent_cache_set')) {
        persistent_cache_set('ADDONS_INSTALLED', $ADDON_INSTALLED_CACHE, true);
    }
    log_it('UNINSTALL_ADDON', $addon_row['addon_name']);
}
Beispiel #8
0
 /**
  * The actualiser to uninstall a module.
  *
  * @return tempcode		The UI
  */
 function uninstall_module()
 {
     $module = post_param('module');
     $zone = post_param('zone');
     require_code('zones2');
     if ($zone != '_block') {
         uninstall_module($zone, $module);
     } else {
         uninstall_block($module);
     }
     $title = get_page_title('UNINSTALL_MODULE');
     // Show it worked / Refresh
     $url = build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $zone), '_SELF');
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
Beispiel #9
0
/**
 * function for purging a module (compleate removal)
 *
 * @param   array  options
 */
function purge_module($options)
{
    // check if module is set
    if (strlen($options['module']) == 0) {
        common::echoMessage("No such module: {$options['module']}");
        common::abort();
    }
    // check if module exists
    $module_path = conf::pathModules() . '/' . $options['module'];
    if (!file_exists($module_path)) {
        common::echoMessage("module already purged: No such module path: {$module_path}");
        common::abort();
    }
    // it exists. Uninstall
    uninstall_module($options);
    // remove
    $command = "rm -rf {$module_path}";
    common::execCommand($command);
}