Title: Check Tables Tool v1.0

Author: John Briggs

Description:
This mod will provide a tool to check mysql table(s) for errors and update the key statistics for the table.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 Final

Install Note: Before adding this mod to your forum, you should back up all files related to this mod.

License Note: This mod is released under the GPL License. A copy is provided with this software.

Author Note:
You downloaded this hack from XMBMods.com, the #1 source for XMB related downloads.
Please visit http://www.xmbmods.com/ for support.

=======================================================================================================================================
=======
Step 1:
=======

================================
Edit File: lang/English.lang.php
================================

================================
Add Code At Very Bottom Of File:
================================

$lang['Check_Tables'] = "Check Tables";

=======================================================================================================================================
=======
Step 2:
=======

======================================
Edit File: include/admin.users.inc.php
======================================

==========
Find Code:
==========

    &raquo;&nbsp;<a href="tools.php?action=analyzetables"><?php echo $lang['analyze']?></a><br />

===============
Add Code Below:
===============

    &raquo;&nbsp;<a href="tools.php?action=checktables"><?php echo $lang['Check_Tables']?></a><br />

=======================================================================================================================================
=======
Step 3:
=======

====================
Edit File: tools.php
====================

==========
Find Code:
==========

    case 'analyzetables':
        $start = true;

        @set_time_limit(180);
        $tables = $db->fetch_tables($dbname);
        $q = array();
        foreach ($tables as $key=>$val) {
            if ($start) {
                dump_query($db->query('ANALYZE TABLE `'.$val.'`'));
                $start = false;
            } else {
                dump_query($db->query('ANALYZE TABLE `'.$val.'`'), false);
            }
        }
        break;

===============
Add Code Below:
===============

    case 'checktables':
        $start = true;

        @set_time_limit(180);
        $tables = $db->fetch_tables($dbname);
        $q = array();
        foreach ($tables as $key=>$val) {
            if ($start) {
                dump_query($db->query('CHECK TABLE `'.$val.'`'));
                $start = false;
            } else {
                dump_query($db->query('CHECK TABLE `'.$val.'`'), false);
            }
        }
        break;

=======================================================================================================================================