/** * @param ManagerGroup $storage * @param BagOStuff $cache * @param TreeRepository $treeRepo * @param DbFactory $dbFactory * @param FlowActions $actions */ public function __construct(ManagerGroup $storage, TreeRepository $treeRepo, BagOStuff $cache, DbFactory $dbFactory, FlowActions $actions) { parent::__construct($storage, $treeRepo); $this->cache = $cache; $this->dbFactory = $dbFactory; $this->actions = $actions; }
/** * @param \stdClass[] $rows List of checkuser database rows */ public function loadMetadataBatch($rows) { $needed = array(); foreach ($rows as $row) { if ($row->cuc_type != RC_FLOW || !$row->cuc_comment) { continue; } $ids = self::extractIds($row); if (!$ids) { continue; } /** @noinspection PhpUnusedLocalVariableInspection */ list($workflowId, $revisionId, $postId) = $ids; /* * We'll load all revisions based on their revision id. There could * be revisions from multiple models, so figure out what the id * actually belongs to. * This isn't really the most robust way to identify a revision * type, but it'll work for now. */ $revisionType = $postId ? 'PostRevision' : 'Header'; $needed[$revisionType][] = $revisionId; } $found = array(); foreach ($needed as $type => $uids) { $found[] = $this->storage->getMulti($type, $uids); } $count = count($found); if ($count === 0) { $results = array(); } elseif ($count === 1) { $results = reset($found); } else { $results = call_user_func_array('array_merge', $found); } if ($results) { parent::loadMetadataBatch($results); } }
/** * @param ManagerGroup $storage * @param TreeRepository $treeRepo * @param FlowActions $actions */ public function __construct(ManagerGroup $storage, TreeRepository $treeRepo, FlowActions $actions) { parent::__construct($storage, $treeRepo); $this->actions = $actions; }
/** * @param ManagerGroup $storage * @param TreeRepository $treeRepository * @param RevisionActionPermissions $permissions * @param WatchedTopicItems $watchedTopicItems */ public function __construct(ManagerGroup $storage, TreeRepository $treeRepository, RevisionActionPermissions $permissions, WatchedTopicItems $watchedTopicItems) { parent::__construct($storage, $treeRepository); $this->permissions = $permissions; $this->watchedTopicItems = $watchedTopicItems; }
/** * @param UUID[] $uuids */ public function loadMetadataBatch($uuids) { $posts = $this->loadPostsBatch($uuids); parent::loadMetadataBatch($posts); }
/** * @param ManagerGroup $storage * @param TreeRepository $treeRepository * @param RevisionActionPermissions $permissions */ public function __construct(ManagerGroup $storage, TreeRepository $treeRepository, RevisionActionPermissions $permissions) { parent::__construct($storage, $treeRepository); $this->permissions = $permissions; }
/** * @param \stdClass[] $rows List of recentchange database rows * @param bool $isWatchlist */ public function loadMetadataBatch($rows, $isWatchlist = false) { $needed = array(); foreach ($rows as $row) { if (!isset($row->rc_source) || $row->rc_source !== RecentChangesListener::SRC_FLOW) { continue; } if (!isset($row->rc_params)) { wfDebugLog('Flow', __METHOD__ . ': Bad row without rc_params passed in $rows'); continue; } $params = unserialize($row->rc_params); if (!$params) { wfDebugLog('Flow', __METHOD__ . ": rc_params does not contain serialized content: {$row->rc_params}"); continue; } $changeData = $params['flow-workflow-change']; /** * Check to make sure revision_type exists, this is to make sure corrupted * flow recent change data doesn't throw error on the page. * See bug 59106 for more detail */ if (!isset($changeData['revision_type'])) { continue; } if ($this->excludeFromRecentChanges($changeData['action'])) { continue; } if ($isWatchlist && $this->isRecordHidden($changeData)) { continue; } $revisionType = $changeData['revision_type']; $needed[$revisionType][] = UUID::create($changeData['revision']); } $found = array(); foreach ($needed as $type => $uids) { $found[] = $this->storage->getMulti($type, $uids); } $found = array_filter($found); $count = count($found); if ($count === 0) { $results = array(); } elseif ($count === 1) { $results = reset($found); } else { $results = call_user_func_array('array_merge', $found); } if ($results) { parent::loadMetadataBatch($results); } }