Beispiel #1
0
 protected function __fm_settings__()
 {
     if (is_null($this->fm_settings)) {
         $settings = new PackageProjectorConfig();
         $settings->parse_ini_string($this->settings);
         $this->fm_settings = $settings;
     }
     return $this->fm_settings;
 }
Beispiel #2
0
 /**
  * パッケージのリリース
  * @param string $package_name パッケージ名
  * @context integer $package_id パッケージID
  * @context OpenpearPackage $package パッケージ
  */
 public function package_release($package_name)
 {
     $session_key = "_openpear_vars_release_{$package_name}_";
     if ($this->is_sessions($session_key)) {
         foreach ($this->in_sessions($session_key) as $_k_ => $_v_) {
             if (!isset($this->vars[$_k_])) {
                 $this->vars[$_k_] = get_magic_quotes_gpc() && is_string($_v_) ? stripslashes($_v_) : $_v_;
             }
         }
     }
     $package = C(OpenpearPackage)->find_get(Q::eq('name', $package_name));
     $package->permission($this->user());
     if ($this->is_post() && $this->verify()) {
         try {
             $build_conf = new PackageProjectorConfig();
             $build_conf->cp($this->vars());
             if ($this->is_vars('extra_conf')) {
                 $build_conf->parse_ini_string($this->in_vars('extra_conf'));
             }
             foreach (C(OpenpearCharge)->find(Q::eq('package_id', $package->id())) as $charge) {
                 $build_conf->maintainer(R(PackageProjectorConfigMaintainer)->set_charge($charge));
             }
             $build_conf->package_package_name($package->name());
             $build_conf->package_channel(OpenpearConfig::pear_domain('openpear.org'));
             if ($build_conf->package_baseinstalldir() == '') {
                 $build_conf->package_baseinstalldir('.');
             }
             if ($this->in_vars('action') == 'do') {
                 $release_queue = new OpenpearReleaseQueue();
                 $release_queue->cp($this->vars());
                 $release_queue->package_id($package->id());
                 $release_queue->maintainer_id($this->user()->id());
                 $release_queue->build_conf($build_conf->get_ini());
                 $release_queue->notes($this->in_vars('package_notes'));
                 $queue = new OpenpearQueue();
                 $queue->type('build');
                 $queue->data(serialize($release_queue));
                 $queue->save();
                 $message = new OpenpearMessage('type=system_notice,mail=false');
                 $message->maintainer_to_id($this->user()->id());
                 $message->subject(trans('リリースキューに追加されました'));
                 $message->description(trans('{1}のリリースを受け付けました。リリースの完了後,メールでお知らせします。', $package->name()));
                 $message->save();
                 $this->redirect_by_map('dashboard');
             } else {
                 $this->sessions($session_key, $_POST);
                 $this->vars('action', 'do');
                 $this->put_block($this->map_arg('confirm_template'));
             }
         } catch (Exception $e) {
             Log::debug($e);
         }
     } else {
         $this->vars('revision', $package->recent_changeset());
         $this->vars('package_notes', $package->generate_release_notes());
         if ($package->is_latest_release_id()) {
             $latest_release = $package->latest_release();
             $config = new PackageProjectorConfig();
             $config->parse_ini_string($latest_release->settings());
             $this->cp($config);
             $this->vars('version_release_ver', $latest_release->version());
         } else {
             $this->cp(new PackageProjectorConfig());
         }
     }
     $this->vars('package', $package);
     $this->vars('package_id', $package->id());
 }