Skip to content

Commit

Permalink
Fix ENGINE (not TYPE), skip INNODB tables
Browse files Browse the repository at this point in the history
  • Loading branch information
stealth35 committed Mar 28, 2011
1 parent 92a387b commit 021c50b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions admin/innodb.php
Expand Up @@ -23,10 +23,14 @@
echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');

if ($tables = $DB->get_tables()) {
$DB->set_debug(true);
foreach ($tables as $table) {
$DB->set_debug(false);
$fulltable = $DB->get_prefix().$table;
$DB->change_database_structure("ALTER TABLE $fulltable TYPE=INNODB");
$rs = $DB->get_records_sql("SHOW TABLE STATUS LIKE '$fulltable'");
if(strtoupper($rs[$fulltable]->engine) !== 'INNODB') {
$DB->set_debug(true);
$DB->change_database_structure("ALTER TABLE `$fulltable` ENGINE = INNODB");
}
}
$DB->set_debug(false);
}
Expand All @@ -40,6 +44,4 @@
$formcancel = new single_button(new moodle_url('/admin/index.php'), get_string('no'), 'get');
echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel);
echo $OUTPUT->footer();
}


}

0 comments on commit 021c50b

Please sign in to comment.