mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-14 11:16:16 +00:00
93136b71ac
Various selectFields() methods were deprecated in MediaWiki core change Idcfd1556, replaced with getQueryInfo() methods. Change-Id: I5d62ad76fdb64a9c6efd228f27e9b5f512f17d5e Depends-On: Idcfd15568489d9f03a7ba4460e96610d33bc4089
51 lines
973 B
PHP
51 lines
973 B
PHP
<?php
|
|
|
|
/**
|
|
* Cache class that maps revision id to Revision object
|
|
*/
|
|
class EchoRevisionLocalCache extends EchoLocalCache {
|
|
|
|
/**
|
|
* @var EchoRevisionLocalCache
|
|
*/
|
|
private static $instance;
|
|
|
|
/**
|
|
* Create a EchoRevisionLocalCache object
|
|
* @return EchoRevisionLocalCache
|
|
*/
|
|
public static function create() {
|
|
if ( !self::$instance ) {
|
|
self::$instance = new EchoRevisionLocalCache();
|
|
}
|
|
|
|
return self::$instance;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected function resolve() {
|
|
if ( $this->lookups ) {
|
|
// @Todo Add newFromIds() to Revision
|
|
$dbr = wfGetDB( DB_REPLICA );
|
|
$revQuery = Revision::getQueryInfo( [ 'page', 'user' ] );
|
|
$res = $dbr->select(
|
|
$revQuery['tables'],
|
|
$revQuery['fields'],
|
|
[ 'rev_id' => $this->lookups ],
|
|
__METHOD__,
|
|
[],
|
|
$revQuery['joins']
|
|
);
|
|
if ( $res ) {
|
|
foreach ( $res as $row ) {
|
|
$this->targets->set( $row->rev_id, new Revision( $row ) );
|
|
}
|
|
$this->lookups = [];
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|