From 7b1e1034890416947d0c94bc1ea2ab3eaa4f9525 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Thu, 19 Apr 2012 23:38:14 +0000 Subject: [PATCH] properly warn about missing memcached class git-svn-id: http://www.observium.org/svn/observer/trunk@3061 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/static-config.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/includes/static-config.php b/includes/static-config.php index db337d20a9..bd17f194cf 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -1134,11 +1134,19 @@ if (!$observium_link) } $observium_db = mysql_select_db($config['db_name'], $observium_link); -if($config['memcached']['enable']) +if ($config['memcached']['enable']) { - $memcache = new Memcached(); - $memcache->addServer($config['memcached']['host'], $config['memcached']['port']); - if ($debug) { print_r($memcache->getStats()); } + if (class_exists("Memcached")) + { + $memcache = new Memcached(); + $memcache->addServer($config['memcached']['host'], $config['memcached']['port']); + if ($debug) { print_r($memcache->getStats()); } + } + else + { + echo("WARNING: You have enabled memcached but have not installed the PHP bindings. Disabling memcached support.\n"); + $config['memcached']['enable'] = 0; + } } # Set some times needed by loads of scripts (it's dynamic, so we do it here!)