[ Index ] |
|
Code source de GeekLog 1.4.1 |
1 <?php 2 3 /* Reminder: always indent with 4 spaces (no tabs). */ 4 // +---------------------------------------------------------------------------+ 5 // | Geeklog 1.3 | 6 // +---------------------------------------------------------------------------+ 7 // | toinnodb.php | 8 // | | 9 // | Change Geeklog tables from MyISAM to InnoDB. | 10 // +---------------------------------------------------------------------------+ 11 // | Copyright (C) 2004 by the following authors: | 12 // | | 13 // | Authors: Dirk Haun - dirk@haun-online.de | 14 // +---------------------------------------------------------------------------+ 15 // | | 16 // | This program is free software; you can redistribute it and/or | 17 // | modify it under the terms of the GNU General Public License | 18 // | as published by the Free Software Foundation; either version 2 | 19 // | of the License, or (at your option) any later version. | 20 // | | 21 // | This program is distributed in the hope that it will be useful, | 22 // | but WITHOUT ANY WARRANTY; without even the implied warranty of | 23 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 24 // | GNU General Public License for more details. | 25 // | | 26 // | You should have received a copy of the GNU General Public License | 27 // | along with this program; if not, write to the Free Software Foundation, | 28 // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 29 // | | 30 // +---------------------------------------------------------------------------+ 31 // 32 // $Id: toinnodb.php,v 1.1 2004/08/14 09:05:11 dhaun Exp $ 33 34 require_once ('../../lib-common.php'); 35 36 // bail if user isn't a root user 37 if (!SEC_inGroup ('Root')) { 38 $display = COM_siteHeader ('menu'); 39 $display .= COM_startBlock ($MESSAGE[30], '', 40 COM_getBlockTemplate ('_msg_block', 'header')); 41 $display .= $LANG20[6]; 42 $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer')); 43 $display .= COM_siteFooter (); 44 COM_accessLog ("User {$_USER['username']} tried to illegally access the optimize database screen."); 45 echo $display; 46 exit; 47 } 48 49 /** 50 * Check for InnoDB table support (usually as of MySQL 4.0, but may be 51 * available in earlier versions, e.g. "Max" or custom builds). 52 * 53 * @return true = InnoDB tables supported, false = not supported 54 * 55 */ 56 function innodb_supported () 57 { 58 $result = DB_query ("SHOW VARIABLES LIKE 'have_innodb'"); 59 $A = DB_fetchArray ($result, true); 60 61 if (strcasecmp ($A[1], 'yes') == 0) { 62 $retval = true; 63 } else { 64 $retval = false; 65 } 66 67 return $retval; 68 } 69 70 71 // MAIN 72 73 echo COM_siteHeader ('menu'); 74 echo COM_startBlock ('Changing tables to InnoDB'); 75 76 if (innodb_supported ()) { 77 78 echo '<p>This may take a while ...</p>' . LB; 79 flush (); 80 81 $opt_time = new timerobject (); 82 $opt_time->startTimer (); 83 84 $result = DB_query ("SHOW TABLES"); 85 $numTables = DB_numRows ($result); 86 for ($i = 0; $i < $numTables; $i++) { 87 $A = DB_fetchArray ($result, true); 88 if (in_array ($A[0], $_TABLES)) { 89 DB_query ("ALTER TABLE $A[0] TYPE=InnoDB"); 90 } 91 } 92 93 $exectime = $opt_time->stopTimer (); 94 95 echo '<p>Changing ' . sizeof ($_TABLES) . ' tables to InnoDB took ' 96 . $exectime . ' seconds.<p>' . LB; 97 98 } else { 99 100 echo '<p>Sorry, your database does not support InnoDB tables.</p>' . LB; 101 102 } 103 104 echo COM_endBlock (); 105 echo COM_siteFooter (); 106 107 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |