From 560a0da9316c78a1e7d259220dd1090ad9152d7b Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Tue, 12 Aug 2008 11:05:55 +0000 Subject: [PATCH] Session: Added deleteData function, which deletes data from the data store. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@804 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Session.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 0249884ee..b80831289 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -607,6 +607,31 @@ class SimpleSAML_Session { } + /** + * Delete data from the data store. + * + * This function immediately deletes the data with the given type and id from the data store. + * + * @param string $type The type of the data. + * @param string $id The identifier of the data. + */ + public function deleteData($type, $id) { + assert('is_string($type)'); + assert('is_string($id)'); + + if (!is_array($this->dataStore)) { + return; + } + + if(!array_key_exists($type, $this->dataStore)) { + return; + } + + unset($this->dataStore[$type][$id]); + $this->dirty = TRUE; + } + + /** * This function stores data in the data store. * -- GitLab