getDB(); $res = $this->getResult(); $cache = ObjectCache::getMainWANInstance(); $cachekey = $cache->makeKey( self::MCACHE_KEY ); $data = $cache->getWithSetCallback( $cachekey, self::CACHE_TTL, function () use ( $db ) { $out = []; $res = ( new AllinfoboxesQueryPage() )->doQuery(); while ( $row = $res->fetchObject() ) { $out[] = [ 'pageid' => $row->value, 'title' => $row->title, 'label' => $this->createLabel( $row->title ), 'ns' => $row->namespace ]; } return $out; } ); foreach ( $data as $id => $infobox ) { $res->addValue( [ 'query', 'allinfoboxes' ], null, $infobox ); } $res->addIndexedTagName( [ 'query', 'allinfoboxes' ], 'i' ); } public function getVersion() { return __CLASS__ . '$Id$'; } /** * @desc As a infobox template label we want to return a nice, clean text, without e.g. '_' signs * @param $text infobox template title * @return String */ private function createLabel( $text ) { $title = Title::newFromText( $text, NS_TEMPLATE ); if ( $title ) { return $title->getText(); } return $text; } }