Added warning support to migration script
This commit is contained in:
parent
2ffd109c1c
commit
1f993d37b3
1 changed files with 10 additions and 0 deletions
|
@ -55,11 +55,16 @@ function removeRecursively($dir)
|
||||||
|
|
||||||
abstract class Task
|
abstract class Task
|
||||||
{
|
{
|
||||||
|
private $warnings = [];
|
||||||
|
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
echo $this->getDescription() . '...';
|
echo $this->getDescription() . '...';
|
||||||
$this->run();
|
$this->run();
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
|
|
||||||
|
foreach ($this->warnings as $message)
|
||||||
|
echo 'Warning: ' . $message . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function progress()
|
protected function progress()
|
||||||
|
@ -67,6 +72,11 @@ abstract class Task
|
||||||
echo '.';
|
echo '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function warn($message)
|
||||||
|
{
|
||||||
|
$this->warnings[] = $message;
|
||||||
|
}
|
||||||
|
|
||||||
protected function withProgress($source, $callback, $chunkSize = 666, callable $callbackLoopRunner = null)
|
protected function withProgress($source, $callback, $chunkSize = 666, callable $callbackLoopRunner = null)
|
||||||
{
|
{
|
||||||
if ($source instanceof \Traversable)
|
if ($source instanceof \Traversable)
|
||||||
|
|
Loading…
Reference in a new issue