public static function delete_data_for_all_users_in_context(\context $context) {
        global $DB;

        if ($context instanceof \context_course) {
            $sectionsql = "itemid IN (SELECT id FROM {course_sections} WHERE course = ?) AND type = ?";
            $DB->delete_records_select('backup_controllers', $sectionsql, [$context->instanceid, \backup::TYPE_1SECTION]);
            $DB->delete_records('backup_controllers', ['itemid' => $context->instanceid, 'type' => \backup::TYPE_1COURSE]);
        }
        if ($context instanceof \context_module) {
            $DB->delete_records('backup_controllers', ['itemid' => $context->instanceid, 'type' => \backup::TYPE_1ACTIVITY]);
        }
        return;
    }
public static function delete_data_for_all_users_in_context(\context $context) {
        global $DB;

        if ($context instanceof \context_course) {
            $sectionsql = "itemid IN (SELECT id FROM {course_sections} WHERE course = ?) AND type = ?";
            $DB->delete_records_select('backup_controllers', $sectionsql, [$context->instanceid, \backup::TYPE_1SECTION]);
            $DB->delete_records('backup_controllers', ['itemid' => $context->instanceid, 'type' => \backup::TYPE_1COURSE]);
        }
        if ($context instanceof \context_module) {
            $DB->delete_records('backup_controllers', ['itemid' => $context->instanceid, 'type' => \backup::TYPE_1ACTIVITY]);
        }
        return;
    }
public static function delete_data_for_all_users_in_context ( \ context $ context ) { global $ DB ; if ( $ context instanceof \ context_course ) { $ sectionsql = "itemid IN (SELECT id FROM {course_sections} WHERE course = ?) AND type = ?" ; $ DB -> delete_records_select ( 'backup_controllers' , $ sectionsql , [ $ context -> instanceid , \ backup :: TYPE_1SECTION ] ) ; $ DB -> delete_records ( 'backup_controllers' , [ 'itemid' => $ context -> instanceid , 'type' => \ backup :: TYPE_1COURSE ] ) ; } if ( $ context instanceof \ context_module ) { $ DB -> delete_records ( 'backup_controllers' , [ 'itemid' => $ context -> instanceid , 'type' => \ backup :: TYPE_1ACTIVITY ] ) ; } return ; }
Delete all user data which matches the specified context.
Only dealing with the specific context - not it's child contexts.

@param \context $context A user context.
Delete all user data which matches the specified context . Only dealing with the specific context - not it s child contexts .