MDL-45412 cachestore_mongodb: added notification of old Mongo version use
authorSam Hemelryk <sam@moodle.com>
Mon, 5 May 2014 21:30:27 +0000 (09:30 +1200)
committerSam Hemelryk <sam@moodle.com>
Mon, 5 May 2014 21:30:27 +0000 (09:30 +1200)
cache/stores/mongodb/addinstanceform.php
cache/stores/mongodb/lang/en/cachestore_mongodb.php

index ada3220..c7d3104 100644 (file)
@@ -48,8 +48,13 @@ class cachestore_mongodb_addinstance_form extends cachestore_addinstance_form {
      * The forms custom definitions.
      */
     protected function configuration_definition() {
+        global $OUTPUT;
         $form = $this->_form;
 
+        if (!class_exists('MongoClient')) {
+            $form->addElement('html', $OUTPUT->notification(get_string('pleaseupgrademongo', 'cachestore_mongodb')));
+        }
+
         $form->addElement('text', 'server', get_string('server', 'cachestore_mongodb'), array('size' => 72));
         $form->addHelpButton('server', 'server', 'cachestore_mongodb');
         $form->addRule('server', get_string('required'), 'required');
index d787d97..5af0c73 100644 (file)
@@ -28,6 +28,7 @@ $string['extendedmode'] = 'Use extended keys';
 $string['extendedmode_help'] = 'If enabled full key sets will be used when working with the plugin. This isn\'t used internally yet but would allow you to easily search and investigate the MongoDB plugin manually if you so choose. Turning this on will add an small overhead so should only be done if you require it.';
 $string['password'] = 'Password';
 $string['password_help'] = 'The password of the user being used for the connection.';
+$string['pleaseupgrademongo'] = 'You are using an old version of the PHP Mongo extension (> 1.3). Support for old versions of the Mongo extension will be dropped in the future. Please consider upgrading.';
 $string['pluginname'] = 'MongoDB';
 $string['replicaset'] = 'Replica set';
 $string['replicaset_help'] = 'The name of the replica set to connect to. If this is given the master will be determined by using the ismaster database command on the seeds, so the driver may end up connecting to a server that was not even listed.';