private $templateTimestamp = null;
/** @var array Cache that maps a Title DB key to revision ID for the requested timestamp */
- private $idCache = array();
+ private $idCache = [];
function __construct() {
parent::__construct();
function execute() {
if ( $this->hasOption( 'tpl-time' ) ) {
$this->templateTimestamp = wfTimestamp( TS_MW, strtotime( $this->getOption( 'tpl-time' ) ) );
- Hooks::register( 'BeforeParserFetchTemplateAndtitle', array( $this, 'onFetchTemplate' ) );
+ Hooks::register( 'BeforeParserFetchTemplateAndtitle', [ $this, 'onFetchTemplate' ] );
}
$title = Title::newFromText( $this->getArg() );
* @return bool|string Revision ID, or false if not found or error
*/
function getRevIdForTime( Title $title, $timestamp ) {
- $dbr = $this->getDB( DB_SLAVE );
+ $dbr = $this->getDB( DB_REPLICA );
$id = $dbr->selectField(
- array( 'revision', 'page' ),
+ [ 'revision', 'page' ],
'rev_id',
- array(
+ [
'page_namespace' => $title->getNamespace(),
'page_title' => $title->getDBkey(),
'rev_timestamp <= ' . $dbr->addQuotes( $timestamp )
- ),
+ ],
__METHOD__,
- array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 1 ),
- array( 'revision' => array( 'INNER JOIN', 'rev_page=page_id' ) )
+ [ 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 1 ],
+ [ 'revision' => [ 'INNER JOIN', 'rev_page=page_id' ] ]
);
return $id;