Merge "prop=duplicatefiles does not show duplicates under same name"
[lhc/web/wiklou.git] / includes / User.php
index 2ddc79c..f43844e 100644 (file)
@@ -123,6 +123,7 @@ class User {
                'deleterevision',
                'edit',
                'editinterface',
+               'editprotected',
                'editusercssjs', #deprecated
                'editusercss',
                'edituserjs',
@@ -467,8 +468,7 @@ class User {
         * @return String|bool The corresponding username
         */
        public static function whoIs( $id ) {
-               $dbr = wfGetDB( DB_SLAVE );
-               return $dbr->selectField( 'user', 'user_name', array( 'user_id' => $id ), __METHOD__ );
+               return UserCache::singleton()->getProp( $id, 'name' );
        }
 
        /**
@@ -478,8 +478,7 @@ class User {
         * @return String|bool The corresponding user's real name
         */
        public static function whoIsReal( $id ) {
-               $dbr = wfGetDB( DB_SLAVE );
-               return $dbr->selectField( 'user', 'user_real_name', array( 'user_id' => $id ), __METHOD__ );
+               return UserCache::singleton()->getProp( $id, 'real_name' );
        }
 
        /**
@@ -1767,16 +1766,22 @@ class User {
                        # Check memcached separately for anons, who have no
                        # entire User object stored in there.
                        if( !$this->mId ) {
-                               global $wgMemc;
-                               $key = wfMemcKey( 'newtalk', 'ip', $this->getName() );
-                               $newtalk = $wgMemc->get( $key );
-                               if( strval( $newtalk ) !== '' ) {
-                                       $this->mNewtalk = (bool)$newtalk;
+                               global $wgDisableAnonTalk;
+                               if( $wgDisableAnonTalk ) {
+                                       // Anon newtalk disabled by configuration.
+                                       $this->mNewtalk = false;
                                } else {
-                                       // Since we are caching this, make sure it is up to date by getting it
-                                       // from the master
-                                       $this->mNewtalk = $this->checkNewtalk( 'user_ip', $this->getName(), true );
-                                       $wgMemc->set( $key, (int)$this->mNewtalk, 1800 );
+                                       global $wgMemc;
+                                       $key = wfMemcKey( 'newtalk', 'ip', $this->getName() );
+                                       $newtalk = $wgMemc->get( $key );
+                                       if( strval( $newtalk ) !== '' ) {
+                                               $this->mNewtalk = (bool)$newtalk;
+                                       } else {
+                                               // Since we are caching this, make sure it is up to date by getting it
+                                               // from the master
+                                               $this->mNewtalk = $this->checkNewtalk( 'user_ip', $this->getName(), true );
+                                               $wgMemc->set( $key, (int)$this->mNewtalk, 1800 );
+                                       }
                                }
                        } else {
                                $this->mNewtalk = $this->checkNewtalk( 'user_id', $this->mId );