Пример #1
0
 public function install($product, $name)
 {
     $options = Flight::request()->data->getData();
     $booleanFields = array('startAfterComplete');
     foreach ($booleanFields as $field) {
         if (isset($options[$field])) {
             $options[$field] = $options[$field] ? 'true' : 'false';
         }
     }
     $pkg = new Pkg();
     $info = $pkg->getPackageInfo($product, $name);
     if (!$info) {
         Flight::json(null, 404);
     }
     $defaults = array('frameworkType' => $info['frameworkType'] === 'plugin' ? 'plugin' : 'server', 'renameList' => '', 'paraList' => '');
     $options += $defaults;
     $ret = $pkg->install($product, $name, $options);
     // 控制 Curl 请求错误
     $this->handleCurlError($pkg);
     Flight::json($ret);
 }