Elgg  Version 3.0
redis.php
Go to the documentation of this file.
1 <?php
5 $servers = elgg_get_config('redis_servers');
6 if (!elgg_get_config('redis') || empty($servers) || !\Stash\Driver\Redis::isAvailable()) {
7  echo '<p>' . elgg_echo('admin:server:redis:inactive') . '</p>';
8 
9  return;
10 }
11 
12 $redis = new Redis();
13 
14 foreach ($servers as $server) {
15  $redis->connect($server[0], $server[1]);
16 }
17 
18 $stats = $redis->info();
19 
20 $rows = [];
21 
22 foreach ($stats as $key => $value) {
23  $row = [];
24  $row[] = elgg_format_element('td', [], elgg_format_element('b', [], $key . ':'));
25  $row[] = elgg_format_element('td', [], $value);
26 
27  $rows[] = elgg_format_element('tr', [], implode(PHP_EOL, $row));
28 }
29 
30 echo elgg_format_element('table', ['class' => 'elgg-table-alt'], implode(PHP_EOL, $rows));
$rows
Definition: redis.php:20
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
elgg echo
Translates a string.
Definition: languages.js:43
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:55
$value
Definition: debugging.php:7
foreach($servers as $server) $stats
Definition: redis.php:18
if(!elgg_get_config('redis')||empty($servers)||!\Stash\Driver\Redis::isAvailable()) $redis
Definition: redis.php:12
$servers
Memcache info.
Definition: redis.php:5
elgg_get_config($name, $default=null)
Get an Elgg configuration value.