remove link from md5(userid) on a federation if it is the last
This commit is contained in:
parent
fc116d9b71
commit
e23c502c77
|
@ -64,7 +64,16 @@ class LassoSPKitAutoPersistentSession extends LassoSPKitDummySession {
|
|||
if ($newID) {
|
||||
$this->storage->rename($oldID, $newID);
|
||||
} else {
|
||||
$blob = $this->storage->get($oldID);
|
||||
$this->storage->delete($oldID);
|
||||
$userid = $blob['userid'];
|
||||
if ($userid) {
|
||||
$md5 = md5($userid);
|
||||
if ($this->storage->linkcount($md5) == 1) {
|
||||
$this->storage->delete($md5);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
parent::saveFederation();
|
||||
}
|
||||
|
|
|
@ -54,5 +54,12 @@ class LassoSPKitFileStore implements LassoSPKitStore {
|
|||
#lassospkit_debuglog("SPKit File Storage: " . $mesg);
|
||||
}
|
||||
}
|
||||
function linkcount($key) {
|
||||
$stat = stat($this->filepath($key));
|
||||
if (is_array($stat)) {
|
||||
return $stat[3];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -41,4 +41,7 @@ class LassoSPKitMySqlStore implements LassoSPKitStore {
|
|||
}
|
||||
function alias($key,$alias) {
|
||||
}
|
||||
function linkcount($key) {
|
||||
throw new Exception("Not implemented");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ interface LassoSPKitStore {
|
|||
public function delete($key);
|
||||
public function alias($key1,$key2);
|
||||
public function rename($key1, $key2);
|
||||
public function linkcount($key);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Reference in New Issue