private function connect_to_database($dbms, array $db_connection_data, $database) { DBFactory::init_factory($dbms); $connection = DBFactory::new_db_connection(); DBFactory::set_db_connection($connection); try { $connection->connect($db_connection_data); } catch (UnexistingDatabaseException $exception) { PersistenceContext::get_dbms_utils()->create_database($database); PersistenceContext::close_db_connection(); $connection = DBFactory::new_db_connection(); $connection->connect($db_connection_data); DBFactory::set_db_connection($connection); } }
Environment::load_imports(); Environment::load_static_constants(); AppContext::set_request(new HTTPRequestCustom()); Session::gc(); $session_data = Session::start(); AppContext::set_session($session_data); AppContext::init_current_user(); require_once PATH_TO_ROOT . '/test/PHPUnit/Framework.php'; if (isset($argv)) { array_shift($argv); $_REQUEST['params'] = implode(' ', $argv); $_REQUEST['is_html'] = false; } if (!empty($_REQUEST['params'])) { // Fake command line environment $argv = $_REQUEST['params']; $_SERVER['argv'] = explode(' ', '--configuration ./phpunit.cfg.xml ' . $argv); } else { $_SERVER['argv'] = array(); } $is_html = isset($_REQUEST['is_html']) && $_REQUEST['is_html'] == true; if (!$is_html) { echo '<pre>'; } //Debug::dump($_SERVER['argv']); require_once PATH_TO_ROOT . '/test/phpunit.php'; if (!$is_html) { echo '</pre>'; } PersistenceContext::close_db_connection();
public static function destroy() { PersistenceContext::close_db_connection(); @ob_end_flush(); }
private function create_tables(InstallationServices $service, $host, $port, $login, $password, $schema, $tables_prefix) { if (!$service->is_already_installed() || !$this->overwrite_field->is_disabled() && $this->overwrite_field->is_checked()) { PersistenceContext::close_db_connection(); $service->create_phpboost_tables(DBFactory::MYSQL, $host, $port, $schema, $login, $password, $tables_prefix); AppContext::get_response()->redirect(InstallUrlBuilder::website()); } else { $this->overwrite_fieldset->enable(); $this->error = $this->lang['phpboost.alreadyInstalled.explanation']; } }