private function _createDbIfMissing(Install_Form_Install $form)
 {
     $this->_config->database->params->host = $form->getValue('hostname');
     $this->_config->database->params->username = $form->getValue('dbusername');
     $this->_config->database->params->password = $form->getValue('dbpassword');
     $this->_config->database->params->dbname = $form->getValue('dbname');
     if (!Application::setDatabase()) {
         try {
             $this->_config->database->params->dbname = null;
             Application::setDatabase();
             // binding doesn't work here for some reason
             Zend_Registry::get('db')->getConnection()->query("CREATE DATABASE `" . $form->getValue('dbname') . "`");
             $this->_config->database->params->dbname = $form->getValue('dbname');
             Application::setDatabase();
         } catch (PDOException $e) {
             // when using PDO, it throws this exception, not Zend's
             return false;
         }
     }
     return true;
 }
Example #2
0
<?php

/*
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkey Ltd
* @since  CommunityID 0.9
* @package CommunityID
* @packager Keyboard Monkeys
*/
define('APP_DIR', dirname(__FILE__));
// change this if separating app code from web-accessible files
define('WEB_DIR', APP_DIR);
require 'Application.php';
Application::setIncludePath();
Application::setAutoLoader();
Application::setConfig();
Application::setErrorReporting();
Application::setLogger();
Application::logRequest();
Application::setDatabase();
Application::setSession();
Application::setAcl();
Application::setI18N();
Application::setLayout();
Application::setFrontController();
Application::dispatch();