/** * スケルトンを削除する * * @access public * @param string $type 生成する対象 * @param string $app_dir アプリケーションのディレクトリ * (nullのときはアプリケーションを特定しない) * @param mixed residue プラグインのremove()にそのまま渡す * @static */ function &remove() { $arg_list = func_get_args(); $type = array_shift($arg_list); $app_dir = array_shift($arg_list); if ($app_dir === null) { $ctl =& Ethna_Handle::getEthnaController(); } else { $ctl =& Ethna_Handle::getAppController($app_dir); } if (Ethna::isError($ctl)) { return $ctl; } $plugin_manager =& $ctl->getPlugin(); if (Ethna::isError($plugin_manager)) { return $plugin_manager; } $generator =& $plugin_manager->getPlugin('Generator', $type); if (Ethna::isError($generator)) { return $generator; } // 引数はプラグイン依存とする $ret = call_user_func_array(array(&$generator, 'remove'), $arg_list); return $ret; }
/** * setup PEAR_Config and so on. * * @param string $target whether 'master' or 'local' * @param string|null $app_dir local application directory. * @param string|null $channel channel for the package repository. * @return true|Ethna_Error */ public function init($target, $app_dir = null, $channel = null) { $true = true; if ($target == 'master') { $this->target = 'master'; } else { // default target is 'local'. $this->target = 'local'; } // setup PEAR_Frontend PEAR_Command::setFrontendType('CLI'); $this->ui = PEAR_Command::getFrontendObject(); // set PEAR's error handling // TODO: if PEAR/Command/Install.php is newer than 1.117, displayError goes well. PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$this->ui, 'displayFatalError')); // set channel $master_setting = Ethna_Handle::getMasterSetting('repositry'); if ($channel !== null) { $this->channel = $channel; } else { if (isset($master_setting["channel_{$target}"])) { $this->channel = $master_setting["channel_{$target}"]; } else { $this->channel = 'pear.ethna.jp'; } } // set target controller if ($target == 'master') { $this->target_ctl = Ethna_Handle::getEthnaController(); } else { $this->target_ctl = Ethna_Handle::getAppController($app_dir); } if (Ethna::isError($this->target_ctl)) { return $this->target_ctl; } // setup PEAR_Config if ($target == 'master') { $ret = $this->_setMasterConfig(); } else { $ret = $this->_setLocalConfig(); } if (Ethna::isError($ret)) { return $ret; } $this->ui->setConfig($this->config); // setup PEAR_Registry $this->registry = $this->config->getRegistry(); return $true; }