The first version of this code failed to work on 5.1 so here is a
version that does:
if(DATABASE_REPLICATION_CHECK)
{
$result = mysql_query("show slave status;");
$row = mysql_fetch_assoc($result);
if( ($row['Slave_IO_Running']!='Yes') || ($row['Slave_SQL_Running']!='Yes') )
{
$fp = fopen('tmp/halt', 'w+');
fclose($fp);
header('Location: index.php');
}
}
Remember to add something like:
if(file_exists('tmp/halt')) exit('Unable to complete request at this time');
at the start of your app execution so as to stop users entering
data that can cause all kinds of living nightmares when it comes
to patching the data together.
--
Copyright 2006-2008 Andrew Rose [rose.andrew@gmail.com] [andrewrose.co.uk]