Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php /* tools/check-tables.php */
- defined('C5_EXECUTE') or die(_('Access Denied'));
- $u = new User();
- if(!$u->isSuperUser()) { die(_('Access Denied.')); } // cheap security
- $db = Loader::db(); // load helper for database
- $outp = '<h3>Optimize</h3>';
- $tables = array();
- $r = $db->query('SHOW TABLES FROM '. DB_DATABASE);
- while ($row = $r->fetchRow()) {
- $tables[] = $row['Tables_in_'. DB_DATABASE];
- }
- sort($tables);
- foreach($tables as $table) {
- $r = $db->query('CHECK TABLE '. $table);
- $row = $r->fetchRow();
- $outp .= $table. ': '. $row['Msg_text']. '<br />';
- }
- echo $outp;
- if(isset($_GET['show'])) {
- if($r = $db->query("SHOW VARIABLES LIKE '%timeout%'"))
- while ($row = $r->fetchRow())
- echo '<br />'. $row['Variable_name']. ': '. $row['Value'];
- if($r = $db->query("SHOW STATUS LIKE '%slow%'"))
- while ($row = $r->fetchRow())
- echo '<br />'. $row['Variable_name']. ': '. $row['Value'];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment