Use "Unknown user" instead of an empty user name.
[lhc/web/wiklou.git] / includes / changes / ChangesList.php
index ac8b3d4..fea31b4 100644 (file)
@@ -44,7 +44,7 @@ class ChangesList extends ContextSource {
        /** @var callable */
        protected $changeLinePrefixer;
 
-       /** @var BagOStuff */
+       /** @var MapCacheLRU */
        protected $watchMsgCache;
 
        /**
@@ -72,7 +72,7 @@ class ChangesList extends ContextSource {
                        $this->skin = $obj;
                }
                $this->preCacheMessages();
-               $this->watchMsgCache = new HashBagOStuff( [ 'maxKeys' => 50 ] );
+               $this->watchMsgCache = new MapCacheLRU( 50 );
                $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
                $this->filterGroups = $filterGroups;
        }
@@ -602,10 +602,9 @@ class ChangesList extends ContextSource {
                if ( $count <= 0 ) {
                        return '';
                }
-               $cache = $this->watchMsgCache;
-               return $cache->getWithSetCallback(
-                       $cache->makeKey( 'watching-users-msg', $count ),
-                       $cache::TTL_INDEFINITE,
+
+               return $this->watchMsgCache->getWithSetCallback(
+                       "watching-users-msg:$count",
                        function () use ( $count ) {
                                return $this->msg( 'number_of_watching_users_RCview' )
                                        ->numParams( $count )->escaped();
@@ -652,7 +651,8 @@ class ChangesList extends ContextSource {
                }
        }
 
-       /** Inserts a rollback link
+       /**
+        * Insert a rollback link
         *
         * @param string &$s
         * @param RecentChange &$rc
@@ -661,15 +661,14 @@ class ChangesList extends ContextSource {
                if ( $rc->mAttribs['rc_type'] == RC_EDIT
                        && $rc->mAttribs['rc_this_oldid']
                        && $rc->mAttribs['rc_cur_id']
+                       && $rc->getAttribute( 'page_latest' ) == $rc->mAttribs['rc_this_oldid']
                ) {
-                       $page = $rc->getTitle();
-                       /** Check for rollback and edit permissions, disallow special pages, and only
+                       $title = $rc->getTitle();
+                       /** Check for rollback permissions, disallow special pages, and only
                         * show a link on the top-most revision */
-                       if ( $this->getUser()->isAllowed( 'rollback' )
-                               && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid']
-                       ) {
+                       if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) {
                                $rev = new Revision( [
-                                       'title' => $page,
+                                       'title' => $title,
                                        'id' => $rc->mAttribs['rc_this_oldid'],
                                        'user' => $rc->mAttribs['rc_user'],
                                        'user_text' => $rc->mAttribs['rc_user_text'],