protected function get_course_areas($extensions = '*', $returnemptyfolders = false) {
        global $DB;

        $allareas = [
            'course_summary',
            'course_overviewfiles',
            'course_section',
            'backup_section',
            'backup_course',
            'backup_automated',
            'course_legacy'
        ];

        if ($returnemptyfolders) {
            return $allareas;
        }

        $params1 = ['contextid' => $this->context->id, 'emptyfilename' => '.'];
        $sql1 = "SELECT " . $DB->sql_concat('f.component', "'_'", 'f.filearea') . "
            FROM {files} f
            WHERE f.filename <> :emptyfilename AND f.contextid = :contextid ";
        $sql3 = ' GROUP BY f.component, f.filearea';
        list($sql2, $params2) = $this->build_search_files_sql($extensions);
        $areaswithfiles = $DB->get_fieldset_sql($sql1 . $sql2 . $sql3, array_merge($params1, $params2));

        return array_intersect($allareas, $areaswithfiles);
    }