This commit is contained in:
nearwood 2015-05-17 22:39:19 -04:00
parent ee85b93fd1
commit 5a3503593c
2 changed files with 37 additions and 5 deletions

View File

@ -8,10 +8,6 @@ define('DB_NAME', "msqur");
define('DEBUG', FALSE);
define('DISABLE_MSQ_CACHE', FALSE);
assert_options(ASSERT_ACTIVE, DEBUG ? 1 : 0);
assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_QUIET_EVAL, 1);
error_reporting(E_ALL);
ini_set('display_errors', DEBUG ? 'On' : 'Off');
@ -21,6 +17,10 @@ ini_set('display_errors', DEBUG ? 'On' : 'Off');
//MSQUR-1
date_default_timezone_set('UTC');
assert_options(ASSERT_ACTIVE, DEBUG ? 1 : 0);
assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_QUIET_EVAL, 1);
//Setup assert() callback
function msqur_assert_handler($file, $line, $code)
{

View File

@ -172,6 +172,36 @@ class MsqurDB
return FALSE;
}
/**
* @brief Reset regingest flag.
* @param $id The metadata id
* @returns true if successful, false otherwise
*/
public function resetReingest($id)
{
if (!$this->connect()) return false;
try
{
if (DEBUG) echo '<div class="debug">Updating HTML cache...</div>';
$st = $this->db->prepare("UPDATE metadata m SET m.reingest=FALSE WHERE m.id = :id");
$this->tryBind($st, ":id", $id);
if ($st->execute())
{
if (DEBUG) echo '<div class="debug">Reingest reset.</div>';
return true;
}
else
if (DEBUG) echo '<div class="warn">Unable to update cache.</div>';
}
catch (PDOException $e)
{
$this->dbError($e);
}
return false;
}
/**
* @brief Get MSQ HTML from metadata $id
* @param $id The metadata id
@ -187,7 +217,8 @@ class MsqurDB
if ($this->needReingest($id))
{
if (DEBUG) echo '<div class="debug info">Reingest flagged.</div>';
if (DEBUG) echo '<div class="debug info">Flagged for reingest.</div>';
$this->resetReingest($id);
return FALSE;
}
@ -300,6 +331,7 @@ class MsqurDB
if (!array_keys_exist($engine, 'nCylinders', 'twoStroke', 'injType', 'nInjectors', 'engineType'))
{
echo '<div class="warn">Incomplete engine information.</div>';
var_export($engine);
return false;
}