Remove old mysql_ cache purging code, fix type inconsistency bug in cache purging, and fix a bug in the debugger (oh, the irony)

develop
Sven Slootweg 11 years ago
parent 3fbfad8656
commit 113404d563

@ -543,24 +543,13 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
public function PurgeCache()
{
if(strpos($this->fill_query, ":Id") !== false)
{
$fill_query = str_replace(":Id", "'%d'", $this->fill_query);
}
else
{
$fill_query = $this->fill_query;
}
$query = sprintf($fill_query, $this->sId);
$key = md5($query) . md5($query . "x");
$parameters = array(":Id" => (string) $this->sId);
$query_hash = md5($this->fill_query);
$parameter_hash = md5(serialize(array(':Id' => (int) $this->sId)));
$pdo_key = $query_hash . $parameter_hash;
$parameter_hash = md5(serialize($parameters));
$cache_hash = $query_hash . $parameter_hash;
mc_delete($key);
mc_delete($pdo_key);
mc_delete($cache_hash);
}
public function RenderTemplate($template = "")

@ -221,7 +221,7 @@ function cphp_debug_display($data)
function createElements(source, key, hierarchy)
{
var item;
var id = hierarchy + "_" + key;
var id = hierarchy + "_" + key.replace(/[^a-z0-9_]/gi,'');
if($.isArray(source))
{
@ -250,7 +250,7 @@ function cphp_debug_display($data)
function updateElements(source, key, hierarchy)
{
var item;
var id = hierarchy + "_" + key;
var id = hierarchy + "_" + key.replace(/[^a-z0-9_]/gi,'');
if($.isArray(source))
{

@ -38,6 +38,9 @@ class CachedPDO extends PDO
{
public function CachedQuery($query, $parameters = array(), $expiry = 60)
{
/* TODO: Do type guessing before checking cache, so as to avoid
* different parameter hashes depending on input type for
* numbers. */
$query_hash = md5($query);
$parameter_hash = md5(serialize($parameters));
$cache_hash = $query_hash . $parameter_hash;

Loading…
Cancel
Save