original_string: protected function get_area_backup_section($itemid, $filepath, $filename) {
          global $CFG, $DB;
  
          if (!has_capability('moodle/backup:backupcourse', $this->context) and !has_capability('moodle/restore:restorecourse', $this->context)) {
              return null;
          }
  
          if (empty($itemid)) {
              // list all sections
              return new file_info_area_backup_section($this->browser, $this->context, $this->course, $this);
          }
  
          if (!$section = $DB->get_record('course_sections', array('course'=>$this->course->id, 'id'=>$itemid))) {
              return null; // does not exist
          }
  
          $fs = get_file_storage();
  
          $filepath = is_null($filepath) ? '/' : $filepath;
          $filename = is_null($filename) ? '.' : $filename;
          if (!$storedfile = $fs->get_file($this->context->id, 'backup', 'section', $itemid, $filepath, $filename)) {
              if ($filepath === '/' and $filename === '.') {
                  $storedfile = new virtual_root_file($this->context->id, 'backup', 'section', $itemid);
              } else {
                  // not found
                  return null;
              }
          }
  
          $downloadable = has_capability('moodle/backup:downloadfile', $this->context);
          $uploadable   = has_capability('moodle/restore:uploadfile', $this->context);
  
          $urlbase = $CFG->wwwroot.'/pluginfile.php';
          return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, $section->id, true, $downloadable, $uploadable, false);
      }
code: protected function get_area_backup_section($itemid, $filepath, $filename) {
          global $CFG, $DB;
  
          if (!has_capability('moodle/backup:backupcourse', $this->context) and !has_capability('moodle/restore:restorecourse', $this->context)) {
              return null;
          }
  
          if (empty($itemid)) {
              // list all sections
              return new file_info_area_backup_section($this->browser, $this->context, $this->course, $this);
          }
  
          if (!$section = $DB->get_record('course_sections', array('course'=>$this->course->id, 'id'=>$itemid))) {
              return null; // does not exist
          }
  
          $fs = get_file_storage();
  
          $filepath = is_null($filepath) ? '/' : $filepath;
          $filename = is_null($filename) ? '.' : $filename;
          if (!$storedfile = $fs->get_file($this->context->id, 'backup', 'section', $itemid, $filepath, $filename)) {
              if ($filepath === '/' and $filename === '.') {
                  $storedfile = new virtual_root_file($this->context->id, 'backup', 'section', $itemid);
              } else {
                  // not found
                  return null;
              }
          }
  
          $downloadable = has_capability('moodle/backup:downloadfile', $this->context);
          $uploadable   = has_capability('moodle/restore:uploadfile', $this->context);
  
          $urlbase = $CFG->wwwroot.'/pluginfile.php';
          return new file_info_stored($this->browser, $this->context, $storedfile, $urlbase, $section->id, true, $downloadable, $uploadable, false);
      }
code_tokens: protected function get_area_backup_section ( $ itemid , $ filepath , $ filename ) { global $ CFG , $ DB ; if ( ! has_capability ( 'moodle/backup:backupcourse' , $ this -> context ) and ! has_capability ( 'moodle/restore:restorecourse' , $ this -> context ) ) { return null ; } if ( empty ( $ itemid ) ) { // list all sections return new file_info_area_backup_section ( $ this -> browser , $ this -> context , $ this -> course , $ this ) ; } if ( ! $ section = $ DB -> get_record ( 'course_sections' , array ( 'course' => $ this -> course -> id , 'id' => $ itemid ) ) ) { return null ; // does not exist } $ fs = get_file_storage ( ) ; $ filepath = is_null ( $ filepath ) ? '/' : $ filepath ; $ filename = is_null ( $ filename ) ? '.' : $ filename ; if ( ! $ storedfile = $ fs -> get_file ( $ this -> context -> id , 'backup' , 'section' , $ itemid , $ filepath , $ filename ) ) { if ( $ filepath === '/' and $ filename === '.' ) { $ storedfile = new virtual_root_file ( $ this -> context -> id , 'backup' , 'section' , $ itemid ) ; } else { // not found return null ; } } $ downloadable = has_capability ( 'moodle/backup:downloadfile' , $ this -> context ) ; $ uploadable = has_capability ( 'moodle/restore:uploadfile' , $ this -> context ) ; $ urlbase = $ CFG -> wwwroot . '/pluginfile.php' ; return new file_info_stored ( $ this -> browser , $ this -> context , $ storedfile , $ urlbase , $ section -> id , true , $ downloadable , $ uploadable , false ) ; }
docstring: Gets a stored file for the backup section filearea directory
  
  @param int $itemid item ID
  @param string $filepath file path
  @param string $filename file name
  @return file_info|null file_info instance or null if not found or access not allowed
docstring_tokens: Gets a stored file for the backup section filearea directory