Exemplo n.º 1
0
    }
    $crap = set_exception_handler('PresciaExceptionHandler');
    unset($crap);
    $crap = set_error_handler('PresciaErrorHandler');
    unset($crap);
}
# ab -n50 total mean: 19ms 16ms
$core->domainLoad();
// locks domain, load config and start i18n
define("CONS_FMANAGER", CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/");
if (CONS_CACHE) {
    $core->cacheControl->startCaches();
}
// detects which cache to use from auto-throttle system
# -- database and metadata load
if (!$core->dbconnect()) {
    $core->offlineMode = true;
}
if (!$core->loadMetadata()) {
    $core->errorControl->raise(1, "metamodel fault");
}
// loadMetadata loads dimconfig
if ($core->debugmode) {
    $core->applyMetaData();
}
// only in debug. Executes onMeta's and save metadata/sql changes
# ab -n50 total mean: 546ms 28ms
# -- start parsing the request
require CONS_PATH_INCLUDE . "getBrowser.php";
# this will also detect if we are on mobile
$core->parseRequest();
Exemplo n.º 2
0
 function dbconnect()
 {
     if (!$this->debugmode) {
         return parent::dbconnect();
     }
     if (CONS_DB_HOST != '') {
         if (!$this->dbo->connect(1, CONS_OVERRIDE_DB == '' ? CONS_DB_HOST : CONS_OVERRIDE_DB, CONS_OVERRIDE_DBUSER == '' ? CONS_DB_USER : CONS_OVERRIDE_DBUSER, CONS_OVERRIDE_DBPASS == '' ? CONS_DB_PASS : CONS_OVERRIDE_DBPASS, CONS_DB_BASE)) {
             if (strpos($this->dbo->log[count($this->dbo->log) - 1], "Unknown database") !== false) {
                 # we can try to create the database ...
                 $this->log[] = "Server not reachable or database not present";
                 $tmpConnection = $this->dbo->connect(1, CONS_OVERRIDE_DB == '' ? CONS_DB_HOST : CONS_OVERRIDE_DB, CONS_OVERRIDE_DBUSER == '' ? CONS_DB_USER : CONS_OVERRIDE_DBUSER, CONS_OVERRIDE_DBPASS == '' ? CONS_DB_PASS : CONS_OVERRIDE_DBPASS, '');
                 if ($tmpConnection) {
                     $this->log[] = "Connected to server and trying to create database";
                     $this->dbchanged = true;
                     $ok = $this->dbo->simpleQuery("CREATE DATABASE " . CONS_SQL_QUOTE . CONS_DB_BASE . CONS_SQL_QUOTE . " DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;");
                     if (!$ok) {
                         $this->log[] = "Unable to create database using CREATE DATABASE command";
                         $this->errorControl->raise(122);
                     } else {
                         $this->dbo->close();
                         $this->log[] = "Database created. Trying to load";
                         if (!$this->dbo->select_db(CONS_DB_BASE)) {
                             $this->errorControl->raise(123);
                         }
                     }
                 }
             } else {
                 return false;
             }
         }
     } else {
         $this->dbless = true;
     }
     return true;
 }