Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/tool/innodb/index.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00026 define('NO_OUTPUT_BUFFERING', true);
00027 
00028 require_once('../../../config.php');
00029 require_once($CFG->libdir.'/adminlib.php');
00030 
00031 admin_externalpage_setup('toolinnodb');
00032 
00033 $confirm = optional_param('confirm', 0, PARAM_BOOL);
00034 
00035 require_login();
00036 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
00037 
00038 echo $OUTPUT->header();
00039 echo $OUTPUT->heading('Convert all MySQL tables from MYISAM to InnoDB');
00040 
00041 if ($DB->get_dbfamily() != 'mysql') {
00042     notice('This function is for MySQL databases only!', new moodle_url('/admin/'));
00043 }
00044 
00045 if (data_submitted() and $confirm and confirm_sesskey()) {
00046 
00047     echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');
00048 
00049     if ($tables = $DB->get_tables()) {
00050         $DB->set_debug(true);
00051         foreach ($tables as $table) {
00052             $fulltable = $DB->get_prefix().$table;
00053             $DB->change_database_structure("ALTER TABLE $fulltable ENGINE=INNODB");
00054         }
00055         $DB->set_debug(false);
00056     }
00057     echo $OUTPUT->notification('... done.', 'notifysuccess');
00058     echo $OUTPUT->continue_button(new moodle_url('/admin/'));
00059     echo $OUTPUT->footer();
00060 
00061 } else {
00062     $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
00063     $formcontinue = new single_button(new moodle_url('/admin/tool/innodb/index.php', $optionsyes), get_string('yes'));
00064     $formcancel = new single_button(new moodle_url('/admin/'), get_string('no'), 'get');
00065     echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel);
00066     echo $OUTPUT->footer();
00067 }
00068 
00069 
 All Data Structures Namespaces Files Functions Variables Enumerations