این کد را بزار توی کرون جابت و هر مثلا یک ساعت یک بار اجراش کن
کد PHP:
<?php
// Check and repair all tables in a PHPBB structure
// Author: espicom aka Jeff Brenton
// verify that we're supposed to run
// change 'PX42m3' to something unique for your site, so it will only
// execute if you call it as 'http://mysite.com/fixtables.php?PX42m3=1'
if (!isset($_GET['PX42m3']))
{
header("Location: http://127.0.0.1/");
die();
}
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'config.php');
// connect to the database server
$db = mysql_connect($dbhost,$dbuser,$dbpasswd);
if (!$db) die("Unable to connect to database!\n");
// select the PHPBB database
mysql_select_db($dbname,$db);
// get a list of tables for this PHPBB
$tablequery = "show tables like '".$table_prefix."%'";
$tablelist = mysql_query($tablequery,$db);
// cycle through them for repair
while ($tar = mysql_fetch_array($tablelist))
{
$tablename = $tar[0];
// output some verbosity for comfort
echo "Now checking and repairing table $tablename ... ";
$repres = mysql_query("REPAIR table $tablename");
$result = mysql_fetch_array($repres);
echo $result['Msg_text'] . "<br>\n";
}
?>