original_string: final public function delete($downloadcontents = false) {
          global $DB;
          if ($downloadcontents) {
              $this->convert_references_to_local();
          } else {
              $this->remove_files();
          }
          cache::make('core', 'repositories')->purge();
          try {
              $DB->delete_records('repository_instances', array('id'=>$this->id));
              $DB->delete_records('repository_instance_config', array('instanceid'=>$this->id));
          } catch (dml_exception $ex) {
              return false;
          }
          return true;
      }
code: final public function delete($downloadcontents = false) {
          global $DB;
          if ($downloadcontents) {
              $this->convert_references_to_local();
          } else {
              $this->remove_files();
          }
          cache::make('core', 'repositories')->purge();
          try {
              $DB->delete_records('repository_instances', array('id'=>$this->id));
              $DB->delete_records('repository_instance_config', array('instanceid'=>$this->id));
          } catch (dml_exception $ex) {
              return false;
          }
          return true;
      }
code_tokens: final public function delete ( $ downloadcontents = false ) { global $ DB ; if ( $ downloadcontents ) { $ this -> convert_references_to_local ( ) ; } else { $ this -> remove_files ( ) ; } cache :: make ( 'core' , 'repositories' ) -> purge ( ) ; try { $ DB -> delete_records ( 'repository_instances' , array ( 'id' => $ this -> id ) ) ; $ DB -> delete_records ( 'repository_instance_config' , array ( 'instanceid' => $ this -> id ) ) ; } catch ( dml_exception $ ex ) { return false ; } return true ; }
docstring: delete a repository instance
  
  @param bool $downloadcontents
  @return bool
docstring_tokens: delete a repository instance