original_string: public static function move_annotations_to_final($backupid, $itemname, \core\progress\base $progress) {
          global $DB;
          $progress->start_progress('move_annotations_to_final');
          $rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
          $progress->progress();
          foreach($rs as $annotation) {
              // If corresponding 'itemfinal' annotation does not exist, update 'item' to 'itemfinal'
              if (! $DB->record_exists('backup_ids_temp', array('backupid' => $backupid,
                                                                'itemname' => $itemname . 'final',
                                                                'itemid' => $annotation->itemid))) {
                  $DB->set_field('backup_ids_temp', 'itemname', $itemname . 'final', array('id' => $annotation->id));
              }
              $progress->progress();
          }
          $rs->close();
          // All the remaining $itemname annotations can be safely deleted
          $DB->delete_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
          $progress->end_progress();
      }
code: public static function move_annotations_to_final($backupid, $itemname, \core\progress\base $progress) {
          global $DB;
          $progress->start_progress('move_annotations_to_final');
          $rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
          $progress->progress();
          foreach($rs as $annotation) {
              // If corresponding 'itemfinal' annotation does not exist, update 'item' to 'itemfinal'
              if (! $DB->record_exists('backup_ids_temp', array('backupid' => $backupid,
                                                                'itemname' => $itemname . 'final',
                                                                'itemid' => $annotation->itemid))) {
                  $DB->set_field('backup_ids_temp', 'itemname', $itemname . 'final', array('id' => $annotation->id));
              }
              $progress->progress();
          }
          $rs->close();
          // All the remaining $itemname annotations can be safely deleted
          $DB->delete_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
          $progress->end_progress();
      }
code_tokens: public static function move_annotations_to_final ( $ backupid , $ itemname , \ core \ progress \ base $ progress ) { global $ DB ; $ progress -> start_progress ( 'move_annotations_to_final' ) ; $ rs = $ DB -> get_recordset ( 'backup_ids_temp' , array ( 'backupid' => $ backupid , 'itemname' => $ itemname ) ) ; $ progress -> progress ( ) ; foreach ( $ rs as $ annotation ) { // If corresponding 'itemfinal' annotation does not exist, update 'item' to 'itemfinal' if ( ! $ DB -> record_exists ( 'backup_ids_temp' , array ( 'backupid' => $ backupid , 'itemname' => $ itemname . 'final' , 'itemid' => $ annotation -> itemid ) ) ) { $ DB -> set_field ( 'backup_ids_temp' , 'itemname' , $ itemname . 'final' , array ( 'id' => $ annotation -> id ) ) ; } $ progress -> progress ( ) ; } $ rs -> close ( ) ; // All the remaining $itemname annotations can be safely deleted $ DB -> delete_records ( 'backup_ids_temp' , array ( 'backupid' => $ backupid , 'itemname' => $ itemname ) ) ; $ progress -> end_progress ( ) ; }
docstring: Moves all the existing 'item' annotations to their final 'itemfinal' ones
  for a given backup.
  
  @param string $backupid Backup ID
  @param string $itemname Item name
  @param \core\progress\base $progress Progress tracker
docstring_tokens: Moves all the existing item annotations to their final itemfinal ones for a given backup .