/** * Create a new revision object for the provided EPRevisionedObject. * The EPRevisionedObject should have all it's fields loaded. * * @since 0.1 * * @param EPDBObject $object * @param EPRevisionAction $revAction * * @return EPRevision */ public static function newFromObject(EPRevisionedObject $object, EPRevisionAction $revAction) { $fields = array('object_id' => $object->getId(), 'user_id' => $revAction->getUser()->getID(), 'user_text' => $revAction->getUser()->getName(), 'type' => get_class($object), 'comment' => $revAction->getComment(), 'minor_edit' => $revAction->isMinor(), 'time' => $revAction->getTime(), 'deleted' => $revAction->isDelete(), 'data' => serialize($object->toArray())); $identifier = $object->getIdentifier(); if (!is_null($identifier)) { $fields['object_identifier'] = $identifier; } return new static($fields); }
/** * Log an action. * * @since 0.1 * * @param string $subType */ protected function log($subType) { if ($this->log) { $info = $this->getLogInfo($subType); if ($info !== false) { if ($this->revAction !== false) { $info['user'] = $this->revAction->getUser(); $info['comment'] = $this->revAction->getComment(); } $info['subtype'] = $subType; EPUtils::log($info); } } }