From 1ea45687bcb88b92191b691dbbebece11eaac7a8 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 4 Aug 2010 11:52:04 +0000
Subject: [PATCH] memcacheMonitor: Remove try-catch block.

Since this is only used to show an exception with an invalid error
code, we may as well just handle the error in the default error
handler.

We also remove the unused $session variable.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2476 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/memcacheMonitor/www/memcachestat.php | 59 +++++++++-----------
 1 file changed, 26 insertions(+), 33 deletions(-)

diff --git a/modules/memcacheMonitor/www/memcachestat.php b/modules/memcacheMonitor/www/memcachestat.php
index 744db824e..40a2efa45 100644
--- a/modules/memcacheMonitor/www/memcachestat.php
+++ b/modules/memcacheMonitor/www/memcachestat.php
@@ -72,44 +72,37 @@ function humanreadable($input) {
 
 
 
-try {
+$config = SimpleSAML_Configuration::getInstance();
 
-	$config = SimpleSAML_Configuration::getInstance();
-	$session = SimpleSAML_Session::getInstance();
+/* Make sure that the user has admin access rights. */
+SimpleSAML_Utilities::requireAdmin();
 
-	/* Make sure that the user has admin access rights. */
-	SimpleSAML_Utilities::requireAdmin();
 
+$formats = array(
+	'bytes' => 'humanreadable',
+	'bytes_read' => 'humanreadable',
+	'bytes_written' => 'humanreadable',
+	'limit_maxbytes' => 'humanreadable',
+	'time' => 'tdate',
+	'uptime' => 'hours',
+);
 
-	$formats = array(
-		'bytes' => 'humanreadable',
-		'bytes_read' => 'humanreadable',
-		'bytes_written' => 'humanreadable',
-		'limit_maxbytes' => 'humanreadable',
-		'time' => 'tdate',
-		'uptime' => 'hours',
-	);
-	
-	$statsraw = SimpleSAML_Memcache::getStats();
-	
-	$stats = $statsraw;
-
-	foreach($stats AS $key => &$entry) {
-		if (array_key_exists($key, $formats)) {
-			$func = $formats[$key];
-			foreach($entry AS $k => $val) {
-				$entry[$k] = $func($val);
-			}
+$statsraw = SimpleSAML_Memcache::getStats();
+
+$stats = $statsraw;
+
+foreach($stats AS $key => &$entry) {
+	if (array_key_exists($key, $formats)) {
+		$func = $formats[$key];
+		foreach($entry AS $k => $val) {
+			$entry[$k] = $func($val);
 		}
-		
 	}
 
-	$template = new SimpleSAML_XHTML_Template($config, 'memcacheMonitor:memcachestat.tpl.php');
-	$template->data['title'] = 'Memcache stats';
-	$template->data['table'] = $stats;
-	$template->data['statsraw'] = $statsraw;
-	$template->show();
-
-} catch(Exception $e) {
-	SimpleSAML_Utilities::fatalError('na', NULL, $e);
 }
+
+$template = new SimpleSAML_XHTML_Template($config, 'memcacheMonitor:memcachestat.tpl.php');
+$template->data['title'] = 'Memcache stats';
+$template->data['table'] = $stats;
+$template->data['statsraw'] = $statsraw;
+$template->show();
-- 
GitLab