/** * Executes the main logic of the service. * @return tao_install_services_Data The result of the service execution. */ public function execute() { $content = json_decode($this->getData()->getContent(), true); //instantiate the installator try { set_error_handler(array(get_class($this), 'onError')); $installer = new tao_install_Installator(array('root_path' => TAO_INSTALL_PATH, 'install_path' => dirname(__FILE__) . '/../../install')); // For the moment, we force English as default language. $content['value']['module_lang'] = 'en-US'; // fallback until ui is ready if (!isset($content['value']['file_path'])) { $content['value']['file_path'] = TAO_INSTALL_PATH . 'data' . DIRECTORY_SEPARATOR; } $installer->install($content['value']); $installationLog = $installer->getLog(); $message = isset($installationLog['e']) || isset($installationLog['f']) || isset($installationLog['w']) ? 'Installation complete (warnings occurred)' : 'Installation successful.'; $report = array('type' => 'InstallReport', 'value' => array('status' => 'valid', 'message' => $message, 'log' => $installationLog)); $this->setResult(new tao_install_services_Data(json_encode($report))); restore_error_handler(); } catch (Exception $e) { $report = array('type' => 'InstallReport', 'value' => array('status' => 'invalid', 'message' => $e->getMessage() . ' in ' . $e->getFile() . ' at line ' . $e->getLine(), 'log' => $installer->getLog())); $this->setResult(new tao_install_services_Data(json_encode($report))); restore_error_handler(); } }
private function install() { $installPath = $this->taoPath . '/tao/install/init.php'; if (!is_file($installPath)) { throw new Exception("InstallTaoTask require a tao package install should be found " . $installPath); } require_once $installPath; $installator = new tao_install_Installator(array('root_path' => $this->taoPath . '/', 'install_path' => $this->taoPath . '/tao/install/')); $installator->escapeCheck('custom_tao_ModRewrite'); $installator->install($this->taoConfig->toArray()); }
/** * Short description of method run * * @access public * @author firstname and lastname of author, <*****@*****.**> * @return mixed */ public function run() { $this->outVerbose("TAO is being installed. Please wait..."); try { $rootDir = dir(dirname(__FILE__) . '/../../'); $root = isset($this->parameters["root_path"]) ? $this->parameters["root_path"] : realpath($rootDir->path) . DIRECTORY_SEPARATOR; $installator = new tao_install_Installator(array('root_path' => $root, 'install_path' => $root . 'tao/install/')); // mod rewrite cannot be detected in CLI Mode. $installator->escapeCheck('custom_tao_ModRewrite'); $installator->install($this->options); } catch (Exception $e) { $this->err("A fatal error occured during installation: " . $e->getMessage(), true); } }