original_string: public function after_restore() {
          global $DB;
  
          // Get the blockid.
          $blockid = $this->get_blockid();
  
          // Extract block configdata and remove tag collection reference if this is another site. Also map contextid.
          if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) {
              $config = unserialize(base64_decode($configdata));
              $changed = false;
              if (!empty($config->tagcoll) && $config->tagcoll > 1 && !$this->is_samesite()) {
                  $config->tagcoll = 0;
                  $changed = true;
              }
              if (!empty($config->ctx)) {
                  if ($ctxmap = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'context', $config->ctx)) {
                      $config->ctx = $ctxmap->newitemid;
                  } else {
                      $config->ctx = 0;
                  }
                  $changed = true;
              }
              if ($changed) {
                  $configdata = base64_encode(serialize($config));
                  $DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid));
              }
          }
      }
code: public function after_restore() {
          global $DB;
  
          // Get the blockid.
          $blockid = $this->get_blockid();
  
          // Extract block configdata and remove tag collection reference if this is another site. Also map contextid.
          if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) {
              $config = unserialize(base64_decode($configdata));
              $changed = false;
              if (!empty($config->tagcoll) && $config->tagcoll > 1 && !$this->is_samesite()) {
                  $config->tagcoll = 0;
                  $changed = true;
              }
              if (!empty($config->ctx)) {
                  if ($ctxmap = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'context', $config->ctx)) {
                      $config->ctx = $ctxmap->newitemid;
                  } else {
                      $config->ctx = 0;
                  }
                  $changed = true;
              }
              if ($changed) {
                  $configdata = base64_encode(serialize($config));
                  $DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid));
              }
          }
      }
code_tokens: public function after_restore ( ) { global $ DB ; // Get the blockid. $ blockid = $ this -> get_blockid ( ) ; // Extract block configdata and remove tag collection reference if this is another site. Also map contextid. if ( $ configdata = $ DB -> get_field ( 'block_instances' , 'configdata' , array ( 'id' => $ blockid ) ) ) { $ config = unserialize ( base64_decode ( $ configdata ) ) ; $ changed = false ; if ( ! empty ( $ config -> tagcoll ) && $ config -> tagcoll > 1 && ! $ this -> is_samesite ( ) ) { $ config -> tagcoll = 0 ; $ changed = true ; } if ( ! empty ( $ config -> ctx ) ) { if ( $ ctxmap = restore_dbops :: get_backup_ids_record ( $ this -> get_restoreid ( ) , 'context' , $ config -> ctx ) ) { $ config -> ctx = $ ctxmap -> newitemid ; } else { $ config -> ctx = 0 ; } $ changed = true ; } if ( $ changed ) { $ configdata = base64_encode ( serialize ( $ config ) ) ; $ DB -> set_field ( 'block_instances' , 'configdata' , $ configdata , array ( 'id' => $ blockid ) ) ; } } }
docstring: This function, executed after all the tasks in the plan
  have been executed, will remove tag collection reference in case block was restored into another site.
  Also get mapping of contextid.
docstring_tokens: This function executed after all the tasks in the plan have been executed will remove tag collection reference in case block was restored into another site . Also get mapping of contextid .