Use $this->error for only error report
[moodle-linuxchix.git] / admin / innodb.php
blob194917536ade60194d720cd30b965fcd8942366b
1 <?php
3 require_once('../config.php');
4 require_once($CFG->libdir.'/adminlib.php');
5 $adminroot = admin_get_root();
6 admin_externalpage_setup('toinodb', $adminroot);
8 $confirm = optional_param('confirm', 0, PARAM_BOOL);
10 require_login();
12 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
14 admin_externalpage_print_header($adminroot);
15 print_heading('Convert all MySQL tables from MYISAM to InnoDB');
17 if ($CFG->dbfamily != 'mysql') {
18 notice('This function is for MySQL databases only!', 'index.php');
21 if (data_submitted() and $confirm and confirm_sesskey()) {
23 notify('Please be patient and wait for this to complete...', 'notifysuccess');
25 if ($tables = $db->MetaTables()) {
26 $db->debug = true;
27 foreach ($tables as $table) {
28 execute_sql("ALTER TABLE $table TYPE=INNODB; ");
30 $db->debug = false;
32 notify('... done.', 'notifysuccess');
33 print_continue('index.php');
34 admin_externalpage_print_footer($adminroot);
36 } else {
37 $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
38 notice_yesno('Are you sure you want convert all your tables to the InnoDB format?',
39 'innodb.php', 'index.php', $optionsyes, NULL, 'post', 'get');
40 admin_externalpage_print_footer($adminroot);