/** * @param array $watchlistInfo Watchlisted pages * @return bool */ public static function onWatchlistEditorBeforeFormRender(&$watchlistInfo) { if (!isset($watchlistInfo[NS_TOPIC])) { // No topics watchlisted return true; } $ids = array_keys($watchlistInfo[NS_TOPIC]); // build array of queries to be executed all at once $queries = array(); foreach ($ids as $id) { try { $uuid = WorkflowLoaderFactory::uuidFromTitlePair(NS_TOPIC, $id); $queries[] = array('rev_type_id' => $uuid); } catch (Exception $e) { // invalid id unset($watchlistInfo[NS_TOPIC][$id]); } } /** @var Flow\Data\ManagerGroup $storage */ $storage = Container::get('storage'); /* * Now, finally find all requested topics - this will be stored in * local cache so subsequent calls (in onWatchlistEditorBuildRemoveLine) * will just find these in memory, instead of doing a bunch of network * requests. */ $storage->findMulti('PostRevision', $queries, array('sort' => 'rev_id', 'order' => 'DESC', 'limit' => 1)); return true; }