From d25597ab8ab712377be40d38fef9f869e5bc5058 Mon Sep 17 00:00:00 2001 From: cornernote Date: Tue, 11 Aug 2015 17:12:10 +0930 Subject: [PATCH] tweak command --- src/commands/PackageController.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/commands/PackageController.php b/src/commands/PackageController.php index 3651f07..e848ad8 100644 --- a/src/commands/PackageController.php +++ b/src/commands/PackageController.php @@ -14,10 +14,22 @@ class PackageController extends Controller public function actionUpdate() { $packages = Package::find()->all(); + $this->stdout('Updating mods from repositories' . "\n"); foreach ($packages as $package) { + $this->stdout($package->name . ' ' . $package->url . ': '); $package->harvestModInfo(); if ($package->getDirtyAttributes()) { - $package->save(); + if ($package->save()) { + $this->stdout('Updated!' . "\n", Console::FG_GREEN); + } else { + $this->stdout('Errors', Console::FG_RED); + foreach ($package->errors as $attribute => $errors) { + $this->stdout(' -- ' . $attribute . ' ' . implode(', ', $errors), Console::FG_RED); + } + $this->stdout("\n"); + } + } else { + $this->stdout('Unchanged.' . "\n", Console::FG_PURPLE); } } } @@ -76,7 +88,6 @@ class PackageController extends Controller } $this->stdout("\n"); } - } }