unset( $this->mBadLinks[$index] );
}
global $wgMemc, $wgDBname;
- $wgMemc->delete( "$wgDBname:linkcache:title:$title" );
+ $wgMemc->delete( "$wgDBname:lc:title:$title" );
}
function suspend() { $this->mActive = false; }
if ( "" == $t ) { return 0; }
- $id = $wgMemc->get( $key = "$wgDBname:linkcache:title:$title" );
+ $id = $wgMemc->get( $key = "$wgDBname:lc:title:$title" );
if( $id === FALSE ) {
$sql = "SELECT HIGH_PRIORITY cur_id FROM cur WHERE cur_namespace=" .
"{$ns} AND cur_title='" . wfStrencode( $t ) . "'";
}
$passwordCorrect = FALSE;
- $user = $wgMemc->get( $key = "$wgDBname:user:user_id:$sId" );
+ $user = $wgMemc->get( $key = "$wgDBname:user:id:$sId" );
if($makenew = !$user) {
wfDebug( "User::loadFromSession() unable to load from memcached\n" );
$user = new User();
}
wfFreeResult( $res );
} else {
- $sql = "SELECT 1 FROM user_newtalk WHERE user_ip='{$this->mName}'";
- $res = wfQuery ($sql, "User::loadFromDatabase" );
+ global $wgDBname, $wgMemc;
+ $key = "$wgDBname:newtalk:ip:{$this->mName}";
+ $newtalk = $wgMemc->get( $key );
+ if($newtalk === false) {
+ $sql = "SELECT 1 FROM user_newtalk WHERE user_ip='{$this->mName}'";
+ $res = wfQuery ($sql, "User::loadFromDatabase" );
- if (wfNumRows($res)>0) {
- $this->mNewtalk= 1;
+ $this->mNewtalk = (wfNumRows($res)>0) ? 1 : 0;
+ wfFreeResult( $res );
+
+ $wgMemc->set( $key, $this->mNewtalk, time() ); // + 1800 );
+ } else {
+ $this->mNewtalk = $newtalk ? 1 : 0;
}
- wfFreeResult( $res );
}
if(!$this->mId) {
$this->mDataLoaded = true;
} else {
$sql="DELETE FROM user_newtalk WHERE user_ip='{$this->mName}'";
wfQuery ($sql,"User::saveSettings");
+ $wgMemc->delete( "$wgDBname:newtalk:ip:{$this->mName}" );
}
}
if ( 0 == $this->mId ) { return; }
"user_touched= '" . wfStrencode( $this->mTouched ) .
"' WHERE user_id={$this->mId}";
wfQuery( $sql, "User::saveSettings" );
- #$wgMemc->replace( "$wgDBname:user:user_id:$this->mId", $this );
- $wgMemc->delete( "$wgDBname:user:user_id:$this->mId" );
+ #$wgMemc->replace( "$wgDBname:user:id:$this->mId", $this );
+ $wgMemc->delete( "$wgDBname:user:id:$this->mId" );
}
# Checks if a user with the given name exists
$user->setID(User::idFromName($this->mTitle));
if ($id=$user->getID()) {
$sql = "INSERT INTO user_newtalk (user_id) values ({$id})";
- $wgMemc->delete( "$wgDBname:user:user_id:$id" );
- } else { #anon
-
+ $wgMemc->delete( "$wgDBname:user:id:$id" );
+ } else {
+ #anon
if(preg_match("/^\d{1,3}\.\d{1,3}.\d{1,3}\.\d{1,3}$/",$this->mTitle)) { #real anon (user:xxx.xxx.xxx.xxx)
-
$sql = "INSERT INTO user_newtalk (user_id,user_ip) values (0,\"{$this->mTitle}\")";
- }
-
+ $wgMemc->delete( "$wgDBname:newtalk:ip:$this->mTitle" );
+ }
}
if($sql && !$user->getNewtalk()) { # only insert if real user and it's not already there
}
}
}
-
-
}
}