Merge branch 'MDL-47481-master' of https://github.com/sammarshallou/moodle
authorSam Hemelryk <sam@moodle.com>
Tue, 7 Oct 2014 22:51:32 +0000 (11:51 +1300)
committerSam Hemelryk <sam@moodle.com>
Tue, 7 Oct 2014 22:51:32 +0000 (11:51 +1300)
availability/condition/group/classes/condition.php
availability/condition/grouping/classes/condition.php
availability/condition/profile/classes/condition.php

index 3905060..2445cdc 100644 (file)
@@ -176,6 +176,12 @@ class condition extends \core_availability\condition {
     public function filter_user_list(array $users, $not, \core_availability\info $info,
             \core_availability\capability_checker $checker) {
         global $CFG, $DB;
+
+        // If the array is empty already, just return it.
+        if (!$users) {
+            return $users;
+        }
+
         require_once($CFG->libdir . '/grouplib.php');
         $course = $info->get_course();
 
index a538704..e0b5997 100644 (file)
@@ -209,6 +209,11 @@ class condition extends \core_availability\condition {
             \core_availability\capability_checker $checker) {
         global $CFG, $DB;
 
+        // If the array is empty already, just return it.
+        if (!$users) {
+            return $users;
+        }
+
         // List users for this course who match the condition.
         $groupingusers = $DB->get_records_sql("
                 SELECT DISTINCT gm.userid
index a156e4b..b781257 100644 (file)
@@ -449,6 +449,11 @@ class condition extends \core_availability\condition {
             \core_availability\capability_checker $checker) {
         global $CFG, $DB;
 
+        // If the array is empty already, just return it.
+        if (!$users) {
+            return $users;
+        }
+
         // Get all users from the list who match the condition.
         list ($sql, $params) = $DB->get_in_or_equal(array_keys($users));