From 5614af699806f8ccd1f01de64da6bac575e90857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 3 Feb 2009 08:46:19 +0000
Subject: [PATCH] using session instead of phpsession to store cached data

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1228 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/ldapstatus/www/index.php | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php
index 6c587e247..ef8064706 100644
--- a/modules/ldapstatus/www/index.php
+++ b/modules/ldapstatus/www/index.php
@@ -61,14 +61,12 @@ function checkConfig($conf, $req) {
 }
 
 $results = NULL;
-if (array_key_exists('reset', $_GET) && $_GET['reset'] === '1') {
+
+$results = $session->getData('module:ldapstatus', 'results');
+if (empty($results)) {
+	$results = array();
+} elseif (array_key_exists('reset', $_GET) && $_GET['reset'] === '1') {
 	$results = array();
-} else {
-	if (array_key_exists('_ldapstatus_results', $_SESSION)) {
-		$results = $_SESSION['_ldapstatus_results'];
-	} else {
-		$results = array();
-	}
 }
 
 #echo('<pre>'); print_r($results); exit;
@@ -88,7 +86,7 @@ foreach ($orgs AS $orgkey => $orgconfig) {
 		SimpleSAML_Logger::debug('ldapstatus: Completing execution after maxtime [' .(microtime(TRUE) - $start) . ' of maxtime ' . $maxtime . ']');
 		break;
 	}
-	if (array_key_exists($orgkey, $_SESSION['_ldapstatus_results'])) {
+	if (array_key_exists($orgkey, $results)) {
 		SimpleSAML_Logger::debug('ldapstatus: Skipping org already tested [' .$orgkey. ']');
 		continue;
 	} else {
@@ -198,6 +196,8 @@ foreach ($orgs AS $orgkey => $orgconfig) {
 
 $_SESSION['_ldapstatus_results'] = $results;
 
+$session->setData('module:ldapstatus', 'results', $results);
+
 #echo '<pre>'; print_r($results); exit;
 
 $lightCounter = array(0,0,0);
-- 
GitLab