/** * @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 UUID[] $uuids */ public function loadMetadataBatch($uuids) { $posts = $this->loadPostsBatch($uuids); parent::loadMetadataBatch($posts); }
/** * @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); } }