From d281e0b4c8cd22aa89fba9e4fd9646db60c48333 Mon Sep 17 00:00:00 2001
From: Hanne Moa <hanne.moa@uninett.no>
Date: Fri, 16 Sep 2016 13:31:03 +0200
Subject: [PATCH] Remove concat: translated row titles

For #455
---
 .../templates/memcachestat.tpl.php            |  2 +-
 modules/memcacheMonitor/www/memcachestat.php  | 49 +++++++++++++++++--
 2 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/modules/memcacheMonitor/templates/memcachestat.tpl.php b/modules/memcacheMonitor/templates/memcachestat.tpl.php
index 26f1b8d1d..23e6b770c 100644
--- a/modules/memcacheMonitor/templates/memcachestat.tpl.php
+++ b/modules/memcacheMonitor/templates/memcachestat.tpl.php
@@ -57,7 +57,7 @@ foreach($column_titles as $ct) {
 <?php
 foreach($table as $row_title => $row_data) {
 	echo '<tr>' . "\n";
-	echo '<th class="rowtitle" style="text-align: right">' . $this->t('{memcacheMonitor:memcachestat:' . $row_title . '}') . '</th>' . "\n";
+	echo '<th class="rowtitle" style="text-align: right">' . $this->t($this->data['rowtitles'][$row_title]) . '</th>' . "\n";
 
 	foreach($column_titles as $ct) {
 		echo '<td>';
diff --git a/modules/memcacheMonitor/www/memcachestat.php b/modules/memcacheMonitor/www/memcachestat.php
index d8c7644a4..3d8fde439 100644
--- a/modules/memcacheMonitor/www/memcachestat.php
+++ b/modules/memcacheMonitor/www/memcachestat.php
@@ -101,8 +101,47 @@ foreach($stats AS $key => &$entry) {
 
 }
 
-$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();
+$t = new SimpleSAML_XHTML_Template($config, 'memcacheMonitor:memcachestat.tpl.php');
+$rowTitles = array(
+    'accepting_conns' => $t->noop('{memcacheMonitor:memcachestat:accepting_conns}'),
+    'auth_cmds' => $t->noop('{memcacheMonitor:memcachestat:auth_cmds}'),
+    'auth_errors' => $t->noop('{memcacheMonitor:memcachestat:auth_errors}'),
+    'bytes' => $t->noop('{memcacheMonitor:memcachestat:bytes}'),
+    'bytes_read' => $t->noop('{memcacheMonitor:memcachestat:bytes_read}'),
+    'bytes_written' => $t->noop('{memcacheMonitor:memcachestat:bytes_written}'),
+    'cas_badval' => $t->noop('{memcacheMonitor:memcachestat:cas_badval}'),
+    'cas_hits' => $t->noop('{memcacheMonitor:memcachestat:cas_hits}'),
+    'cas_misses' => $t->noop('{memcacheMonitor:memcachestat:cas_misses}'),
+    'cmd_get' => $t->noop('{memcacheMonitor:memcachestat:cmd_get}'),
+    'cmd_set' => $t->noop('{memcacheMonitor:memcachestat:cmd_set}'),
+    'connection_structures' => $t->noop('{memcacheMonitor:memcachestat:connection_structures}'),
+    'conn_yields' => $t->noop('{memcacheMonitor:memcachestat:conn_yields}'),
+    'curr_connections' => $t->noop('{memcacheMonitor:memcachestat:curr_connections}'),
+    'curr_items' => $t->noop('{memcacheMonitor:memcachestat:curr_items}'),
+    'decr_hits' => $t->noop('{memcacheMonitor:memcachestat:decr_hits}'),
+    'decr_misses' => $t->noop('{memcacheMonitor:memcachestat:decr_misses}'),
+    'delete_hits' => $t->noop('{memcacheMonitor:memcachestat:delete_hits}'),
+    'delete_misses' => $t->noop('{memcacheMonitor:memcachestat:delete_misses}'),
+    'evictions' => $t->noop('{memcacheMonitor:memcachestat:evictions}'),
+    'get_hits' => $t->noop('{memcacheMonitor:memcachestat:get_hits}'),
+    'get_misses' => $t->noop('{memcacheMonitor:memcachestat:get_misses}'),
+    'incr_hits' => $t->noop('{memcacheMonitor:memcachestat:incr_hits}'),
+    'incr_misses' => $t->noop('{memcacheMonitor:memcachestat:incr_misses}'),
+    'limit_maxbytes' => $t->noop('{memcacheMonitor:memcachestat:limit_maxbytes}'),
+    'listen_disabled_num' => $t->noop('{memcacheMonitor:memcachestat:listen_disabled_num}'),
+    'pid' => $t->noop('{memcacheMonitor:memcachestat:pid}'),
+    'pointer_size' => $t->noop('{memcacheMonitor:memcachestat:pointer_size}'),
+    'rusage_system' => $t->noop('{memcacheMonitor:memcachestat:rusage_system}'),
+    'rusage_user' => $t->noop('{memcacheMonitor:memcachestat:rusage_user}'),
+    'threads' => $t->noop('{memcacheMonitor:memcachestat:threads}'),
+    'time' => $t->noop('{memcacheMonitor:memcachestat:time}'),
+    'total_connections' => $t->noop('{memcacheMonitor:memcachestat:total_connections}'),
+    'total_items' => $t->noop('{memcacheMonitor:memcachestat:total_items}'),
+    'uptime' => $t->noop('{memcacheMonitor:memcachestat:uptime}'),
+    'version' => $t->noop('{memcacheMonitor:memcachestat:version}'),
+);
+$t->data['title'] = 'Memcache stats';
+$t->data['rowtitles'] = $rowTitles;
+$t->data['table'] = $stats;
+$t->data['statsraw'] = $statsraw;
+$t->show();
-- 
GitLab