Merge branch 'MDL-62228_master' of git://github.com/markn86/moodle
authorDavid Monllao <davidm@moodle.com>
Tue, 15 May 2018 11:31:07 +0000 (13:31 +0200)
committerDavid Monllao <davidm@moodle.com>
Tue, 15 May 2018 11:31:07 +0000 (13:31 +0200)
1  2 
calendar/classes/privacy/provider.php
cohort/classes/privacy/provider.php
mod/glossary/classes/privacy/provider.php

@@@ -187,19 -187,13 +187,15 @@@ class provider implement
       * @param   context $context Transform the specific context to delete data for.
       */
      public static function delete_data_for_all_users_in_context(\context $context) {
-         if (empty($context)) {
-             return;
-         }
          // Delete all Calendar Events in the specified context in batches.
 -        $eventids = array_keys(self::get_calendar_event_ids_by_context($context));
 -        self::delete_batch_records('event', 'id', $eventids);
 +        if ($eventids = array_keys(self::get_calendar_event_ids_by_context($context))) {
 +            self::delete_batch_records('event', 'id', $eventids);
 +        }
  
          // Delete all Calendar Subscriptions in the specified context in batches.
 -        $subscriptionids = array_keys(self::get_calendar_subscription_ids_by_context($context));
 -        self::delete_batch_records('event_subscriptions', 'id', $subscriptionids);
 +        if ($subscriptionids = array_keys(self::get_calendar_subscription_ids_by_context($context))) {
 +            self::delete_batch_records('event_subscriptions', 'id', $subscriptionids);
 +        }
      }
  
      /**
Simple merge