Bug 17261: Add memcached configuration info to about.pl
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 6 Sep 2016 19:24:40 +0000 (16:24 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Wed, 2 Nov 2016 10:55:23 +0000 (10:55 +0000)
This patch adds a row in the About > System information tab, showing
the current configuration for memcached.

To test:
- Apply this patch, have memcached configured for the current instance (this is the
  default in kohadevbox)
- Make sure you have the memcached server running:
  $ sudo service memcached start
- Open the about page in the browser
=> SUCCESS: You get something like:
  Memcached:    Servers: 127.0.0.1:11211 | Namespace: koha_kohadev | Status: running
- Stop the memcached server:
  $ sudo service memcached stop
- Reload the about page
=> SUCCESS: You get something like
  Memcached:    Servers: 127.0.0.1:11211 | Namespace: koha_kohadev | Status: not running
- Set both MEMCACHED_* variables in the apache config for intranet the empty string:
  $ sudo vim /etc/apache2/sites-enabled/kohadev.conf
..
   SetEnv MEMCACHED_SERVERS ""
    #"127.0.0.1:11211"
   SetEnv MEMCACHED_NAMESPACE ""
    #"koha_kohadev"
..
- Restart apache:
  $ sudo service apache2 restart
- Reload the about page
=> SUCCESS: You get something like:
  Memcached:  Servers: undefined| Namespace: undefined | Status: unknown
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

about.pl
koha-tmpl/intranet-tmpl/prog/css/staff-global.css
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt

index ca8ff9f..0fdceb2 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -70,6 +70,18 @@ if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) {
     );
 }
 
+# Memcached configuration
+
+my $memcached_servers = $ENV{ MEMCACHED_SERVERS };
+my $memcached_namespace = $ENV{ MEMCACHED_NAMESPACE };
+my $memcached_running = C4::Context->ismemcached;
+
+$template->param(
+    memcached_servers   => $ENV{ MEMCACHED_SERVERS },
+    memcached_namespace => $ENV{ MEMCACHED_NAMESPACE },
+    memcached_running   => C4::Context->ismemcached
+);
+
 # Additional system information for warnings
 
 my $warnStatisticsFieldsError;
index c8921f9..ba6c8fb 100644 (file)
@@ -807,6 +807,14 @@ fieldset.rows .inputnote {
        color: #cc0000;
 }
 
+.status_ok {
+ background-color: lightgreen;
+}
+
+.status_warn {
+ background-color: red;
+}
+
 /* Font Awesome icon */
 i.success {
     color: green;
index df2b97b..adea4f3 100644 (file)
           [% IF (is_psgi) %]
             <tr><th scope="row">PSGI: </th><td>[% psgi_server |html %]</td></tr>
           [% END %]
+            <tr><th scope="row">Memcached: </th>
+                <td>Servers: [% IF memcached_servers %][% memcached_servers | html %]
+                             [% ELSE %]<span>undefined</span>[% END %]|
+                    Namespace: [% IF memcached_namespace %][% memcached_namespace | html %]
+                               [% ELSE %]<span>undefined</span>[% END %] |
+                    Status: [% IF memcached_servers %]
+                                [% IF memcached_running %]<span class="status_ok">running</span>
+                                [% ELSE %]<span class="status_warn">not running</span>[% END %]
+                            [% ELSE %]
+                                <span>unknown</span>
+                            [% END %]
+                </td>
+            </tr>
             <tr><th scope="row">Zebra version: </th><td>[% zebraVersion |html %]</td></tr>
             [% IF (errZebraConnection == 10000) %]
             <tr><th scope="row"><b>Error</b> </th><td>Zebra server seems not to be available. Is it started?</td></tr>