Skip to content
Snippets Groups Projects
Commit b68403a6 authored by Olav Morken's avatar Olav Morken
Browse files

Changed the MemcacheStore class to check if objects which implements ModifiedInfo has changed.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@303 44740490-163a-0410-bde0-09ae8108e29a
parent 42958a55
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,11 @@ require_once('SimpleSAML/Configuration.php');
/* For access to SimpleSAML_Utilities::transposeArray. */
require_once('SimpleSAML/Utilities.php');
/* For the interface that objects can export to allow us to see if it
* is modified or not.
*/
require_once('SimpleSAML/ModifiedInfo.php');
/*
* This file is part of SimpleSAMLphp. See the file COPYING in the
* root of the distribution for licence information.
......@@ -251,6 +256,47 @@ class SimpleSAML_MemcacheStore {
return TRUE;
}
/* Check if we need to serialize this to make sure
* that it hasn't changed.
*/
$needSer = FALSE;
foreach($this->data as $k => $v) {
/* We can safely ignore all values that aren't
* objects since they are changed with the set-method.
*/
if(!is_object($v)) {
continue;
}
/* If this object implements ModifiedInfo, then
* we can query that to find out if the object has
* changed.
*/
if($v instanceof SimpleSAML_ModifiedInfo) {
/* Check if this object is modified. If it is
* then we return immediately.
*/
if($v->isModified()) {
return TRUE;
}
/* This object hasn't changed. */
continue;
}
/* We have no way of knowing whether this object
* is changed or not. We need to serialize to check
* this.
*/
$needSer = TRUE;
}
/* If we don't need to serialize, then we know we haven't
* changed. (Any changes will have been picked up earlier.)
*/
if($needSer === FALSE) {
return FALSE;
}
/* Calculate the serialized value of this object. */
$serialized = serialize($this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment