2004-09-21 08:40:18 +00:00
|
|
|
<?php
|
|
|
|
|
2006-03-06 13:22:37 +00:00
|
|
|
require_once('../config.php');
|
2006-09-25 20:22:55 +00:00
|
|
|
require_once($CFG->libdir.'/adminlib.php');
|
2007-04-30 17:08:34 +00:00
|
|
|
|
|
|
|
admin_externalpage_setup('toinodb');
|
2006-03-06 13:22:37 +00:00
|
|
|
|
|
|
|
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
2004-09-21 08:40:18 +00:00
|
|
|
|
|
|
|
require_login();
|
|
|
|
|
2008-05-02 04:37:02 +00:00
|
|
|
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2007-04-30 17:08:34 +00:00
|
|
|
admin_externalpage_print_header();
|
2006-09-25 20:22:55 +00:00
|
|
|
print_heading('Convert all MySQL tables from MYISAM to InnoDB');
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2007-01-12 00:06:08 +00:00
|
|
|
if ($CFG->dbfamily != 'mysql') {
|
2006-09-25 20:22:55 +00:00
|
|
|
notice('This function is for MySQL databases only!', 'index.php');
|
|
|
|
}
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2006-09-25 20:22:55 +00:00
|
|
|
if (data_submitted() and $confirm and confirm_sesskey()) {
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2006-09-25 20:22:55 +00:00
|
|
|
notify('Please be patient and wait for this to complete...', 'notifysuccess');
|
2004-09-21 08:40:18 +00:00
|
|
|
|
|
|
|
if ($tables = $db->MetaTables()) {
|
|
|
|
$db->debug = true;
|
|
|
|
foreach ($tables as $table) {
|
|
|
|
execute_sql("ALTER TABLE $table TYPE=INNODB; ");
|
|
|
|
}
|
2006-09-25 20:22:55 +00:00
|
|
|
$db->debug = false;
|
2004-09-21 08:40:18 +00:00
|
|
|
}
|
2006-09-25 20:22:55 +00:00
|
|
|
notify('... done.', 'notifysuccess');
|
|
|
|
print_continue('index.php');
|
2007-04-30 17:08:34 +00:00
|
|
|
admin_externalpage_print_footer();
|
2006-09-25 20:22:55 +00:00
|
|
|
|
2004-09-21 08:40:18 +00:00
|
|
|
} else {
|
2006-09-25 20:22:55 +00:00
|
|
|
$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');
|
2007-04-30 17:08:34 +00:00
|
|
|
admin_externalpage_print_footer();
|
2004-09-21 08:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|