예제 #1
0
/**
 * Wrap moodle to chamilo side
 *
 */
function mtrace($message)
{
    ctrace($message);
}
예제 #2
0
            $actionurl = $_configuration['root_web'] . '/plugin/vchamilo/views/manage.php';
            $content .= '<div>' . $message_object->message . '</div>';
            $content .= '<form name"single" action="' . $actionurl . '">';
            $content .= '<input type="submit" name="go_btn" value="' . $plugininstance->get_lang('backtoindex') . '" />';
            $content .= '</form>';
            $tpl = new Template($tool_name, true, true, false, true, false);
            $tpl->assign('actions', '');
            $tpl->assign('message', $plugininstance->get_lang('vchamilosnapshot3'));
            $tpl->assign('content', $content);
            $tpl->display_one_col_template();
            die;
        }
    }
}
if ($action == 'clearcache') {
    ctrace("Clearing cache");
    // Removes cache directory.
    if (empty($automation)) {
        if (array_key_exists('vids', $_REQUEST)) {
            $vidlist = implode("','", $_REQUEST['vids']);
            $toclear = Database::select('*', 'vchamilo', array('where' => array("id IN ('{$vidlist}')" => array())));
        } else {
            $vid = $_REQUEST['vid'];
            if ($vid) {
                $vhosts = Database::select('*', 'vchamilo', array('where' => array('id = ?' => $vid)));
                $vhost = (object) array_pop($vhosts);
                $toclear[$vhost->id] = $vhost;
            } else {
                $toclear[0] = (object) $_configuration;
            }
        }
예제 #3
0
    echo "parsing nodelist\n";
}
$nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugininstance);
if ($options['lint']) {
    ctrace("Lint mode:\n");
    print_object($nodes);
    die;
}
if (empty($nodes)) {
    cli_error(get_string('cliemptynodelist', 'block_vmoodle'));
}
ctrace('Starting CLI processing');
foreach ($nodes as $n) {
    ctrace('Destroying node :' . $n->vhostname);
    if (!$DB->get_record('vchamilo', array('root_web' => $n->root_web))) {
        ctrace('Node does not exist. Skipping');
        continue;
    }
    /*
     * This launches automatically all steps of the controller.management.php script several times
     * with the "doadd" action and progressing in steps.
     */
    $action = "fulldeleteinstances";
    $automation = true;
    $return = (include $_configuration['root_sys'] . '/plugin/vchamilo/views/manage.controller.php');
    if ($interactive) {
        $input = readline("Continue (y/n|r) ?\n");
        if ($input == 'r' || $input == 'R') {
            $vmoodlestep--;
        } elseif ($input == 'n' || $input == 'N') {
            echo "finishing\n";
예제 #4
0
                }
                // $settingrec->type = 'setting';
                // $settingrec->category = 'Plugins';
                // $settingrec->access_url = 1;
                $settingrec->selected_value = $configsetting->value;
                if (!empty($settingrec->subkey)) {
                    $params = array('variable' => $settingrec->variable, 'subkey' => $settingrec->subkey);
                } else {
                    $params = array('variable' => $settingrec->variable);
                }
                if ($oldrec = $NDB->get_record('settings_current', $params)) {
                    ctrace("Updating {$settingrec->variable}|{$settingrec->subkey} to {$configsetting->value}\n");
                    $settingrec->id = $oldrec->id;
                    $NDB->update_record('settings_current', $settingrec, 'id');
                }
            }
        }
        $NDB->dismount();
    } else {
        ctrace('No Side CNX for setup');
    }
    if ($interactive) {
        $input = readline("Continue (y/n|r) ?\n");
        if ($input == 'r' || $input == 'R') {
            // do nothing, just continue
        } elseif ($input == 'n' || $input == 'N') {
            echo "finishing\n";
            exit;
        }
    }
}
    }
    ctrace("Fixing records");
    // Builds a new database manager on new instance to operate records
    //    $NDB = new DatabaseManager($data);
    // pluging in site name institution
    $settingstable = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
    $sitename = str_replace("'", "''", $data->sitename);
    $institution = str_replace("'", "''", $data->institution);
    $sqls[] = " UPDATE {$settingstable} SET selected_value = '{$sitename}' WHERE variable = 'siteName' AND category = 'Platform' ";
    $sqls[] = " UPDATE {$settingstable} SET selected_value = '{$institution}' WHERE variable = 'institution' AND category = 'Platform' ";
    $accessurltable = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
    $sqls[] = " UPDATE {$accessurltable} SET url = '{$data->root_web}' WHERE id = '1' ";
    foreach ($sqls as $sql) {
        Database::query($sql);
    }
    ctrace("Finished. ");
    if (!$automation) {
        echo '<a href="' . api_get_path(WEB_PLUGIN_PATH) . 'vchamilo/views/manage.php' . '">Continue</a>';
        // vchamilo_redirect(api_get_path(WEB_PLUGIN_PATH).'vchamilo/views/manage.php');
        die;
    }
}
if ($data->what == 'updateinstance') {
    unset($data->what);
    unset($data->submitbutton);
    unset($data->registeronly);
    unset($data->template);
    $data->lastcron = 0;
    $data->lastcrongap = 0;
    $data->croncount = 0;
    $data->id = $data->vid;