tweak command

This commit is contained in:
cornernote 2015-08-11 17:12:10 +09:30
parent c2219ce059
commit d25597ab8a

View File

@ -14,10 +14,22 @@ class PackageController extends Controller
public function actionUpdate() public function actionUpdate()
{ {
$packages = Package::find()->all(); $packages = Package::find()->all();
$this->stdout('Updating mods from repositories' . "\n");
foreach ($packages as $package) { foreach ($packages as $package) {
$this->stdout($package->name . ' ' . $package->url . ': ');
$package->harvestModInfo(); $package->harvestModInfo();
if ($package->getDirtyAttributes()) { 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"); $this->stdout("\n");
} }
} }
} }