/** * augmentWrite handles the case where we're trying to update the moderation score or spam score and don't want to create a new version */ public function augmentWrite(&$manipulation) { /* If we want to create a new version, do that now */ if (!$this->owner->Version || self::$generate_new_version) { self::$generate_new_version = false; parent::augmentWrite($manipulation); return; } /* Otherwise, we just change the manipulation to save to the versioned table, and rely on onAfterWrite to fix up the staged & live tables */ $class = $this->owner->class; $versions = $class . '_versions'; $manipulation[$versions] = $manipulation[$class]; unset($manipulation[$class]); unset($manipulation[$versions]['id']); $manipulation[$this->owner->class . '_versions']['where'] = "RecordID = {$this->owner->ID} AND Version = {$this->owner->Version}"; }