2004-09-21 08:40:18 +00:00
|
|
|
<?php
|
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
require_once('../config.php');
|
|
|
|
require_once($CFG->libdir.'/adminlib.php');
|
2007-04-30 17:08:34 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
admin_externalpage_setup('toinodb');
|
2006-03-06 13:22:37 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
require_login();
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2008-05-15 21:40:00 +00:00
|
|
|
admin_externalpage_print_header();
|
2009-08-06 08:17:12 +00:00
|
|
|
echo $OUTPUT->heading('Convert all MySQL tables from MYISAM to InnoDB');
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2008-11-05 00:12:30 +00:00
|
|
|
if ($DB->get_dbfamily() != 'mysql') {
|
2006-09-25 20:22:55 +00:00
|
|
|
notice('This function is for MySQL databases only!', 'index.php');
|
2008-05-15 21:40:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data_submitted() and $confirm and confirm_sesskey()) {
|
|
|
|
|
2009-08-18 04:28:40 +00:00
|
|
|
echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');
|
2008-05-15 21:40:00 +00:00
|
|
|
|
|
|
|
if ($tables = $DB->get_tables()) {
|
|
|
|
$DB->set_debug(true);
|
|
|
|
foreach ($tables as $table) {
|
|
|
|
$fulltable = $DB->get_prefix().$table;
|
|
|
|
$DB->change_database_structure("ALTER TABLE $fulltable TYPE=INNODB");
|
|
|
|
}
|
|
|
|
$DB->set_debug(false);
|
|
|
|
}
|
2009-08-18 04:28:40 +00:00
|
|
|
echo $OUTPUT->notification('... done.', 'notifysuccess');
|
|
|
|
echo $OUTPUT->continue_button('index.php');
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2008-05-15 21:40:00 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
|
2009-08-20 08:39:07 +00:00
|
|
|
$formcontinue = html_form::make_button('innodb.php', $optionsyes, get_string('yes'));
|
|
|
|
$formcancel = html_form::make_button('index.php', null, get_string('no'), 'get');
|
|
|
|
echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel);
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2008-05-15 21:40:00 +00:00
|
|
|
}
|
2004-09-21 08:40:18 +00:00
|
|
|
|
2009-11-01 10:57:00 +00:00
|
|
|
|