+
+ # Load the newtalk status if it is unloaded (mNewtalk=-1)
+ if ( $this->mNewtalk == -1 ) {
+ $this->mNewtalk=0; # reset talk page status
+ $dbr =& wfGetDB( DB_SLAVE );
+ if($this->mId) {
+ $res = $dbr->select( 'user_newtalk', 1, array( 'user_id' => $this->mId ), $fname );
+
+ if ( $dbr->numRows($res)>0 ) {
+ $this->mNewtalk= 1;
+ }
+ $dbr->freeResult( $res );
+ } else {
+ global $wgDBname, $wgMemc;
+ $key = "$wgDBname:newtalk:ip:{$this->mName}";
+ $newtalk = $wgMemc->get( $key );
+ if( ! is_integer( $newtalk ) ){
+ $res = $dbr->select( 'user_newtalk', 1, array( 'user_ip' => $this->mName ), $fname );
+
+ $this->mNewtalk = $dbr->numRows( $res ) > 0 ? 1 : 0;
+ $dbr->freeResult( $res );
+
+ $wgMemc->set( $key, $this->mNewtalk, time() ); // + 1800 );
+ } else {
+ $this->mNewtalk = $newtalk ? 1 : 0;
+ }
+ }
+ }
+