/** * @param stdClass $row * @return array * @throws TimestampException * @throws \Flow\Exception\FlowException * @throws \Flow\Exception\InvalidInputException */ public function update($row) { $uuid = UUID::create($row->workflow_id); switch ($row->workflow_type) { case 'discussion': $revision = $this->storage->get('Header', $uuid); break; case 'topic': // fetch topic (has same id as workflow) via RootPostLoader so // all children are populated $revision = $this->rootPostLoader->get($uuid); break; default: throw new FlowException('Unknown workflow type: ' . $row->workflow_type); } if (!$revision) { return array(); } $timestamp = $this->getUpdateTimestamp($revision)->getTimestamp(TS_MW); if ($timestamp === $row->workflow_last_update_timestamp) { // correct update timestamp already, nothing to update return array(); } return array('workflow_last_update_timestamp' => $timestamp); }
/** * @return PostRevision|null */ public function loadRootPost() { if ($this->root !== null) { return $this->root; } $rootPost = $this->rootLoader->get($this->workflow->getId()); if ($this->permissions->isAllowed($rootPost, 'view')) { // topicTitle is same as root, difference is root has children populated to full depth return $this->topicTitle = $this->root = $rootPost; } $this->addError('moderation', $this->context->msg('flow-error-not-allowed')); return null; }