Changeset 499

Show
Ignore:
Timestamp:
06/08/08 10:49:46 (7 months ago)
Author:
padams
Message:

addign missing controller for applying updates
added check for whether OWA should fetch config from the DB.

Location:
trunk
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/owa_caller.php

    r498 r499  
    7979                $this->start_time = owa_lib::microtime_float(); 
    8080                 
     81                /* LOAD CONFIG FILE */ 
     82                 
    8183                $file = OWA_BASE_DIR.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'owa-config.php'; 
    8284                 
     
    8991                endif; 
    9092                 
     93                /* SETUP STORAGE ENGINE */ 
     94                 
     95                // Must be called before any entities are created 
    9196                 
    9297                if (!defined('OWA_DB_TYPE')): 
     
    96101                endif; 
    97102                 
    98                  
    99                  
    100                 // Parent Constructor. Sets default config and error logger 
     103                /* SETUP CONFIGURATION AND ERROR LOGGER */ 
     104                 
     105                // Parent Constructor. Sets default config entity and error logger 
    101106                $this->owa_base(); 
    102107                 
    103108                // Log version debug 
    104109                $this->e->debug(sprintf('*** Starting Open Web Analytics v%s. Running under PHP v%s (%s) ***', OWA_VERSION, PHP_VERSION, PHP_OS)); 
    105                                  
     110                         
     111                // Backtrace. handy for debugging who called OWA         
    106112                //$bt = debug_backtrace(); 
    107113                //$this->e->debug($bt[4]);  
    108114                 
    109                  
    110                 /**  
    111                  * Super Global Default Config Overrides 
    112                  *  
    113                  * These are constants that can be defined in the config file, plugin, or caller 
    114                  * the will override default config values 
    115                  */ 
    116                  
    117                  
    118115                /* APPLY CONFIGURATION FILE OVERRIDES */ 
    119                  
    120116                 
    121117                if ($config_file_exists == true): 
     
    149145                         
    150146                endif; 
    151                          
    152                 //$this->e->debug('PURL: '.OWA_PUBLIC_URL);                      
    153                  
     147                                         
    154148                /* DATABASE CONFIGURATION */ 
     149                 
     150                // Can either be set by calling application or the config file. 
    155151                // This needs to come before the fetch of user overrides from the DB 
    156152                // Constants defined in the config file have the final word 
     
    160156                if (!defined('OWA_DB_TYPE')): 
    161157                        define('OWA_DB_TYPE', $config['db_type']); 
    162                 else: 
    163                         $this->c->set('base', 'db_type', OWA_DB_TYPE); 
    164                 endif; 
    165                  
     158                endif; 
     159         
     160                $this->c->set('base', 'db_type', OWA_DB_TYPE); 
     161                                 
    166162                if (!defined('OWA_DB_NAME')): 
    167163                        define('OWA_DB_NAME',  $config['db_name']); 
    168                 else: 
    169                         $this->c->set('base', 'db_name', OWA_DB_NAME); 
    170                 endif; 
    171                  
     164                endif; 
     165                 
     166                $this->c->set('base', 'db_name', OWA_DB_NAME); 
     167                                 
    172168                if (!defined('OWA_DB_HOST')): 
    173169                        define('OWA_DB_HOST',  $config['db_host']); 
    174                 else: 
    175                         $this->c->set('base', 'db_host', OWA_DB_HOST); 
    176                 endif; 
    177                  
     170                endif;           
     171                 
     172                $this->c->set('base', 'db_host', OWA_DB_HOST); 
     173                                 
    178174                if (!defined('OWA_DB_USER')): 
    179175                        define('OWA_DB_USER',  $config['db_user']); 
    180                 else: 
    181                         $this->c->set('base', 'db_user', OWA_DB_USER); 
    182                 endif; 
     176                endif; 
     177                 
     178                $this->c->set('base', 'db_user', OWA_DB_USER); 
    183179                 
    184180                if (!defined('OWA_DB_PASSWORD')): 
    185181                        define('OWA_DB_PASSWORD',  $config['db_password']); 
    186                 else: 
    187                         $this->c->set('base', 'db_password', OWA_DB_PASSWORD); 
    188                 endif;   
     182                endif; 
     183                 
     184                $this->c->set('base', 'db_password', OWA_DB_PASSWORD); 
     185                 
    189186                                         
    190187                /* APPLY USER CONFIGURATION OVERRIDES FROM DATABASE */ 
    191188                 
     189                if (!defined('OWA_CONFIG_DO_NOT_FETCH_FROM_DB')): 
     190                        $this->c->set('base', 'do_not_fetch_config_from_db', $config['do_not_fetch_config_from_db']); 
     191                else: 
     192                        $this->c->set('base', 'do_not_fetch_config_from_db', OWA_CONFIG_DO_NOT_FETCH_FROM_DB); 
     193                endif;           
     194                 
    192195                // Applies config from db or cache 
    193                 // needed for installs when the configuration table does not exist. 
     196                // check here is needed for installs when the configuration table does not exist. 
    194197                if ($this->c->get('base', 'do_not_fetch_config_from_db') != true): 
    195198                        $this->c->load($this->c->get('base', 'configuration_id'));