update mysqltimestamps on insert and update
This commit is contained in:
parent
c81318d3ca
commit
84b5480007
|
@ -147,6 +147,7 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
{
|
{
|
||||||
$result = parent::insert();
|
$result = parent::insert();
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
$this->fixupTimestamps();
|
||||||
$this->encache(); // in case of cached negative lookups
|
$this->encache(); // in case of cached negative lookups
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -159,6 +160,7 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
}
|
}
|
||||||
$result = parent::update($orig);
|
$result = parent::update($orig);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
$this->fixupTimestamps();
|
||||||
$this->encache();
|
$this->encache();
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -529,4 +531,20 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
|
|
||||||
return $c->delete($cacheKey);
|
return $c->delete($cacheKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fixupTimestamps()
|
||||||
|
{
|
||||||
|
// Fake up timestamp columns
|
||||||
|
$columns = $this->table();
|
||||||
|
foreach ($columns as $name => $type) {
|
||||||
|
if ($type & DB_DATAOBJECT_MYSQLTIMESTAMP) {
|
||||||
|
$this->$name = common_sql_now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function debugDump()
|
||||||
|
{
|
||||||
|
common_debug("debugDump: " . common_log_objstring($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user