2014-08-16 00:26:42 +00:00
|
|
|
<?php
|
|
|
|
|
2014-08-16 07:00:08 +00:00
|
|
|
/**
|
|
|
|
* Cache class that maps article id to Title object
|
|
|
|
*/
|
2014-08-16 00:26:42 +00:00
|
|
|
class EchoTitleLocalCache extends EchoLocalCache {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var EchoTitleLocalCache
|
|
|
|
*/
|
|
|
|
private static $instance;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a TitleLocalCache object
|
2015-06-02 02:03:21 +00:00
|
|
|
* @return EchoTitleLocalCache
|
2014-08-16 00:26:42 +00:00
|
|
|
*/
|
|
|
|
public static function create() {
|
|
|
|
if ( !self::$instance ) {
|
|
|
|
self::$instance = new EchoTitleLocalCache();
|
|
|
|
}
|
2015-10-01 13:48:52 +00:00
|
|
|
|
2014-08-16 00:26:42 +00:00
|
|
|
return self::$instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-08-09 15:20:55 +00:00
|
|
|
* @inheritDoc
|
2014-08-16 00:26:42 +00:00
|
|
|
*/
|
|
|
|
protected function resolve() {
|
|
|
|
if ( $this->lookups ) {
|
|
|
|
$titles = Title::newFromIDs( $this->lookups );
|
|
|
|
foreach ( $titles as $title ) {
|
|
|
|
$this->targets->set( $title->getArticleId(), $title );
|
|
|
|
}
|
2016-12-05 18:51:07 +00:00
|
|
|
$this->lookups = [];
|
2014-08-16 00:26:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|