public function findMulti(array $queries, array $options = array())
 {
     if (count($queries) > 1) {
         throw new DataModelException(__METHOD__ . ' expects only one value in $queries', 'process-data');
     }
     $merged = $this->findHeaderHistory($queries, $options) + $this->findTopicListHistory($queries, $options) + $this->findTopicSummaryHistory($queries, $options);
     // Having merged data from 3 sources, we now have to combine it
     // (according to the current sort & limit)
     $order = isset($options['ORDER BY'][0]) && preg_match('/ASC$/', $options['ORDER BY'][0]) ? 'ASC' : 'DESC';
     if ($order === 'DESC') {
         krsort($merged);
     } else {
         ksort($merged);
     }
     if (isset($options['LIMIT'])) {
         $merged = array_splice($merged, 0, $options['LIMIT']);
     }
     $res = array($merged);
     return RevisionStorage::mergeExternalContent($res);
 }
 /**
  * Turns DB data into revision objects.
  *
  * @param ResultWrapper $rows
  * @param string $revisionClass Class of revision object to build: PostRevision|Header
  * @return array
  */
 protected function loadRevisions(ResultWrapper $rows, $revisionClass)
 {
     $revisions = array();
     foreach ($rows as $row) {
         $revisions[UUID::create($row->rev_id)->getAlphadecimal()] = (array) $row;
     }
     // get content in external storage
     $res = array($revisions);
     $res = RevisionStorage::mergeExternalContent($res);
     $revisions = reset($res);
     // we have all required data to build revision
     $mapper = $this->storage->getStorage($revisionClass)->getMapper();
     $revisions = array_map(array($mapper, 'fromStorageRow'), $revisions);
     // @todo: we may already be able to build workflowCache (and rootPostIdCache) from this DB data
     return $revisions;
 }
 /**
  * @param DbFactory $dbFactory
  * @param array|false List of external store servers available for insert
  *  or false to disable. See $wgFlowExternalStore.
  * @param TreeRepository $treeRepo
  */
 public function __construct(DbFactory $dbFactory, $externalStore, TreeRepository $treeRepo)
 {
     parent::__construct($dbFactory, $externalStore);
     $this->treeRepo = $treeRepo;
 }