Changeset 67 for trunk/Application.php


Ignore:
Timestamp:
Jan 3, 2016, 11:52:37 PM (9 years ago)
Author:
chronos
Message:
  • Added: Preparation for automatic database structure update.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application.php

    r64 r67  
    33class Application
    44{
     5  var $Database;
     6
    57  function Start()
    68  {
    7     global $Config, $Database;
     9    global $Config, $DatabaseRevision;
    810
    911    $FileName = dirname(__FILE__).'/config.php';
     
    1921    $ErrorHandler->Start();
    2022
    21     $Database = new Database();
    22     $Database->Connect($Config['Database']['Host'], $Config['Database']['User'],
     23    $this->Database = new Database();
     24    $this->Database->Connect($Config['Database']['Host'], $Config['Database']['User'],
    2325      $Config['Database']['Password'], $Config['Database']['Database']);
    24     $Database->Prefix = $Config['Database']['Prefix'];
    25     $Database->charset($Config['Database']['Charset']);
    26     $Database->ShowSQLError = $Config['Web']['ShowSQLError'];
    27     $Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery'];
     26    $this->Database->Prefix = $Config['Database']['Prefix'];
     27    $this->Database->charset($Config['Database']['Charset']);
     28    $this->Database->ShowSQLError = $Config['Web']['ShowSQLError'];
     29    $this->Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery'];
    2830
    2931    // SQL injection hack protection
     
    3133    foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    3234
     35    // Check database persistence structure
     36    $UpdateManager = new UpdateManager();
     37    $UpdateManager->Database = $this->Database;
     38    $UpdateManager->Revision = $DatabaseRevision;
     39    if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.');
     40    if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.');
     41
    3342  }
    3443}
Note: See TracChangeset for help on using the changeset viewer.