Ignore:
Timestamp:
Jan 21, 2016, 9:54:58 AM (9 years ago)
Author:
chronos
Message:
  • Modified: Custom install script replaced by more sophisticated Setup class which also allows to configure system parameters and application modules.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/System.php

    r855 r858  
    2929    $this->Config = $Config;
    3030    date_default_timezone_set($this->Config['Web']['Timezone']);
    31 
     31    mb_internal_encoding("UTF-8");
     32
     33    if(isset($this->Config['Database']))
     34    {
    3235    $this->Database->Connect($this->Config['Database']['Host'],
    3336      $this->Config['Database']['User'], $this->Config['Database']['Password'],
     
    3740    $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError'];
    3841    $this->Database->LogSQLQuery = $this->Config['Web']['LogSQLQuery'];
     42    }
    3943
    4044    $this->LocaleManager = new LocaleManager($this);
     
    8892  {
    8993    global $ScriptStartTime, $TranslationTree, $StopAfterUpdateManager,
    90       $UpdateManager, $DatabaseRevision;
     94      $UpdateManager;
    9195
    9296    $ScriptStartTime = GetMicrotime();
    9397    if(GetRemoteAddress() != '') session_start();
    94 
    95     if(!isset($this->Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.');
    96 
    97     $this->Init();
    98 
    99     // Check database persistence structure
    100     $UpdateManager = new UpdateManager();
    101     $UpdateManager->Database = $this->Database;
    102     $UpdateManager->Revision = $DatabaseRevision;
    103     if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze. Pokračujte <a href="'.$this->Link('/Application/install.php').'">zde</a>');
    104     if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze. Pokračujte <a href="'.$this->Link('/Application/install.php').'">zde</a>');
    10598
    10699    // SQL injection hack protection
     
    112105    }
    113106    foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
     107
     108    $this->Init();
     109
     110    // Register and start existing modules
     111    $this->Setup = new Setup($this);
     112    $this->Setup->Start();
     113    $this->Setup->UpdateManager->VersionTable = 'DbVersion';
     114    if($this->Setup->CheckState())
     115    {
     116      $this->ModuleManager->Start();
     117    }
    114118
    115119    // TODO: Global initialized variable should be removed
Note: See TracChangeset for help on using the changeset viewer.