|
@@ 454-468 (lines=15) @@
|
| 451 |
|
}; |
| 452 |
|
|
| 453 |
|
// Restore database into target environment |
| 454 |
|
if(in_array($dataTransfer->Mode, array('all', 'db'))) { |
| 455 |
|
$log->write(sprintf('Restore of database to "%s" started', $name)); |
| 456 |
|
$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'database.sql'); |
| 457 |
|
$command = $this->getCommand('data:pushdb', 'db', $environment, $args, $log); |
| 458 |
|
$command->run(function($type, $buffer) use($log) { |
| 459 |
|
$log->write($buffer); |
| 460 |
|
}); |
| 461 |
|
if(!$command->isSuccessful()) { |
| 462 |
|
$cleanupFn(); |
| 463 |
|
$log->write(sprintf('Restore of database to "%s" failed: %s', $name, $command->getErrorOutput())); |
| 464 |
|
$this->extend('dataTransferFailure', $environment, $log); |
| 465 |
|
throw new RuntimeException($command->getErrorOutput()); |
| 466 |
|
} |
| 467 |
|
$log->write(sprintf('Restore of database to "%s" done', $name)); |
| 468 |
|
} |
| 469 |
|
|
| 470 |
|
// Restore assets into target environment |
| 471 |
|
if(in_array($dataTransfer->Mode, array('all', 'assets'))) { |
|
@@ 471-485 (lines=15) @@
|
| 468 |
|
} |
| 469 |
|
|
| 470 |
|
// Restore assets into target environment |
| 471 |
|
if(in_array($dataTransfer->Mode, array('all', 'assets'))) { |
| 472 |
|
$log->write(sprintf('Restore of assets to "%s" started', $name)); |
| 473 |
|
$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'assets'); |
| 474 |
|
$command = $this->getCommand('data:pushassets', 'web', $environment, $args, $log); |
| 475 |
|
$command->run(function($type, $buffer) use($log) { |
| 476 |
|
$log->write($buffer); |
| 477 |
|
}); |
| 478 |
|
if(!$command->isSuccessful()) { |
| 479 |
|
$cleanupFn(); |
| 480 |
|
$log->write(sprintf('Restore of assets to "%s" failed: %s', $name, $command->getErrorOutput())); |
| 481 |
|
$this->extend('dataTransferFailure', $environment, $log); |
| 482 |
|
throw new RuntimeException($command->getErrorOutput()); |
| 483 |
|
} |
| 484 |
|
$log->write(sprintf('Restore of assets to "%s" done', $name)); |
| 485 |
|
} |
| 486 |
|
|
| 487 |
|
$log->write('Rebuilding and cleaning up'); |
| 488 |
|
$cleanupFn(); |