Commit 7f3daae4 authored by andrewmacpherson's avatar andrewmacpherson
Browse files

Issue #2938677: Check migrate-debug options in event subscribers, Drush 9 style

parent 3904c3d0
...@@ -21,10 +21,13 @@ class MigrationEventSubscriber implements EventSubscriberInterface { ...@@ -21,10 +21,13 @@ class MigrationEventSubscriber implements EventSubscriberInterface {
* Pre-Row-Save Migrate Event. * Pre-Row-Save Migrate Event.
*/ */
public function debugRowPreSave(MigratePreRowSaveEvent $event) { public function debugRowPreSave(MigratePreRowSaveEvent $event) {
if (PHP_SAPI !== 'cli') {
return;
}
$row = $event->getRow(); $row = $event->getRow();
$using_drush = function_exists('drush_get_option'); if (in_array('migrate-debug-pre', \Drush\Drush::config()->get('runtime.options'))) {
if ($using_drush && drush_get_option('migrate-debug-pre')) {
// Start with capital letter for variables since this is actually a label. // Start with capital letter for variables since this is actually a label.
$Source = $row->getSource(); $Source = $row->getSource();
$Destination = $row->getDestination(); $Destination = $row->getDestination();
...@@ -42,10 +45,14 @@ class MigrationEventSubscriber implements EventSubscriberInterface { ...@@ -42,10 +45,14 @@ class MigrationEventSubscriber implements EventSubscriberInterface {
* Post-Row-Save Migrate Event. * Post-Row-Save Migrate Event.
*/ */
public function debugRowPostSave(MigratePostRowSaveEvent $event) { public function debugRowPostSave(MigratePostRowSaveEvent $event) {
if (PHP_SAPI !== 'cli') {
return;
}
$row = $event->getRow(); $row = $event->getRow();
$using_drush = function_exists('drush_get_option'); if (in_array('migrate-debug', \Drush\Drush::config()->get('runtime.options'))) {
if ($using_drush && drush_get_option('migrate-debug')) {
// Start with capital letter for variables since this is actually a label. // Start with capital letter for variables since this is actually a label.
$Source = $row->getSource(); $Source = $row->getSource();
$Destination = $row->getDestination(); $Destination = $row->getDestination();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment