mediawiki-extensions-Echo/includes/cache/TitleLocalCache.php
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00

39 lines
679 B
PHP

<?php
/**
* Cache class that maps article id to Title object
*/
class EchoTitleLocalCache extends EchoLocalCache {
/**
* @var EchoTitleLocalCache
*/
private static $instance;
/**
* Create a TitleLocalCache object
* @return EchoTitleLocalCache
*/
public static function create() {
if ( !self::$instance ) {
self::$instance = new EchoTitleLocalCache();
}
return self::$instance;
}
/**
* {@inheritDoc}
*/
protected function resolve() {
if ( $this->lookups ) {
$titles = Title::newFromIDs( $this->lookups );
foreach ( $titles as $title ) {
$this->targets->set( $title->getArticleId(), $title );
}
$this->lookups = [];
}
}
}