From d9a255ae6a1fcce949ba9a717c114c2e5e543361 Mon Sep 17 00:00:00 2001 From: cytopia Date: Mon, 8 May 2017 09:22:10 +0200 Subject: [PATCH] REL-0.9 Error checking in case some containers are not running --- .devilbox/www/include/lib/Memcd.php | 22 +++++++++++++++------- .devilbox/www/include/lib/Mysql.php | 6 +++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.devilbox/www/include/lib/Memcd.php b/.devilbox/www/include/lib/Memcd.php index 4e4e47c8..00fa7298 100644 --- a/.devilbox/www/include/lib/Memcd.php +++ b/.devilbox/www/include/lib/Memcd.php @@ -188,7 +188,10 @@ class Memcd extends _Base implements _iBase public function getInfo() { - $stats = $this->_memcached->getStats(); + $stats = array(); + if ($this->_memcached) { + $stats = $this->_memcached->getStats(); + } return $stats; } @@ -207,12 +210,17 @@ class Memcd extends _Base implements _iBase public function getVersion() { - $info = $this->_memcached->getVersion(); - $info = array_values($info); - if (!isset($info[0])) { - loadClass('Logger')->error('Could not get Memcached version'); - return ''; + $version = ''; + if ($this->_memcached) { + $info = $this->_memcached->getVersion(); + $info = array_values($info); + if (!isset($info[0])) { + loadClass('Logger')->error('Could not get Memcached version'); + } else { + $version = $info[0]; + } } - return $info[0]; + + return $version; } } diff --git a/.devilbox/www/include/lib/Mysql.php b/.devilbox/www/include/lib/Mysql.php index e9aa3199..c35467b0 100644 --- a/.devilbox/www/include/lib/Mysql.php +++ b/.devilbox/www/include/lib/Mysql.php @@ -252,7 +252,11 @@ class Mysql extends _Base implements _iBase $data[$key] = $val; }; - return $this->select('SHOW VARIABLES;', $callback); + $config = $this->select('SHOW VARIABLES;', $callback); + if (!$config) { + $config = array(); + } + return $config; } else { // Get single config