public function updateRevision($columnPrefix, DatabaseBase $dbw, $continue = null) { $rows = $dbw->select('flow_revision', array('rev_id', 'rev_type'), array('rev_id > ' . $dbw->addQuotes($continue), "{$columnPrefix}_id > 0", "{$columnPrefix}_ip IS NOT NULL"), __METHOD__, array('LIMIT' => $this->mBatchSize, 'ORDER BY' => 'rev_id')); $ids = $objs = array(); foreach ($rows as $row) { $id = UUID::create($row->rev_id); $type = self::$types[$row->rev_type]; $om = $this->storage->getStorage($type); $obj = $om->get($id); if ($obj) { $om->merge($obj); $ids[] = $row->rev_id; $objs[] = $obj; } else { $this->error(__METHOD__ . ": Failed loading {$type}: " . $id->getAlphadecimal()); } } if (!$ids) { return null; } $dbw->update('flow_revision', array("{$columnPrefix}_ip" => null), array('rev_id' => $ids), __METHOD__); foreach ($objs as $obj) { $this->storage->cachePurge($obj); } $this->completeCount += count($ids); return end($ids); }
/** * @param Iterator $it * @param integer $oldUserId * @param callable $callback Receives a single row, returns domain object or null * @param string $userTupleGetter Method to call on domain object that will return * a UserTuple instance. */ protected function purgeTable(Iterator $it, $oldUserId, $callback, $userTupleGetter) { foreach ($it as $batch) { foreach ($batch as $pkRow) { $obj = call_user_func($callback, $pkRow); if (!$obj) { continue; } // This is funny looking because the loaded objects may have come from // the db with new user ids, or the cache with old user ids. // We need to tweak this object to look like the old user ids and then // purge caches so they get the old user id cache keys. $tuple = call_user_func(array($obj, $userTupleGetter)); if (!$tuple) { continue; } $tuple->id = $oldUserId; $om = $this->storage->getStorage(get_class($obj)); $om->clear(); $om->merge($obj); $om->cachePurge($obj); } $this->storage->clear(); } }
/** * @param Title|false $title * @param UUID $workflowId * @return Workflow * @throws InvalidInputException */ protected function loadWorkflowById($title, $workflowId) { /** @var Workflow $workflow */ $workflow = $this->storage->getStorage('Workflow')->get($workflowId); if (!$workflow) { throw new UnknownWorkflowIdException('Invalid workflow requested by id', 'invalid-input'); } if ($title !== false && $this->pageMoveInProgress === false && !$workflow->matchesTitle($title)) { throw new InvalidInputException('Flow workflow is for different page', 'invalid-input'); } return $workflow; }