From a77aa2b76fef4d7f87a4c79b4b495b246af2a75e Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 13 Aug 2010 09:34:26 +0000
Subject: [PATCH] aggregator: Add script to get metadata without going through
 web.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2518 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/aggregator/bin/get.php | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100755 modules/aggregator/bin/get.php

diff --git a/modules/aggregator/bin/get.php b/modules/aggregator/bin/get.php
new file mode 100755
index 000000000..7558f7755
--- /dev/null
+++ b/modules/aggregator/bin/get.php
@@ -0,0 +1,24 @@
+#!/usr/bin/env php
+<?php
+
+require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lib/_autoload.php');
+
+if ($argc < 2) {
+	fwrite(STDERR, "Missing aggregator id.\n");
+	exit(1);
+}
+$id = $argv[1];
+
+$gConfig = SimpleSAML_Configuration::getConfig('module_aggregator.php');
+$aggregators = $gConfig->getConfigItem('aggregators');
+
+$aConfig = $aggregators->getConfigItem($id, NULL);
+if ($aConfig === NULL) {
+	fwrite(STDERR, 'No aggregator with id ' . var_export($id, TRUE) . " found.\n");
+	exit(1);
+}
+
+$aggregator = new sspmod_aggregator_Aggregator($gConfig, $aConfig, $id);
+
+$xml = $aggregator->getMetadataDocument();
+echo($xml->saveXML());
-- 
GitLab