当前位置: 首页>>代码示例>>PHP>>正文


PHP Migration::getInterruptionResult方法代码示例

本文整理汇总了PHP中Drupal\migrate\Entity\Migration::getInterruptionResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Migration::getInterruptionResult方法的具体用法?PHP Migration::getInterruptionResult怎么用?PHP Migration::getInterruptionResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\migrate\Entity\Migration的用法示例。


在下文中一共展示了Migration::getInterruptionResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rollback

 /**
  * {@inheritdoc}
  */
 public function rollback()
 {
     // Only begin the rollback operation if the migration is currently idle.
     if ($this->migration->getStatus() !== MigrationInterface::STATUS_IDLE) {
         $this->message->display($this->t('Migration @id is busy with another operation: @status', ['@id' => $this->migration->id(), '@status' => $this->t($this->migration->getStatusLabel())]), 'error');
         return MigrationInterface::RESULT_FAILED;
     }
     // Announce that rollback is about to happen.
     $this->getEventDispatcher()->dispatch(MigrateEvents::PRE_ROLLBACK, new MigrateRollbackEvent($this->migration));
     // Optimistically assume things are going to work out; if not, $return will be
     // updated to some other status.
     $return = MigrationInterface::RESULT_COMPLETED;
     $this->migration->setStatus(MigrationInterface::STATUS_ROLLING_BACK);
     $id_map = $this->migration->getIdMap();
     $destination = $this->migration->getDestinationPlugin();
     // Loop through each row in the map, and try to roll it back.
     foreach ($id_map as $map_row) {
         $destination_key = $id_map->currentDestination();
         if ($destination_key) {
             $map_row = $id_map->getRowByDestination($destination_key);
             if ($map_row['rollback_action'] == MigrateIdMapInterface::ROLLBACK_DELETE) {
                 $this->getEventDispatcher()->dispatch(MigrateEvents::PRE_ROW_DELETE, new MigrateRowDeleteEvent($this->migration, $destination_key));
                 $destination->rollback($destination_key);
                 $this->getEventDispatcher()->dispatch(MigrateEvents::POST_ROW_DELETE, new MigrateRowDeleteEvent($this->migration, $destination_key));
             }
             // We're now done with this row, so remove it from the map.
             $id_map->deleteDestination($destination_key);
         }
         // Check for memory exhaustion.
         if (($return = $this->checkStatus()) != MigrationInterface::RESULT_COMPLETED) {
             break;
         }
         // If anyone has requested we stop, return the requested result.
         if ($this->migration->getStatus() == MigrationInterface::STATUS_STOPPING) {
             $return = $this->migration->getInterruptionResult();
             $this->migration->clearInterruptionResult();
             break;
         }
     }
     // If rollback completed successfully, reset the high water mark.
     if ($return == MigrationInterface::RESULT_COMPLETED) {
         $this->migration->saveHighWater(NULL);
     }
     // Notify modules that rollback attempt was complete.
     $this->getEventDispatcher()->dispatch(MigrateEvents::POST_ROLLBACK, new MigrateRollbackEvent($this->migration));
     $this->migration->setStatus(MigrationInterface::STATUS_IDLE);
     return $return;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:51,代码来源:MigrateExecutable.php


注:本文中的Drupal\migrate\Entity\Migration::getInterruptionResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。