コード例 #1
0
 public function actionInstall($package)
 {
     $installed = Extensions::isPackageInstalled($package);
     if ($path = $this->checkInJson($package, true)) {
         // it's in studio
         Extensions::installStudioPackage($package, $path);
     } else {
         // it's in composer
         Extensions::installExtension($package, !$this->checkInJson($package, false));
     }
 }
コード例 #2
0
 public function actionInstallExtension($name, $updateComposer = '0')
 {
     $updateComposer = boolval($updateComposer);
     try {
         Extensions::installExtension($name, $updateComposer);
     } catch (\Guzzle\Http\Exception\ClientErrorResponseException $e) {
         Yii::$app->session->setFlash('error', Yii::t('app', 'Package not found on packagist.'));
     } catch (\yii\base\ErrorException $e) {
         Yii::$app->session->setFlash('error', $e->getMessage());
     }
     return $this->handleActionEnd();
 }