From: Demon Date: Tue, 14 Aug 2012 23:14:20 +0000 (+0000) Subject: Merge "(bug 36776) Changing User::getNewtalk to use $wgDisableAnonTalk." X-Git-Tag: 1.31.0-rc.0~22737 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=f3b2af39113e94f6ae9b00cccd7b8cdcd55c485f;hp=1b7045e341f898a45e6831ba04406a97c4802cda;p=lhc%2Fweb%2Fwiklou.git Merge "(bug 36776) Changing User::getNewtalk to use $wgDisableAnonTalk." --- diff --git a/includes/User.php b/includes/User.php index a09d129b34..f43844ef33 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1766,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 );