[MCR] Factor PageUpdater out of WikiPage
[lhc/web/wiklou.git] / includes / changes / RecentChange.php
index eea8af3..904090f 100644 (file)
@@ -420,9 +420,9 @@ class RecentChange {
 
                # Convert mAttribs['rc_user'] etc for ActorMigration
                $user = User::newFromAnyId(
-                       isset( $row['rc_user'] ) ? $row['rc_user'] : null,
-                       isset( $row['rc_user_text'] ) ? $row['rc_user_text'] : null,
-                       isset( $row['rc_actor'] ) ? $row['rc_actor'] : null
+                       $row['rc_user'] ?? null,
+                       $row['rc_user_text'] ?? null,
+                       $row['rc_actor'] ?? null
                );
                unset( $row['rc_user'], $row['rc_user_text'], $row['rc_actor'] );
                $row += ActorMigration::newMigration()->getInsertValues( $dbw, 'rc_user', $user );
@@ -464,7 +464,7 @@ class RecentChange {
                        ) {
                                // @FIXME: This would be better as an extension hook
                                // Send emails or email jobs once this row is safely committed
-                               $dbw->onTransactionIdle(
+                               $dbw->onTransactionCommitOrIdle(
                                        function () use ( $editor, $title ) {
                                                $enotif = new EmailNotification();
                                                $enotif->notifyOnPageChange(
@@ -520,11 +520,7 @@ class RecentChange {
                                continue;
                        }
 
-                       if ( isset( $this->mExtra['actionCommentIRC'] ) ) {
-                               $actionComment = $this->mExtra['actionCommentIRC'];
-                       } else {
-                               $actionComment = null;
-                       }
+                       $actionComment = $this->mExtra['actionCommentIRC'] ?? null;
 
                        $feed = RCFeed::factory( $params );
                        $feed->notify( $this, $actionComment );
@@ -662,9 +658,9 @@ class RecentChange {
         * Makes an entry in the database corresponding to an edit
         *
         * @param string $timestamp
-        * @param Title &$title
+        * @param Title $title
         * @param bool $minor
-        * @param User &$user
+        * @param User $user
         * @param string $comment
         * @param int $oldId
         * @param string $lastTimestamp
@@ -678,7 +674,7 @@ class RecentChange {
         * @return RecentChange
         */
        public static function notifyEdit(
-               $timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp,
+               $timestamp, $title, $minor, $user, $comment, $oldId, $lastTimestamp,
                $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
                $tags = []
        ) {
@@ -739,9 +735,9 @@ class RecentChange {
         * Note: the title object must be loaded with the new id using resetArticleID()
         *
         * @param string $timestamp
-        * @param Title &$title
+        * @param Title $title
         * @param bool $minor
-        * @param User &$user
+        * @param User $user
         * @param string $comment
         * @param bool $bot
         * @param string $ip
@@ -752,7 +748,7 @@ class RecentChange {
         * @return RecentChange
         */
        public static function notifyNew(
-               $timestamp, &$title, $minor, &$user, $comment, $bot,
+               $timestamp, $title, $minor, $user, $comment, $bot,
                $ip = '', $size = 0, $newId = 0, $patrol = 0, $tags = []
        ) {
                $rc = new RecentChange;
@@ -809,8 +805,8 @@ class RecentChange {
 
        /**
         * @param string $timestamp
-        * @param Title &$title
-        * @param User &$user
+        * @param Title $title
+        * @param User $user
         * @param string $actionComment
         * @param string $ip
         * @param string $type
@@ -822,7 +818,7 @@ class RecentChange {
         * @param string $actionCommentIRC
         * @return bool
         */
-       public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type,
+       public static function notifyLog( $timestamp, $title, $user, $actionComment, $ip, $type,
                $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = ''
        ) {
                global $wgLogRestrictions;
@@ -840,8 +836,8 @@ class RecentChange {
 
        /**
         * @param string $timestamp
-        * @param Title &$title
-        * @param User &$user
+        * @param Title $title
+        * @param User $user
         * @param string $actionComment
         * @param string $ip
         * @param string $type
@@ -855,7 +851,7 @@ class RecentChange {
         * @param bool $isPatrollable Whether this log entry is patrollable
         * @return RecentChange
         */
-       public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip,
+       public static function newLogEntry( $timestamp, $title, $user, $actionComment, $ip,
                $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '',
                $revId = 0, $isPatrollable = false ) {
                global $wgRequest;
@@ -1024,7 +1020,7 @@ class RecentChange {
         */
        public function getParam( $name ) {
                $params = $this->parseParams();
-               return isset( $params[$name] ) ? $params[$name] : null;
+               return $params[$name] ?? null;
        }
 
        /**
@@ -1055,9 +1051,9 @@ class RecentChange {
                $this->mAttribs['rc_comment_data'] = null;
 
                $user = User::newFromAnyId(
-                       isset( $this->mAttribs['rc_user'] ) ? $this->mAttribs['rc_user'] : null,
-                       isset( $this->mAttribs['rc_user_text'] ) ? $this->mAttribs['rc_user_text'] : null,
-                       isset( $this->mAttribs['rc_actor'] ) ? $this->mAttribs['rc_actor'] : null
+                       $this->mAttribs['rc_user'] ?? null,
+                       $this->mAttribs['rc_user_text'] ?? null,
+                       $this->mAttribs['rc_actor'] ?? null
                );
                $this->mAttribs['rc_user'] = $user->getId();
                $this->mAttribs['rc_user_text'] = $user->getName();
@@ -1078,9 +1074,9 @@ class RecentChange {
 
                if ( $name === 'rc_user' || $name === 'rc_user_text' || $name === 'rc_actor' ) {
                        $user = User::newFromAnyId(
-                               isset( $this->mAttribs['rc_user'] ) ? $this->mAttribs['rc_user'] : null,
-                               isset( $this->mAttribs['rc_user_text'] ) ? $this->mAttribs['rc_user_text'] : null,
-                               isset( $this->mAttribs['rc_actor'] ) ? $this->mAttribs['rc_actor'] : null
+                               $this->mAttribs['rc_user'] ?? null,
+                               $this->mAttribs['rc_user_text'] ?? null,
+                               $this->mAttribs['rc_actor'] ?? null
                        );
                        if ( $name === 'rc_user' ) {
                                return $user->getId();
@@ -1093,7 +1089,7 @@ class RecentChange {
                        }
                }
 
-               return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : null;
+               return $this->mAttribs[$name] ?? null;
        }
 
        /**