From 741ce1b833419d8e74d42fbde9f7dacabac6a884 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 7 Feb 2008 14:58:03 +0000
Subject: [PATCH] Added memcache status page admin/memcachestat.php

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@264 44740490-163a-0410-bde0-09ae8108e29a
---
 www/admin/memcachestat.php | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 www/admin/memcachestat.php

diff --git a/www/admin/memcachestat.php b/www/admin/memcachestat.php
new file mode 100644
index 000000000..c13653857
--- /dev/null
+++ b/www/admin/memcachestat.php
@@ -0,0 +1,35 @@
+<?php
+
+require_once('../_include.php');
+
+require_once('SimpleSAML/Configuration.php');
+require_once('SimpleSAML/MemcacheStore.php');
+require_once('SimpleSAML/Session.php');
+require_once('SimpleSAML/Utilities.php');
+require_once('SimpleSAML/XHTML/Template.php');
+
+try {
+
+	$config = SimpleSAML_Configuration::getInstance();
+	$session = SimpleSAML_Session::getInstance(true);
+
+	/* Make sure that the user has admin access rights. */
+	if (!isset($session) || !$session->isValid('login-admin') ) {
+		SimpleSAML_Utilities::redirect('/' . $config->getValue('baseurlpath') . 'auth/login-admin.php',
+		                               array('RelayState' => SimpleSAML_Utilities::selfURL())
+		                               );
+	}
+
+
+	$stats = SimpleSAML_MemcacheStore::getStats();
+
+	$template = new SimpleSAML_XHTML_Template($config, 'status-table.php');
+	$template->data['title'] = 'Memcache stats';
+	$template->data['table'] = $stats;
+	$template->show();
+
+} catch(Exception $e) {
+	SimpleSAML_Utilities::fatalError('na', NULL, $e);
+}
+
+?>
\ No newline at end of file
-- 
GitLab