* Jamroom 5 Database Repair script
* copyright 2003 - 2012 by The Jamroom Network - All Rights Reserved
* http://www.jamroom.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. Please see the included "license.html" file.
*
* Jamroom includes works that are not developed by The Jamroom Network
* and are used under license - copies of all licenses are included and
* can be found in the "contrib" directory within the module, as well
* as within the "license.html" file.
*
* Jamroom may use modules and skins that are licensed by third party
* developers, and licensed under a different license than the Jamroom
* Core - please reference the individual module or skin license that
* is included with your download.
*
* This software is provided "as is" and any express or implied
* warranties, including, but not limited to, the implied warranties
* of merchantability and fitness for a particular purpose are
* disclaimed. In no event shall the Jamroom Network be liable for
* any direct, indirect, incidental, special, exemplary or
* consequential damages (including but not limited to, procurement
* of substitute goods or services; loss of use, data or profits;
* or business interruption) however caused and on any theory of
* liability, whether in contract, strict liability, or tort
* (including negligence or otherwise) arising from the use of this
* software, even if advised of the possibility of such damage.
* Some jurisdictions may not allow disclaimers of implied warranties
* and certain statements in the above disclaimer may not apply to
* you as regards implied warranties; the other terms and conditions
* remain enforceable notwithstanding. In some jurisdictions it is
* not permitted to limit liability and therefore such limitations
* may not apply to you.
*/
// Define our base dir
define('APP_DIR', dirname(__FILE__));
define('IN_JAMROOM_INSTALLER', 1);
define('DEFAULT_JAMROOM_SKIN', 'jrElastic');
// Typically no need to edit below here
date_default_timezone_set('UTC');
ini_set('session.auto_start', 0);
ini_set('session.use_trans_sid', 0);
ini_set('display_errors', 1);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));
session_start();
// Bring in core functionality
$_conf = array();
require_once APP_DIR . "/data/config/config.php";
require_once APP_DIR . "/modules/jrCore/include.php";
$umask = (int) sprintf('%03o', umask());
$_conf['jrCore_dir_perms'] = octdec(0 . (777 - $umask));
$_conf['jrCore_file_perms'] = octdec(0 . (666 - $umask));
// Load modules
$_mods = array('jrCore' => jrCore_meta());
$_urls = array('core' => 'jrCore');
if (is_dir(APP_DIR . "/modules")) {
if ($h = opendir(APP_DIR . "/modules")) {
while (($file = readdir($h)) !== false) {
if ($file == 'index.html' || $file == '.' || $file == '..' || $file == 'jrCore' || strpos($file, '-release-')) {
continue;
}
if (is_file(APP_DIR . "/modules/{$file}/include.php")) {
require_once APP_DIR . "/modules/{$file}/include.php";
}
$mfunc = "{$file}_meta";
if (function_exists($mfunc)) {
$_mods[$file] = $mfunc();
$murl = $_mods[$file]['url'];
$_urls[$murl] = $file;
}
}
}
closedir($h);
}
if (!isset($_REQUEST['repair'])) {
echo '
Jamroom Database Repair
This script will:
- run TRUNCATE TABLE your session and cache tables (which will empty them)
- run REPAIR TABLE on all Jamroom database tables
Press the
start repair button to begin.
';
exit;
}
echo "
Jamroom 5 Database Repairrepair tables beginning";
jrCore_db_connect();
$_rt = jrCore_db_query('SHOW TABLES','NUMERIC');
if (isset($_rt) && is_array($_rt)) {
foreach ($_rt as $tbl) {
$tbl = reset($tbl);
if (strstr($tbl, 'cache') || strstr($tbl, 'session')) {
jrCore_db_query("TRUNCATE TABLE {$tbl}");
echo "
TRUNCATE TABLE {$tbl} - OK";
}
jrCore_db_query("REPAIR TABLE {$tbl}");
echo "
REPAIR TABLE {$tbl} - OK";
}
}
echo "
Database Repair complete -
DELETE THIS SCRIPT!";
exit;
//