Skip to content

Commit

Permalink
by rlmumford: Support batch updates. (#4057)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlmumford authored and enzolutions committed May 23, 2019
1 parent 5d6a21a commit db15e4e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/Command/Update/ExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,24 @@ protected function getUpdateList()

private function executeUpdate($function, &$context)
{
if (!$context || !array_key_exists('sandbox', $context)) {
$context['sandbox'] = [];
}
$context['sandbox'] = [];
do {
if (function_exists($function)) {
$return = $function($context['sandbox']);

if (is_string($return)) {
$this->getIo()->info(
" ".$return
);
}

if (function_exists($function)) {
$function($context['sandbox']);
}
if (isset($context['sandbox']['#finished']) && ($context['sandbox']['#finished'] < 1)) {
$this->getIo()->info(
' Processed '.number_format($context['sandbox']['#finished'] * 100, 2).'%'
);
}
}
} while (isset($context['sandbox']['#finished']) && ($context['sandbox']['#finished'] < 1));

return true;
}
Expand Down

0 comments on commit db15e4e

Please sign in to comment.