From e1f25febad0c0195af0b552c151342bde2d7a3bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 16 Jun 2009 08:52:45 +0000
Subject: [PATCH] Add support for reconstructing XML where XML for an entity is
 already cached..

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1521 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/aggregator/config-templates/aggregator.php | 4 ++++
 modules/aggregator/www/index.php                   | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/aggregator/config-templates/aggregator.php b/modules/aggregator/config-templates/aggregator.php
index 5405b59a1..868ced2a5 100644
--- a/modules/aggregator/config-templates/aggregator.php
+++ b/modules/aggregator/config-templates/aggregator.php
@@ -16,6 +16,10 @@ $config = array(
 	'maxCache' 		=> 60*60*24, // 24 hour cache time
 	'maxDuration' 	=> 60*60*24*5, // Maximum 5 days duration on ValidUntil.
 
+	// If base64 encoded for entity is already cached in the entity, should we
+	// reconstruct the XML or re-use.
+	'reconstruct' => TRUE,
+
 	/* Whether metadata should be signed. */
 	'sign.enable' => FALSE,
 
diff --git a/modules/aggregator/www/index.php b/modules/aggregator/www/index.php
index b866f4220..08f7439b8 100644
--- a/modules/aggregator/www/index.php
+++ b/modules/aggregator/www/index.php
@@ -11,6 +11,8 @@ $metadataSets = array(
 $globalConfig = SimpleSAML_Configuration::getInstance();
 $aggregatorConfig = SimpleSAML_Configuration::getConfig('aggregator.php');
 
+
+$reconstruct = $aggregatorConfig->getBoolean('reconstruct', FALSE);
 $aggregators = $aggregatorConfig->getArray('aggragators');
 
 if (!array_key_exists('id', $_GET)) {
@@ -102,7 +104,7 @@ foreach ($entities as $entity => $sets) {
 		}
 	}
 
-	if (is_string($entityDescriptor)) {
+	if (is_string($entityDescriptor) && !$reconstruct) {
 		/* All metadata sets for the entity contain the same entity descriptor. Use that one. */
 		$tmp = new DOMDocument();
 		$tmp->loadXML(base64_decode($entityDescriptor));
-- 
GitLab