Islamic Board |
07-27-2016 06:49 PM |
Quote:
Originally Posted by Zachery
(Post 2573961)
Do you have the errors or notes regarding it? I don't have a test bed for this right now but if you let me know we can look into fixing it.
|
We have modified it slightly to work with SQLite3. There doesn't seem to be any errors thrown by this script at the moment but when we tested it, we still receive multiple db error emails of the same error message, even within 1 second.
Below is the modified script for SQLite3.
Code:
/**********************************************\
|* DB Error Mail Suppressomatic (squall14716) *|
\**********************************************/
if ($sqlitedb = new SQLite3(DIR.'/sqlite3dberrors.sqlite', 0666, $sqliteerror)) {
// Time between errors. 1800 (30 minutes) by default.
// Modify config.php for easy changing of this. For example:
// $config['dbems']['timebetweenerrors'] = 1800;
//($vbulletin->config['dbems']['timebetweenerrors'] ? $timebetweenerrors = $vbulletin->config['dbems']['timebetweenerrors'] : $timebetweenerrors = 60);
$timebetweenerrors = 60; // seconds
// Database opened and ready. Let's check to see if there are recent errors of this type.
$sqlitequery = $sqlitedb->query("SELECT * FROM dberrors WHERE time > ".(TIMENOW - $timebetweenerrors).
" AND errorcode = '".$this->errno."' ORDER BY time DESC");
$suppresserrormail = false;
while ($sqliteresult = $sqlitequery->fetchArray(SQLITE3_ASSOC)) {
if ($sqliteresult['script'] == $scriptpath) {
if ($sqliteresult['errorcode'] == $this->errno) {
// Script is the same and the errorcode is the same. Let's supress this error e-mail.
$suppresserrormail = true;
}
}
if ($sqliteresult['error'] == $this->error) {
// Error message is the same. Supress this error e-mail.
$suppresserrormail = true;
}
}
if ($suppresserrormail == false) {
$sqlitedb->exec("INSERT INTO dberrors (time, error, errorcode, ipaddress, script) VALUES (".TIMENOW.
", '".SQLite3::escapeString($this->error)."', '".$this->errno."', '$ipaddress', '$scriptpath')");
} else {
$technicalemail = "";
}
// Clean the SQLite table of all irrelevant data.
$sqlitedb->exec("DELETE FROM dberrors WHERE time < ".(TIMENOW - $timebetweenerrors));
}
/**************************************************\
|* End DB Error Mail Suppressomatic (squall14716) *|
\**************************************************/
Using the dumpdberror script given in this thread, we can see that there was a single db error written in the database file, only once. It has not updated after that in subsequent tests.
|