Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-10660, check whether memcache has been installed.

  • Loading branch information...
commit 54ad70b035a525c4e05e3feb1c76c5c17efea69d 1 parent 66feb00
dongsheng authored
Showing with 22 additions and 12 deletions.
  1. +22 −12 admin/settings/server.php
View
34 admin/settings/server.php
@@ -175,12 +175,28 @@
// "performance" settingpage
$temp = new admin_settingpage('performance', get_string('performance', 'admin'));
-$temp->add(new admin_setting_configselect('cachetype', get_string('cachetype', 'admin'),
- get_string('configcachetype', 'admin'), false,
- array( '' => 'none',
- 'internal' => 'internal',
- 'memcached' => 'memcached',
- 'eaccelerator' => 'eaccelerator')));
+if (function_exists('memcache_connect')) {
+ $temp->add(new admin_setting_configselect('cachetype', get_string('cachetype', 'admin'),
+ get_string('configcachetype', 'admin'), false,
+ array( '' => 'none',
+ 'internal' => 'internal',
+ 'memcached' => 'memcached',
+ 'eaccelerator' => 'eaccelerator')));
+ $temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
+ get_string('configmemcachedhosts', 'admin'), ''));
+ $temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
+ get_string('configmemcachedpconn', 'admin'), false,
+ array( '0' => 'false',
+ '1' => 'true')));
+}else{
+ $temp->add(new admin_setting_configselect('cachetype', get_string('cachetype', 'admin'),
+ get_string('configcachetype', 'admin'), false,
+ array( '' => 'none',
+ 'internal' => 'internal',
+ 'eaccelerator' => 'eaccelerator')));
+
+}
+
// NOTE: $CFG->rcache is forced to bool in lib/setup.php
$temp->add(new admin_setting_configselect('rcache', get_string('rcache', 'admin'),
get_string('configrcache', 'admin'), false,
@@ -190,12 +206,6 @@
get_string('configrcachettl', 'admin'), 10));
$temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax', 'admin'),
get_string('configintcachemax', 'admin'), 10));
-$temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
- get_string('configmemcachedhosts', 'admin'), ''));
-$temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
- get_string('configmemcachedpconn', 'admin'), false,
- array( '0' => 'false',
- '1' => 'true')));
$ADMIN->add('server', $temp);
if (file_exists("$CFG->dirroot/$CFG->admin/mysql/frame.php")) {
Please sign in to comment.
Something went wrong with that request. Please try again.