// BE VERY CAREFUL USING THIS!
require_once('../config.php');
+ require_once($CFG->libdir.'/adminlib.php');
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('purgemoodledata', $adminroot);
require_login();
$deletedir = $CFG->dataroot; // The directory to delete!
+ admin_externalpage_print_header($adminroot);
+ print_heading('Purge moodledata');
+
if (empty($sure)) {
- notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', 'delete.php?sure=yes&sesskey='.sesskey(), 'index.php');
+ $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey());
+ notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?',
+ 'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
+ admin_externalpage_print_footer($adminroot);
exit;
}
- if (empty($reallysure)) {
- notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?', 'delete.php?sure=yes&reallysure=yes&sesskey='.sesskey(), 'index.php');
+ if (!data_submitted() or empty($reallysure)) {
+ $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes');
+ notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?',
+ 'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
+ admin_externalpage_print_footer($adminroot);
exit;
}
echo '<h1 align="center">Done!</h1>';
print_continue($CFG->wwwroot);
+ admin_externalpage_print_footer($adminroot);
exit;
$extraws = '';
while (true) {
$extraws .= ob_get_contents();
- if (!@ob_end_clean()) { //
+ if (!@ob_end_clean()) {
break;
}
}
+ require_once($CFG->libdir.'/adminlib.php');
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('healthcenter', $adminroot);
+
define('SEVERITY_NOTICE', 'notice');
define('SEVERITY_ANNOYANCE', 'annoyance');
define('SEVERITY_SIGNIFICANT', 'significant');
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
$site = get_site();
- $stradmin = get_string('administration');
- $strhealthcenter = get_string('healthcenter');
- $strmisc = get_string('miscellaneous');
- print_header($site->shortname.': '.$strhealthcenter, $site->fullname,
- '<a href="index.php">'.$stradmin.'</a> -> <a href="misc.php">'.$strmisc.'</a> ->'.
- $strhealthcenter);
+ admin_externalpage_print_header($adminroot);
echo <<<STYLES
<style type="text/css">
}
- print_footer();
+ admin_externalpage_print_footer($adminroot);
function health_find_problems() {
<?php
require_once('../config.php');
+ require_once($CFG->libdir.'/adminlib.php');
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('toinodb', $adminroot);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
- print_header("Convert all tables from MYISAM to InnoDB", "Convert all tables from MYISAM to InnoDB",
- "Convert all tables from MYISAM to InnoDB");
+ admin_externalpage_print_header($adminroot);
+ print_heading('Convert all MySQL tables from MYISAM to InnoDB');
+ if ($CFG->dbtype != 'mysql') {
+ notice('This function is for MySQL databases only!', 'index.php');
+ }
- if ($confirm and confirm_sesskey()) {
+ if (data_submitted() and $confirm and confirm_sesskey()) {
- print_heading("Please be patient and wait for this to complete...");
+ notify('Please be patient and wait for this to complete...', 'notifysuccess');
if ($tables = $db->MetaTables()) {
$db->debug = true;
foreach ($tables as $table) {
execute_sql("ALTER TABLE $table TYPE=INNODB; ");
}
+ $db->debug = false;
}
+ notify('... done.', 'notifysuccess');
+ print_continue('index.php');
+ admin_externalpage_print_footer($adminroot);
+
} else {
- notice_yesno("Are you sure you want convert all your tables to the InnoDB format?",
- "innodb.php?confirm=1&sesskey=".sesskey(), "index.php");
+ $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
+ notice_yesno('Are you sure you want convert all your tables to the InnoDB format?',
+ 'innodb.php', 'index.php', $optionsyes, NULL, 'post', 'get');
+ admin_externalpage_print_footer($adminroot);
}
?>
if (!isset($CFG)) {
require('../config.php');
+ require_once($CFG->libdir.'/adminlib.php');
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('oacleanup', $adminroot);
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
- print_header_simple('Online Assignment Cleanup','Online Assignment Cleanup', 'Admin');
-
+ admin_externalpage_print_header($adminroot);
online_assignment_cleanup(true);
-
- print_footer();
+ admin_externalpage_print_footer($adminroot);
}
/// cycle through the instances
foreach ($instances as $instance) {
/// is this an instance of an online assignment
- $sql = "SELECT a.id
+ $sql = "SELECT a.id
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}assignment a
WHERE cm.id = '$instance' AND
set_field('course_sections', 'sequence', $section->sequence, 'id', $section->id);
-
+
if ($output) echo 'Online Assignment (instance '.$instance.') moved from section '.$section->id.': to section '.$newsection.'<br />';
}
/// Search and replace strings throughout all texts in the whole database
require_once('../config.php');
+require_once($CFG->dirroot.'/course/lib.php');
+require_once($CFG->libdir.'/adminlib.php');
+$adminroot = admin_get_root();
+admin_externalpage_setup('replace', $adminroot);
$search = optional_param('search', '', PARAM_RAW);
$replace = optional_param('replace', '', PARAM_RAW);
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
###################################################################
-print_header('Search and replace throughout the whole database', 'Replace text within the whole database');
+admin_externalpage_print_header($adminroot);
+print_heading('Search and replace text throughout the whole database');
-if (!$search or !$replace or !confirm_sesskey()) { /// Print a form
+
+if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Print a form
print_simple_box_start('center');
echo '<div align="center">';
- echo '<form action="replace.php">';
+ echo '<form action="replace.php" method="post">';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'">';
echo 'Search whole database for: <input type="text" name="search"><br />';
echo 'Replace with this string: <input type="text" name="replace"><br /></br />';
echo '</form>';
echo '</div>';
print_simple_box_end();
+ admin_externalpage_print_footer($adminroot);
die;
}
}
print_simple_box_start('center');
+
+/// Turn off time limits, sometimes upgrades can be slow.
+
+@set_time_limit(0);
+@ob_implicit_flush(true);
+while(@ob_end_flush());
+
foreach ($tables as $table) {
if (in_array($table, array($CFG->prefix.'config'))) { // Don't process these
continue;
}
}
-/// Clear course cache which might be corrupted now
-execute_sql("UPDATE ".$CFG->prefix."course SET modinfo = '' WHERE id <> ".SITEID);
-
print_simple_box_end();
+/// Rebuild course cache which might be incorrect now
+notify('Rebuilding course cache...');
+rebuild_course_cache();
+notify('...finished');
+
print_continue('index.php');
+admin_externalpage_print_footer($adminroot);
+
?>
+++ /dev/null
-<?php // $Id$
- // Display all the reports available in admin/report
-
- require_once('../config.php');
-
- require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID));
-
- $stradmin = get_string('administration');
- $strreports = get_string('reports');
- $strmisc = get_string('miscellaneous');
-
- print_header($strreports, $strreports,
- '<a href="index.php">'.$stradmin.'</a> -> <a href="misc.php">'.$strmisc.'</a> ->'.
- $strreports);
-
- $directories = get_list_of_plugins('admin/report');
-
- foreach ($directories as $directory) {
- echo '<div class="plugin '.$directory.'">';
- include_once($CFG->dirroot.'/admin/report/'.$directory.'/mod.php'); // Fragment for listing
- echo '</div>';
- }
-
- print_footer();
-?>
-
$strreports = get_string('reports');
$strcourseoverview = get_string('courseoverview');
- $strnav = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.get_string('administration').'</a> -> <a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report.php">'.$strreports.'</a> -> '.$strcourseoverview;
-
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
$tableprefix = $CFG->prefix.'stats_';
if (!empty($report) && !empty($time)) {
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
-
+
if (!empty($param->sql)) {
$sql = $param->sql ." LIMIT ".$numcourses;
} else {
$adminroot = admin_get_root();
- admin_externalpage_setup('reportcourseoverview', $adminroot);
+ admin_externalpage_setup('reportstats', $adminroot);
admin_externalpage_print_header($adminroot);
// * Miscellaneous settings (still to be sorted)
$ADMIN->add('misc', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
-
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
+// hidden scripts linked from elsewhere
+$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
+$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
+$ADMIN->add('misc', new admin_externalpage('upgradelogs', 'Upgrade logs', $CFG->wwwroot.'/'.$CFG->admin.'/upgradelogs.php', 'moodle/site:config', true));
+
?>
$ADMIN->add('root', new admin_category('reports', get_string('reports')));
foreach(get_list_of_plugins('admin/report') as $plugin) {
- $ADMIN->add('reports', new admin_externalpage('report' . $plugin, get_string($plugin, 'admin'), "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php"));
+ $ADMIN->add('reports', new admin_externalpage('report'.$plugin, get_string($plugin, 'admin'), "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php"));
}
$ADMIN->add('root', new admin_category('misc', get_string('miscellaneous')));
+// hidden unsupported category
+$ADMIN->add('root', new admin_category('unsupported', get_string('unsupported', 'admin'), true));
?>
--- /dev/null
+<?php // $Id$
+
+// This file defines settingpages and externalpages in the "unsupported" hidden category, use wisely!
+
+$ADMIN->add('unsupported', new admin_externalpage('purgemoodledata', 'Purge moodledata', $CFG->wwwroot.'/'.$CFG->admin.'/delete.php'));
+$ADMIN->add('unsupported', new admin_externalpage('healthcenter', get_string('healthcenter'), $CFG->wwwroot.'/'.$CFG->admin.'/health.php'));
+$ADMIN->add('unsupported', new admin_externalpage('toinodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/innodb.php'));
+$ADMIN->add('unsupported', new admin_externalpage('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php'));
+
+
+?>
require_once('../config.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
require_once($CFG->libdir.'/adminlib.php');
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('upgradeforumread', $adminroot);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
require_login();
-
+
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
-
+
if ($CFG->version < 2005042300) {
error("This script does not work with this old version of Moodle");
}
if (!$site = get_site()) {
- redirect("index.php");
+ redirect('index.php');
}
/// Print header
- $stradministration = get_string("administration");
- $strupgradingdata = get_string("upgradingdata", "admin");
+ $strupgradingdata = get_string('upgradingdata', 'admin');
- print_header("$site->shortname: $stradministration: $strupgradingdata", "$site->fullname",
- "<a href=\"index.php\">$stradministration</a> -> $strupgradingdata");
+ admin_externalpage_print_header($adminroot);
+ print_heading($strupgradingdata);
- if (empty($confirm)) {
- notice_yesno(get_string("upgradeforumreadinfo", "admin"),
- "upgradeforumread.php?confirm=true&sesskey=$USER->sesskey",
- "index.php");
- print_footer();
+ if (!data_submitted() or empty($confirm) or !confirm_sesskey()) {
+ $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
+ notice_yesno(get_string('upgradeforumreadinfo', 'admin'),
+ 'upgradeforumread.php', 'index.php', $optionsyes, NULL, 'post', 'get');
+ admin_externalpage_print_footer($adminroot);
exit;
- } else if (!confirm_sesskey()) {
- error(get_string('confirmsesskeybad', 'error'));
}
@set_time_limit(0);
@ob_implicit_flush(true);
- @ob_end_flush();
+ while(@ob_end_flush());
execute_sql('TRUNCATE TABLE '.$CFG->prefix.'forum_read;', false); // Trash all old entries
'Please keep this window open until it completes', '', 3);
$groups = array();
-
+
$currcourse = 0;
$users = 0;
$count = 0;
/// If this course has users, and posts more than a day old, mark them for each user.
if ($users &&
($posts = get_records_select('forum_posts', 'discussion = '.$discussion->id.
- ' AND '.$dateafter.' < modified AND modified < '.$onedayago,
+ ' AND '.$dateafter.' < modified AND modified < '.$onedayago,
'', 'id,discussion,modified'))) {
foreach ($users as $user) {
/// If its a group discussion, make sure the user is in the group.
}
print_progress($dcount, $dtotal, 0);
}
-
+
delete_records('config', 'name', 'upgrade', 'value', 'forumread');
print_continue('index.php');
- print_footer();
-
- exit;
-
+ admin_externalpage_print_footer($adminroot);
?>
<?PHP //$Id$
require_once('../config.php');
+ require_once($CFG->libdir.'/adminlib.php');
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('upgradelogs', $adminroot);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
/// Turn off time limits, sometimes upgrades can be slow.
@set_time_limit(0);
+ @ob_implicit_flush(true);
+ while(@ob_end_flush());
/// Print header
- $stradministration = get_string("administration");
$strupgradinglogs = get_string("upgradinglogs", "admin");
-
- print_header("$site->shortname: $stradministration: $strupgradinglogs", "$site->fullname",
- "<a href=\"index.php\">$stradministration</a> -> $strupgradinglogs");
-
- if (empty($confirm)) {
- notice_yesno(get_string("upgradelogsinfo", "admin"),
- "upgradelogs.php?confirm=true&sesskey=$USER->sesskey",
- "index.php");
- print_footer();
+ admin_externalpage_print_header($adminroot);
+ print_heading($strupgradinglogs);
+
+ if (!data_submitted() or empty($confirm) or !confirm_sesskey()) {
+ $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
+ notice_yesno(get_string('upgradeforumreadinfo', 'admin'),
+ 'upgradelogs.php', 'index.php', $optionsyes, NULL, 'post', 'get');
+ admin_externalpage_print_footer($adminroot);
exit;
- } else if (!confirm_sesskey()) {
- error(get_string('confirmsesskeybad', 'error'));
}
/// Try and extract as many cmids as possible from the existing logs
- if ($coursemodules = get_records_sql("SELECT cm.*, m.name
- FROM {$CFG->prefix}course_modules cm,
+ if ($coursemodules = get_records_sql("SELECT cm.*, m.name
+ FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules m
WHERE cm.module = m.id")) {
$cmcount = count($coursemodules);
}
if ($cmcount > 10) {
- print_simple_box('This process may take a very long time ... please be patient and let it finish.',
+ print_simple_box('This process may take a very long time ... please be patient and let it finish.',
'center', '', '#ffcccc');
$sleeptime = 1;
}
foreach ($coursemodules as $cm) {
- switch ($cm->name) {
+ switch ($cm->name) {
case "forum":
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'view.php?f=$cm->instance'", false);
-
+
if ($discussions = get_records("forum_discussions", "forum", $cm->instance)) {
foreach ($discussions as $discussion) {
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url $LIKE 'discuss.php?d=$discussion->id%'", false);
}
}
break;
- case "glossary":
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ case "glossary":
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url $LIKE 'view.php?id=$cm->id%'", false);
break;
- case "quiz":
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ case "quiz":
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
break;
- case "assignment":
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ case "assignment":
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'view.php?a=$cm->instance'", false);
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'submissions.php?id=$cm->instance'", false);
break;
-
- case "journal":
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+
+ case "journal":
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'report.php?id=$cm->id'", false);
- execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
+ execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = '$cm->name' AND url = 'view.php?id=$cm->id'", false);
break;
delete_records("config", "name", "upgrade", "value", "logs");
- notify("Log upgrading was successful!");
+ notify('Log upgrading was successful!', 'notifysuccess');
+ print_continue('index.php');
- print_footer();
+ admin_externalpage_print_footer($adminroot);
?>
$string['unicodeupgradenotice'] = 'In Moodle 1.6 we have migrated all languages to Unicode. To complete the upgrade for this site, you need to convert all the data in your database to Unicode using our migration script. <a href=\"utfdbmigrate.php\">Click here to run the migration script now</a>!';
$string['uninstall'] = 'Uninstall selected language pack';
$string['uninstallconfirm'] = 'You are about to completely uninstall language pack $a, are you sure?';
+$string['unsupported'] = 'Unsupported';
$string['upgradeforumread'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts.<br />To use this functionality you need to <a href=\"$a\">update your tables</a>.';
$string['upgradeforumreadinfo'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts. To use this functionality you need to update your tables with all the tracking information for existing posts. Depending on the size of your site this can take a long time (hours) and can be quite taxing on the database, so it\'s best to do it during a quiet period. However, your site will continue functioning during this upgrade and users won\'t be affected. Once you start this process you should let it finish (keep your browser window open). However, if you stop the process by closing the window: don\'t worry, you can start over.<br /><br />Do you want to start the upgrading process now?';
$string['upgradelogs'] = 'For full functionality, your old logs need to be upgraded. <a href=\"$a\">More information</a>';