Merge "Don't URL encode titles when revdeling from Special:Undelete"
[lhc/web/wiklou.git] / includes / changes / CategoryMembershipChange.php
index af6f9d9..1ff6f85 100644 (file)
@@ -19,7 +19,7 @@
  *
  * @file
  * @author Kai Nissen
- * @author Adam Shorland
+ * @author Addshore
  * @since 1.27
  */
 
@@ -65,9 +65,13 @@ class CategoryMembershipChange {
         */
        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' ];
        }
 
        /**
@@ -123,10 +127,10 @@ class CategoryMembershipChange {
                        $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
@@ -181,7 +185,7 @@ class CategoryMembershipChange {
                /** @var RecentChange $rc */
                $rc = call_user_func_array(
                        $this->newForCategorizationCallback,
-                       array(
+                       [
                                $timestamp,
                                $categoryTitle,
                                $user,
@@ -193,7 +197,7 @@ class CategoryMembershipChange {
                                $bot,
                                $ip,
                                $deleted
-                       )
+                       ]
                );
                $rc->save();
        }
@@ -246,10 +250,10 @@ class CategoryMembershipChange {
         * @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];