/** * Run DB Migration Up * * @return \yii\web\Response * @throws NotFoundHttpException * @throws \Exception */ public function actionInstall() { $addOns = Addon::findAll(['id' => Yii::$app->getRequest()->post('ids')]); if (empty($addOns)) { throw new NotFoundHttpException(Yii::t('addon', 'Page not found.')); } else { foreach ($addOns as $addOn) { // Run Addon DB Migration $migrationPath = Yii::getAlias('@addons') . DIRECTORY_SEPARATOR . $addOn->id . DIRECTORY_SEPARATOR . 'migrations'; if (is_dir($migrationPath)) { ConsoleHelper::migrate($migrationPath, 'migration_' . $addOn->id); } $addOn->status = $addOn::STATUS_ACTIVE; $addOn->installed = $addOn::INSTALLED_ON; $addOn->update(); } Yii::$app->getSession()->setFlash('success', Yii::t('addon', 'The selected items have been installed successfully.')); return $this->redirect(['index']); } }