original_string: public function process_stage_cleanup($pullok=false) {
          global $CFG, $DB;
  
          if (!$pullok && $this->get('instance') && !$this->get('instance')->is_push()) {
              return true;
          }
          if ($this->get('instance')) {
              // might not be set - before export really starts
              $this->get('instance')->cleanup();
          }
          $DB->delete_records('portfolio_tempdata', array('id' => $this->id));
          $fs = get_file_storage();
          $fs->delete_area_files(SYSCONTEXTID, 'portfolio', 'exporter', $this->id);
          $this->deleted = true;
          return true;
      }
code: public function process_stage_cleanup($pullok=false) {
          global $CFG, $DB;
  
          if (!$pullok && $this->get('instance') && !$this->get('instance')->is_push()) {
              return true;
          }
          if ($this->get('instance')) {
              // might not be set - before export really starts
              $this->get('instance')->cleanup();
          }
          $DB->delete_records('portfolio_tempdata', array('id' => $this->id));
          $fs = get_file_storage();
          $fs->delete_area_files(SYSCONTEXTID, 'portfolio', 'exporter', $this->id);
          $this->deleted = true;
          return true;
      }
code_tokens: public function process_stage_cleanup ( $ pullok = false ) { global $ CFG , $ DB ; if ( ! $ pullok && $ this -> get ( 'instance' ) && ! $ this -> get ( 'instance' ) -> is_push ( ) ) { return true ; } if ( $ this -> get ( 'instance' ) ) { // might not be set - before export really starts $ this -> get ( 'instance' ) -> cleanup ( ) ; } $ DB -> delete_records ( 'portfolio_tempdata' , array ( 'id' => $ this -> id ) ) ; $ fs = get_file_storage ( ) ; $ fs -> delete_area_files ( SYSCONTEXTID , 'portfolio' , 'exporter' , $ this -> id ) ; $ this -> deleted = true ; return true ; }
docstring: Processes the 'cleanup' stage of the export
  
  @param bool $pullok normally cleanup is deferred for pull plugins until after the file is requested from portfolio/file.php
  if you want to clean up earlier, pass true here (defaults to false)
  @return bool whether or not to process the next stage. this is important as the control function is called recursively.
docstring_tokens: Processes the cleanup stage of the export