示例#1
0
文件: Api.php 项目: rgwybb/tars
 public function update($product, $name)
 {
     $options = Flight::request()->data->getData();
     $booleanFields = array('forceUpdate', 'updateAppName', 'stopBeforeUpdate', 'updatePort', 'restartAfterUpdate', 'updateStartStopScript');
     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('batchNum' => 0, 'batchInterval' => 0, 'hotRestart' => 'false', 'ignoreFileList' => array(), 'copyFileInstallOrCp' => 'install', 'restartOnlyApp' => '');
     $options += $defaults;
     $ret = $pkg->update($product, $name, $options);
     // 控制 Curl 请求错误
     $this->handleCurlError($pkg);
     Flight::json($ret);
 }