function print_db_pools($db_pools) { ob_start(); ?> <table class="data"> <tr> <th> </th> <th colspan='5' id='connections'><?php echo info("Connections", "Database_Connections"); ?> </th> <th colspan='2' id='config'><?php echo info("Config", "Database_Connections"); ?> </th> </tr> <tr> <th id='name'><?php echo gettext('Name'); ?> </th> <th id='active'><?php echo gettext('Active'); ?> </th> <th id='idle'><?php echo gettext('Idle'); ?> </th> <th id='created'><?php echo gettext('Created'); ?> </th> <th id='failed' colspan='2'><?php echo gettext('Failed'); ?> </th> <th id='max-connections'>max-connections</th> <th id='idle-time'>idle-time</th> </tr> <?php $row = 0; foreach ($db_pools as $pool) { ?> <tr class='<?php echo row_style($row++); ?> '> <td headers="name"><?php echo $pool->Name; ?> </td> <td headers="connections active"><?php echo $pool->ConnectionActiveCount; ?> </td> <td headers="connections idle"><?php echo $pool->ConnectionIdleCount; ?> </td> <td headers="connections created"><?php echo format_miss_ratio($pool->ConnectionCountTotal, $pool->ConnectionCreateCountTotal); ?> </td> <td headers="connections failed"><?php echo $pool->ConnectionFailCountTotal; ?> </td> <td headers="connections failed" class='<?php echo format_ago_class($pool->LastFailTime); ?> '> <?php echo format_ago($pool->LastFailTime); ?> </td> <td headers="config max-connections"><?php echo $pool->MaxConnections; ?> </td> <td headers="config idle-time"><?php echo sprintf("%.2fs", $pool->MaxIdleTime * 0.001); ?> </td> </tr> <?php } ?> </table> <?php return ob_get_clean(); }
?> </div></td></tr> <tr><td><div>Memory used:</div></td><td><div><?php echo format_size($info[$i]['Memory']['used_memory']); ?> </div></td></tr> <tr><td><div>Uptime:</div></td><td><div><?php echo format_ago($info[$i]['Server']['uptime_in_seconds']); ?> </div></td></tr> <tr><td><div>Last save:</div></td><td><div><?php if (isset($info[$i]['Persistence']['rdb_last_save_time'])) { echo format_ago(time() - $info[$i]['Persistence']['rdb_last_save_time'], true); } else { echo 'never'; } ?> <a href="save.php?s=<?php echo $i; ?> "><img src="images/save.png" width="16" height="16" title="Save Now" alt="[S]" class="imgbut"></a></div></td></tr> </table> <?php } ?> </div> <?php
echo $info[$i]['size']; ?> </div></td></tr> <tr><td><div>Memory used:</div></td><td><div><?php echo format_size($info[$i]['used_memory']); ?> </div></td></tr> <tr><td><div>Uptime:</div></td><td><div><?php echo format_ago($info[$i]['uptime_in_seconds']); ?> </div></td></tr> <tr><td><div>Last save:</div></td><td><div><?php echo format_ago(time() - $info[$i]['last_save_time'], true); ?> <a href="save.php?s=<?php echo $i; ?> "><img src="images/save.png" width="16" height="16" title="Save Now" alt="[S]" class="imgbut"></a></div></td></tr> </table> </div> <?php } ?> <p class="clear"> <a href="https://github.com/ErikDubbelboer/phpRedisAdmin" target="_blank">phpRedisAdmin on GitHub</a> </p>
?> </div></td> </tr> <tr> <td><div>上次保存:</div></td> <?php $last_save_time = NULL; if (isset($info[$i]['rdb_last_save_time'])) { $last_save_time = $info[$i]['rdb_last_save_time']; } elseif (isset($info[$i]['last_save_time'])) { $last_save_time = $info[$i]['last_save_time']; } ?> <td> <div><?php echo $last_save_time === NULL ? '未知' : format_ago(time() - $last_save_time, true); ?> <a href="<?php echo manager_site_url('save', 'index'); ?> "> <img src="<?php echo base_url('static/images/save.png'); ?> " width="16" height="16" title="立刻保存" alt="立刻保存" class="imgbut" /> </a> </div> </td> </tr> <?php
<?php foreach ($config['servers'] as $i => $server) { ?> <div class="server"> <h2><?php echo isset($server['name']) ? $server['name'] : format_html($server['host'])?></h2> <table> <tr><td><div>Redis version:</div></td><td><div><?php echo $info[$i]['redis_version']?></div></td></tr> <tr><td><div>Keys:</div></td><td><div><?php echo $info[$i]['size']?></div></td></tr> <tr><td><div>Memory used:</div></td><td><div><?php echo format_size($info[$i]['used_memory'])?></div></td></tr> <tr><td><div>Uptime:</div></td><td><div><?php echo format_ago($info[$i]['uptime_in_seconds'])?></div></td></tr> <tr><td><div>Last save:</div></td><td><div><?php echo format_ago(time() - $info[$i]['last_save_time'], true)?> <a href="save.php?s=<?php echo $i?>"><img src="images/save.png" width="16" height="16" title="Save Now" alt="[S]" class="imgbut"></a></div></td></tr> </table> </div> <?php } ?> <p class="clear"> <a href="https://github.com/ErikDubbelboer/phpRedisAdmin" target="_blank">phpRedisAdmin on GitHub</a> </p> <p> <a href="http://redis.io/documentation" target="_blank">Redis Documentation</a> </p> <?php require 'footer.inc.php';