Пример #1
0
 protected function _execute(array $params)
 {
     if ($params['db_driver'] === NULL) {
         $params['db_driver'] = Minion_CLI::read(__('Please enter database driver (:types)', array(':types' => implode(', ', array_keys($this->_installer->database_drivers())))));
     }
     if ($params['locale'] === NULL) {
         $params['locale'] = Minion_CLI::read(__('Please enter locale (:types)', array(':types' => implode(', ', array_keys(I18n::available_langs())))));
     }
     if ($params['db_name'] === NULL) {
         $params['db_name'] = Minion_CLI::read(__('Please enter database name'));
     }
     if ($params['timezone'] === NULL) {
         $answer = Minion_CLI::read(__('Select current timezone automaticly (:current)', array(':current' => date_default_timezone_get())), array('y', 'n'));
         if ($answer == 'y') {
             $params['timezone'] = date_default_timezone_get();
         } else {
             $params['timezone'] = Minion_CLI::read(__('Please enter current timezone (:site)', array(':site' => 'http://www.php.net/manual/en/timezones.php')), DateTimeZone::listIdentifiers());
         }
     }
     if ($params['cache_type'] === NULL) {
         $params['cache_type'] = Minion_CLI::read(__('Please enter cache type (:types)', array(':types' => implode(', ', array_keys($this->_installer->cache_types())))));
     }
     if ($params['session_type'] === NULL) {
         $session_types = Kohana::$config->load('installer')->get('session_types', array());
         $params['session_type'] = Minion_CLI::read(__('Please enter session type (:types)', array(':types' => implode(', ', array_keys($this->_installer->session_types())))));
     }
     if ($params['password'] !== NULL) {
         unset($params['password_generate']);
         $params['password_field'] = $params['password_confirm'] = $params['password'];
     }
     try {
         $this->_installer->install($params);
         Observer::notify('after_install', $params);
         Cache::clear_file();
         Minion_CLI::write('==============================================');
         Minion_CLI::write(__('KodiCMS installed successfully'));
         Minion_CLI::write('==============================================');
         $install_data = Session::instance()->get_once('install_data');
         Minion_CLI::write(__('Login: :login', array(':login' => Arr::get($install_data, 'username'))));
         Minion_CLI::write(__('Password: :password', array(':password' => Arr::get($install_data, 'password_field'))));
     } catch (Exception $e) {
         Minion_CLI::write(__(':text | :file [:line]', array(':text' => $e->getMessage(), ':file' => $e->getFile(), ':line' => $e->getLine())));
     }
 }
Пример #2
0
 public function action_index()
 {
     Assets::package(array('select2', 'validate', 'install', 'steps'));
     $this->template->title = __(':cms_name › installation', array(':cms_name' => CMS_NAME));
     $this->template->content = View::factory('install/index', array('data' => Session::instance()->get_once('install_data', $this->_installer->default_params()), 'env_test' => View::factory('install/env_test'), 'cache_types' => $this->_installer->cache_types(), 'session_types' => $this->_installer->session_types(), 'database_drivers' => $this->_installer->database_drivers(), 'title' => $this->template->title, 'dates' => Date::formats()));
 }