*/
public function __construct( Title $pageTitle, Revision $revision = null ) {
$this->pageTitle = $pageTitle;
- $this->timestamp = wfTimestampNow();
+ if ( $revision === null ) {
+ $this->timestamp = wfTimestampNow();
+ } else {
+ $this->timestamp = $revision->getTimestamp();
+ }
$this->revision = $revision;
- $this->newForCategorizationCallback = array( 'RecentChange', 'newForCategorization' );
+ $this->newForCategorizationCallback = [ 'RecentChange', 'newForCategorization' ];
}
/**
$this->timestamp,
$categoryTitle,
$this->getUser(),
- $this->getChangeMessageText( $type, array(
+ $this->getChangeMessageText( $type, [
'prefixedText' => $this->pageTitle->getPrefixedText(),
'numTemplateLinks' => $this->numTemplateLinks
- ) ),
+ ] ),
$this->pageTitle,
$this->getPreviousRevisionTimestamp(),
$this->revision
/** @var RecentChange $rc */
$rc = call_user_func_array(
$this->newForCategorizationCallback,
- array(
+ [
$timestamp,
$categoryTitle,
$user,
$bot,
$ip,
$deleted
- )
+ ]
);
$rc->save();
}
* @return string
*/
private function getChangeMessageText( $type, array $params ) {
- $array = array(
+ $array = [
self::CATEGORY_ADDITION => 'recentchanges-page-added-to-category',
self::CATEGORY_REMOVAL => 'recentchanges-page-removed-from-category',
- );
+ ];
$msgKey = $array[$type];