Merge branch 'MDL-58803-master-fix' of git://github.com/junpataleta/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 4 May 2017 06:11:23 +0000 (14:11 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 4 May 2017 06:11:23 +0000 (14:11 +0800)
backup/util/settings/base_setting.class.php
backup/util/settings/setting_dependency.class.php
cache/stores/memcached/lib.php
mod/assign/externallib.php
mod/assign/submission/onlinetext/locallib.php

index c5cb567..4988d52 100644 (file)
@@ -70,6 +70,7 @@ abstract class base_setting {
     protected $visibility; // visibility of the setting (setting_base::VISIBLE/setting_base::HIDDEN)
     protected $status; // setting_base::NOT_LOCKED/setting_base::LOCKED_BY_PERMISSION...
 
+    /** @var setting_dependency[] */
     protected $dependencies = array(); // array of dependent (observer) objects (usually setting_base ones)
     protected $dependenton = array();
 
@@ -201,6 +202,12 @@ abstract class base_setting {
     public function set_status($status) {
         $status = $this->validate_status($status);
 
+        if (($this->status == base_setting::LOCKED_BY_PERMISSION || $this->status == base_setting::LOCKED_BY_CONFIG)
+                && $status == base_setting::LOCKED_BY_HIERARCHY) {
+            // Lock by permission or config can not be overriden by lock by hierarchy.
+            return;
+        }
+
         // If the setting is being unlocked first check whether an other settings
         // this setting is dependent on are locked. If they are then we still don't
         // want to lock this setting.
index eebb6f1..425a328 100644 (file)
@@ -202,6 +202,11 @@ class setting_dependency_disabledif_equals extends setting_dependency {
      * @return bool
      */
     protected function process_value_change($oldvalue) {
+        if ($this->dependentsetting->get_status() == base_setting::LOCKED_BY_PERMISSION ||
+                $this->dependentsetting->get_status() == base_setting::LOCKED_BY_CONFIG) {
+            // When setting is locked by permission or config do not apply dependencies.
+            return false;
+        }
         $prevalue = $this->dependentsetting->get_value();
         // If the setting is the desired value enact the dependency
         if ($this->setting->get_value() == $this->value) {
index ba7a6d5..17389e1 100644 (file)
@@ -261,9 +261,13 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
                 $safecombination = true;
             }
 
-            if (!$safecombination && (version_compare($this->connection->getVersion(), '1.4.22') <= 0)) {
-                // This is memcached server version <= 1.4.22 which is a safe combination.
-                $safecombination = true;
+            if (!$safecombination) {
+                $allsafe = true;
+                foreach ($this->connection->getVersion() as $version) {
+                    $allsafe = $allsafe && (version_compare($version, '1.4.22') <= 0);
+                }
+                // All memcached servers connected are version <= 1.4.22 which is a safe combination.
+                $safecombination = $allsafe;
             }
 
             if (!$safecombination) {
index 9280fff..92d0e83 100644 (file)
@@ -818,7 +818,7 @@ class mod_assign_external extends external_api {
                     new external_single_structure(
                         array(
                             'name' => new external_value(PARAM_TEXT, 'field name'),
-                            'description' => new external_value(PARAM_TEXT, 'field description'),
+                            'description' => new external_value(PARAM_RAW, 'field description'),
                             'text' => new external_value (PARAM_RAW, 'field value'),
                             'format' => new external_format_value ('text')
                         )
index c576460..5ec7c6d 100644 (file)
@@ -291,7 +291,7 @@ class assign_submission_onlinetext extends assign_submission_plugin {
      * @return array An array of field names and descriptions. (name=>description, ...)
      */
     public function get_editor_fields() {
-        return array('onlinetext' => get_string('pluginname', 'assignsubmission_comments'));
+        return array('onlinetext' => get_string('pluginname', 'assignsubmission_onlinetext'));
     }
 
     /**