[DATABASE] Update "modified" in Managed_DataObject instead of a DBMS trigger
Instead of relying on the MariaDB's ON UPDATE CURRENT_TIMESTAMP trigger update "modified" attributes in Managed_DataObject. Every raw query that needs adjusting is adjusted, as they won't update "modified" automatically anymore. The main goal behind this change is to fix "modified" updates on PostgreSQL.
This commit is contained in:
@@ -443,7 +443,6 @@ class Memcached_DataObject extends Safe_DataObject
|
||||
{
|
||||
$result = parent::insert();
|
||||
if ($result) {
|
||||
$this->fixupTimestamps();
|
||||
$this->encache(); // in case of cached negative lookups
|
||||
}
|
||||
return $result;
|
||||
@@ -456,7 +455,6 @@ class Memcached_DataObject extends Safe_DataObject
|
||||
}
|
||||
$result = parent::update($dataObject);
|
||||
if ($result !== false) {
|
||||
$this->fixupTimestamps();
|
||||
$this->encache();
|
||||
}
|
||||
return $result;
|
||||
@@ -931,22 +929,6 @@ class Memcached_DataObject extends Safe_DataObject
|
||||
return $c->delete($cacheKey);
|
||||
}
|
||||
|
||||
public function fixupTimestamps()
|
||||
{
|
||||
// Fake up timestamp columns
|
||||
$columns = $this->table();
|
||||
foreach ($columns as $name => $type) {
|
||||
if ($type & DB_DATAOBJECT_MYSQLTIMESTAMP) {
|
||||
$this->$name = common_sql_now();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function debugDump()
|
||||
{
|
||||
common_debug("debugDump: " . common_log_objstring($this));
|
||||
}
|
||||
|
||||
public function raiseError($message, $type = null, $behavior = null)
|
||||
{
|
||||
$id = get_class($this);
|
||||
|
Reference in New Issue
Block a user