original_string: public function move_area_files_to_new_context($oldcontextid, $newcontextid, $component, $filearea, $itemid = false) {
          // Note, this code is based on some code that Petr wrote in
          // forum_move_attachments in mod/forum/lib.php. I moved it here because
          // I needed it in the question code too.
          $count = 0;
  
          $oldfiles = $this->get_area_files($oldcontextid, $component, $filearea, $itemid, 'id', false);
          foreach ($oldfiles as $oldfile) {
              $filerecord = new stdClass();
              $filerecord->contextid = $newcontextid;
              $this->create_file_from_storedfile($filerecord, $oldfile);
              $count += 1;
          }
  
          if ($count) {
              $this->delete_area_files($oldcontextid, $component, $filearea, $itemid);
          }
  
          return $count;
      }
code: public function move_area_files_to_new_context($oldcontextid, $newcontextid, $component, $filearea, $itemid = false) {
          // Note, this code is based on some code that Petr wrote in
          // forum_move_attachments in mod/forum/lib.php. I moved it here because
          // I needed it in the question code too.
          $count = 0;
  
          $oldfiles = $this->get_area_files($oldcontextid, $component, $filearea, $itemid, 'id', false);
          foreach ($oldfiles as $oldfile) {
              $filerecord = new stdClass();
              $filerecord->contextid = $newcontextid;
              $this->create_file_from_storedfile($filerecord, $oldfile);
              $count += 1;
          }
  
          if ($count) {
              $this->delete_area_files($oldcontextid, $component, $filearea, $itemid);
          }
  
          return $count;
      }
code_tokens: public function move_area_files_to_new_context ( $ oldcontextid , $ newcontextid , $ component , $ filearea , $ itemid = false ) { // Note, this code is based on some code that Petr wrote in // forum_move_attachments in mod/forum/lib.php. I moved it here because // I needed it in the question code too. $ count = 0 ; $ oldfiles = $ this -> get_area_files ( $ oldcontextid , $ component , $ filearea , $ itemid , 'id' , false ) ; foreach ( $ oldfiles as $ oldfile ) { $ filerecord = new stdClass ( ) ; $ filerecord -> contextid = $ newcontextid ; $ this -> create_file_from_storedfile ( $ filerecord , $ oldfile ) ; $ count += 1 ; } if ( $ count ) { $ this -> delete_area_files ( $ oldcontextid , $ component , $ filearea , $ itemid ) ; } return $ count ; }
docstring: Move all the files in a file area from one context to another.
  
  @param int $oldcontextid the context the files are being moved from.
  @param int $newcontextid the context the files are being moved to.
  @param string $component the plugin that these files belong to.
  @param string $filearea the name of the file area.
  @param int $itemid file item ID
  @return int the number of files moved, for information.
docstring_tokens: Move all the files in a file area from one context to another .