Ejemplo n.º 1
0
 public function bootstrap($configuration)
 {
     if (!$this->bootstrapped) {
         import('com.solarix.ampoliros.core.AmpConfig');
         import('carthag.core.Registry');
         $registry = Registry::instance();
         $amp_cfg = new AmpConfig($configuration);
         $registry->setEntry('amp.config', $amp_cfg);
         // Ampoliros 3000 style environment variable. Usage is deprecated.
         $gEnv = array();
         $GLOBALS['gEnv'] =& $gEnv;
         $GLOBALS['gEnv']['runtime']['bootstrap'] = 0;
         // ****************************************************************************
         // Ampoliros filesystem and urls
         // ****************************************************************************
         // Trees
         define('PUBLIC_TREE', $amp_cfg->getKey('PUBLIC_TREE'));
         define('PRIVATE_TREE', $amp_cfg->getKey('PRIVATE_TREE'));
         define('SITES_TREE', $amp_cfg->getKey('SITES_TREE'));
         define('ADMIN_PATH', PUBLIC_TREE . 'admin/');
         define('AMP_PATH', PUBLIC_TREE . 'root/');
         define('CGI_PATH', PUBLIC_TREE . 'cgi/');
         define('CONFIG_PATH', PRIVATE_TREE . 'etc/');
         define('HANDLER_PATH', PRIVATE_TREE . 'var/handlers/');
         define('INITDB_PATH', PRIVATE_TREE . 'var/db/');
         define('LIBRARY_PATH', PRIVATE_TREE . 'var/lib/');
         define('MODULE_PATH', PRIVATE_TREE . 'var/modules/');
         define('SITESTUFF_PATH', PRIVATE_TREE . 'var/sites/');
         define('TMP_PATH', PRIVATE_TREE . 'tmp/');
         // Urls
         define('AMP_HOST', $amp_cfg->Value('AMP_HOST'));
         define('AMP_URL', $amp_cfg->Value('AMP_URL'));
         define('AMP_ROOTURL', $amp_cfg->Value('AMP_ROOTURL'));
         define('ADMIN_URL', $amp_cfg->Value('ADMIN_URL'));
         define('CGI_URL', $amp_cfg->Value('CGI_URL'));
         // ****************************************************************************
         // Environment
         // ****************************************************************************
         // PHP
         if (strlen($amp_cfg->Value('PHP_MEMORY_LIMIT'))) {
             $gEnv['core']['php']['memorylimit'] = $amp_cfg->Value('PHP_MEMORY_LIMIT');
         } else {
             $gEnv['core']['php']['memorylimit'] = '64M';
         }
         ini_set('memory_limit', $gEnv['core']['php']['memorylimit']);
         if (strlen($amp_cfg->Value('PHP_EXECUTION_TIME_LIMIT'))) {
             $gEnv['core']['php']['timelimit'] = $amp_cfg->Value('PHP_EXECUTION_TIME_LIMIT');
         } else {
             $gEnv['core']['php']['timelimit'] = 0;
         }
         set_time_limit($gEnv['core']['php']['timelimit']);
         ignore_user_abort(TRUE);
         set_magic_quotes_runtime(0);
         // ****************************************************************************
         // Ampoliros state, mode, interface and edition
         // ****************************************************************************
         // Defines
         define('AMP_SETUP_LOCK', TMP_PATH . '.setup');
         define('AMP_UPGRADINGSYSTEM_LOCK', TMP_PATH . '.upgrading_system');
         // Wait until system is in upgrade phase
         if (!defined('AMPOLIROS_OVERRIDE_LOCK')) {
             while (file_exists(AMP_UPGRADINGSYSTEM_LOCK)) {
                 $this->state = Ampoliros::STATE_UPGRADE;
                 clearstatcache();
                 sleep(1);
             }
         }
         // Check if system is in setup phase and set the state
         if (file_exists(AMP_SETUP_LOCK)) {
             define('AMPOLIROS_SETUP_PHASE', TRUE);
             $this->state = Ampoliros::STATE_SETUP;
             if (extension_loaded('APD')) {
                 apd_set_session_trace(35);
             }
         } else {
             switch ($amp_cfg->Value('AMP_STATE')) {
                 case 'debug':
                     $this->state = Ampoliros::STATE_DEBUG;
                     if (extension_loaded('APD')) {
                         apd_set_session_trace(35);
                     }
                     break;
                 case 'development':
                     $this->state = Ampoliros::STATE_DEVELOPMENT;
                     break;
                 case 'production':
                     $this->state = Ampoliros::STATE_PRODUCTION;
                     break;
                 default:
                     if ($amp_cfg->Value('DEBUG') == '1') {
                         $this->state = Ampoliros::STATE_DEBUG;
                         define('DEBUG', true);
                     } else {
                         $this->state = Ampoliros::STATE_PRODUCTION;
                     }
             }
         }
         // Interface
         $this->interface = Ampoliros::INTERFACE_UNKNOWN;
         // Mode
         $this->mode = Ampoliros::MODE_ROOT;
         // Edition
         if ($amp_cfg->Value('AMP_EDITION') == 'enterprise') {
             $this->edition = Ampoliros::EDITION_ENTERPRISE;
         } else {
             $this->edition = Ampoliros::EDITION_ASP;
         }
         // ****************************************************************************
         // Pid and shutdown function
         // ****************************************************************************
         if ($this->state != Ampoliros::STATE_SETUP) {
             $this->pid = md5(microtime());
             touch(TMP_PATH . 'pids/' . $this->pid, time());
             register_shutdown_function(array($this, 'shutdown'));
         }
         // ****************************************************************************
         // Session
         // ****************************************************************************
         // This must be before session_start
         if (strlen($amp_cfg->Value('SESSION_LIFETIME'))) {
             $gEnv['core']['session']['lifetime'] = $amp_cfg->Value('SESSION_LIFETIME') * 60;
         } else {
             $gEnv['core']['session']['lifetime'] = 1440 * 60 * 365;
         }
         // A year
         ini_set('session.gc_maxlifetime', $gEnv['core']['session']['lifetime']);
         ini_set('session.cookie_lifetime', $gEnv['core']['session']['lifetime']);
         // Start output buffer handler
         if ($amp_cfg->Value('AMP_COMPRESSED_OB') == '1') {
             define('AMP_COMPRESSED_OB', TRUE);
         } else {
             define('AMP_COMPRESSED_OB', FALSE);
         }
         if (!headers_sent()) {
             if (AMP_COMPRESSED_OB) {
                 ob_start('ob_gzhandler');
             }
             if ($this->state != Ampoliros::STATE_SETUP) {
                 ini_set('session.save_path', TMP_PATH . 'phpsessions/');
             }
             session_start();
         }
         $gEnv['runtime']['sessionid'] = session_id();
         // ****************************************************************************
         // Ampoliros network
         // ****************************************************************************
         define('AMP_NAME', $amp_cfg->Value('AMP_NAME'));
         $gEnv['core']['network']['name'] = AMP_NAME;
         define('AMP_DOMAIN', $amp_cfg->Value('AMP_DOMAIN'));
         $gEnv['core']['network']['domain'] = AMP_DOMAIN;
         define('AMP_DNS', $amp_cfg->Value('AMP_DNS'));
         $gEnv['core']['network']['dns'] = AMP_DNS;
         // ****************************************************************************
         // Ampoliros error handler
         // ****************************************************************************
         if ($this->state != Ampoliros::STATE_SETUP) {
             define('PHP_LOG', $amp_cfg->getKey('PRIVATE_TREE') . 'var/log/php.log');
         } else {
             define('PHP_LOG', $amp_cfg->getKey('PRIVATE_TREE') . 'var/log/amp.log');
         }
         $gEnv['core']['error']['log'] = PHP_LOG;
         set_error_handler(array($this, 'errorHandler'));
         // ****************************************************************************
         // Ampoliros root
         // ****************************************************************************
         define('AMP_COUNTRY', $amp_cfg->Value('AMP_COUNTRY'));
         $gEnv['root']['locale']['country'] = AMP_COUNTRY;
         define('AMP_LANG', $amp_cfg->Value('AMP_LANG'));
         $gEnv['root']['locale']['language'] = AMP_LANG;
         define('AMP_LOG', $amp_cfg->getKey('PRIVATE_TREE') . 'var/log/amp.log');
         $gEnv['root']['log'] = AMP_LOG;
         import('com.solarix.ampoliros.db.DBLayerFactory');
         define('AMP_DBTYPE', $amp_cfg->Value('AMP_DBTYPE'));
         define('AMP_DBNAME', $amp_cfg->Value('AMP_DBNAME'));
         define('AMP_DBHOST', $amp_cfg->Value('AMP_DBHOST'));
         define('AMP_DBPORT', $amp_cfg->Value('AMP_DBPORT'));
         define('AMP_DBUSER', $amp_cfg->Value('AMP_DBUSER'));
         define('AMP_DBPASS', $amp_cfg->Value('AMP_DBPASS'));
         define('AMP_DBLOG', $amp_cfg->getKey('PRIVATE_TREE') . 'var/log/ampdb.log');
         $gEnv['root']['dblog'] = AMP_DBLOG;
         if ($amp_cfg->Value('AMP_DBDEBUG') == '1') {
             define('AMP_DBDEBUG', true);
         }
         if ($this->state != Ampoliros::STATE_SETUP) {
             // Ampoliros central database
             //
             $amp_db_args = array();
             $amp_db_args['dbtype'] = AMP_DBTYPE;
             $amp_db_args['dbname'] = AMP_DBNAME;
             $amp_db_args['dbhost'] = AMP_DBHOST;
             $amp_db_args['dbport'] = AMP_DBPORT;
             $amp_db_args['dbuser'] = AMP_DBUSER;
             $amp_db_args['dbpass'] = AMP_DBPASS;
             $amp_db_args['dblog'] = AMP_DBLOG;
             $db_fact = new DBLayerFactory();
             $amp_db = $db_fact->NewDbLayer($amp_db_args);
             if (!$amp_db->Connect($amp_db_args)) {
                 $this->abort('Database not connected', Ampoliros::INTERFACE_CONSOLE);
             }
             unset($amp_db_args);
             $registry->setEntry('amp.root.db', $amp_db);
         }
         // ****************************************************************************
         // Ampoliros remote
         // ****************************************************************************
         define('AMP_REMOTE_LOG', $amp_cfg->getKey('PRIVATE_TREE') . 'var/log/remote.log');
         $gEnv['remote']['log'] = AMP_REMOTE_LOG;
         // ****************************************************************************
         // Run time state and interface defined data
         // ****************************************************************************
         // Debugger
         if ($this->state == Ampoliros::STATE_DEBUG) {
             import('carthag.dev.LoadTime');
             $loadtimer = new LoadTime(LoadTime::LOADTIME_MODE_CONTINUOUS);
             $registry->setEntry('amp.loadtime', $loadtimer);
             $loadtimer->Mark('start');
             $dbloadtimer = new LoadTime(LoadTime::LOADTIME_MODE_STARTSTOP);
             $registry->setEntry('amp.dbloadtime', $dbloadtimer);
         }
         $gEnv['runtime']['disp'] = $this->array_merge_clobber($this->array_merge_clobber($_GET, $_POST), $_FILES);
         // Interface settings
         if ($amp_cfg->Value('AMP_HUI_COMMENTS') == '1' or $this->state == Ampoliros::STATE_DEBUG) {
             define('AMP_HUI_COMMENTS', TRUE);
         } else {
             define('AMP_HUI_COMMENTS', FALSE);
         }
         $gEnv['hui']['theme']['default'] = 'amp4000';
         define('ROOTCRONTAB', $amp_cfg->Value('ROOTCRONTAB'));
         // Security
         $security_reports_interval = $amp_cfg->Value('SECURITY_REPORTS_INTERVAL');
         if ($security_reports_interval > 0) {
             $last_security_report = $amp_cfg->Value('LAST_SECURITY_REPORT');
             if (!$last_security_report or $last_security_report < time() - $security_reports_interval * 3600 * 24) {
                 import('com.solarix.ampoliros.security.SecurityLayer');
                 $amp_security = new SecurityLayer();
                 $amp_security->SendReport();
                 unset($amp_security);
             }
         }
         unset($security_reports_interval);
         // Maintenance
         $maintenance_interval = $amp_cfg->Value('MAINTENANCE_INTERVAL');
         if ($this->state != Ampoliros::STATE_MAINTENANCE and $maintenance_interval > 0) {
             $last_maintenance = $amp_cfg->Value('LAST_MAINTENANCE');
             if (!$last_maintenance or $last_maintenance < time() - $maintenance_interval * 3600 * 24) {
                 import('com.solarix.ampoliros.maintenance.AmpolirosMaintenanceHandler');
                 $amp_maintenance = new AmpolirosMaintenanceHandler();
                 $amp_maintenance->DoMaintenance();
                 $amp_maintenance->SendReport();
                 unset($amp_maintenance);
             }
         }
         unset($maintenance_interval);
         // ****************************************************************************
         // Backward compatibility
         // ****************************************************************************
         $gEnv['core']['config'] = $amp_cfg;
         // Web server
         define('HTTPD_GROUP', $amp_cfg->Value('HTTPD_GROUP'));
         define('HTTPD_USER', $amp_cfg->Value('HTTPD_USER'));
         $gEnv['core']['webserver']['group'] = HTTPD_GROUP;
         $gEnv['core']['webserver']['user'] = HTTPD_USER;
         // Ampoliros 2000 style environment variable. Usage is deprecated.
         global $env;
         $env = array();
         $env['ampcfg'] = $gEnv['core']['config'];
         $env['amplocale'] = AMP_LANG;
         $env['disp'] =& $gEnv['runtime']['disp'];
         // OOPHtml
         $env['defaultcss'] = 'default.css';
         $gEnv['runtime']['pid'] = $this->pid;
         define('AMP_STATE_SETUP', Ampoliros::STATE_SETUP);
         define('AMP_STATE_DEVELOPMENT', Ampoliros::STATE_DEVELOPMENT);
         define('AMP_STATE_DEBUG', Ampoliros::STATE_DEBUG);
         define('AMP_STATE_PRODUCTION', Ampoliros::STATE_PRODUCTION);
         define('AMP_STATE_UPGRADE', Ampoliros::STATE_UPGRADE);
         define('AMP_STATE_MAINTENANCE', Ampoliros::STATE_MAINTENANCE);
         define('AMP_INTERFACE_UNKNOWN', Ampoliros::INTERFACE_UNKNOWN);
         define('AMP_INTERFACE_CONSOLE', Ampoliros::INTERFACE_CONSOLE);
         define('AMP_INTERFACE_WEB', Ampoliros::INTERFACE_WEB);
         define('AMP_INTERFACE_REMOTE', Ampoliros::INTERFACE_REMOTE);
         define('AMP_INTERFACE_GUI', Ampoliros::INTERFACE_GUI);
         define('AMP_INTERFACE_EXTERNAL', Ampoliros::INTERFACE_EXTERNAL);
         define('AMP_MODE_ROOT', Ampoliros::MODE_ROOT);
         define('AMP_MODE_SITE', Ampoliros::MODE_SITE);
         define('AMP_EDITION_ASP', Ampoliros::EDITION_ASP);
         define('AMP_EDITION_ENTERPRISE', Ampoliros::EDITION_ENTERPRISE);
         define('STORESTUFF_PATH', PRIVATE_TREE . 'var/sites/');
         define('LOG_PATH', PRIVATE_TREE . 'var/log/');
         define('CATALOG_PATH', PRIVATE_TREE . 'var/locale/');
         define('BIN_PATH', PRIVATE_TREE . 'var/bin/');
         define('HELP_PATH', PRIVATE_TREE . 'var/help/');
         $gEnv['core']['filesystem']['public'] = PUBLIC_TREE;
         $gEnv['core']['filesystem']['private'] = PRIVATE_TREE;
         $gEnv['core']['filesystem']['sites'] = SITES_TREE;
         $gEnv['core']['state'] = $this->state;
         $gEnv['core']['mode'] = $this->mode;
         $gEnv['core']['interface'] = $this->interface;
         $gEnv['root']['db'] = $amp_db;
         $env['ampdb'] = $gEnv['root']['db'];
         $gEnv['runtime']['modules'] = array();
         $gEnv['runtime']['debug']['loadtime'] = $loadtimer;
         $env['debug']['loadtime'] = $gEnv['runtime']['debug']['loadtime'];
         $gEnv['runtime']['debug']['dbloadtime'] = $dbloadtimer;
         $env['hui'] =& $gEnv['hui'];
         $gEnv['core']['edition'] = $this->edition;
         // ****************************************************************************
         // Auto exec routines
         // ****************************************************************************
         // Module reupdate check
         if (file_exists(TMP_PATH . 'modinst/reupdate')) {
             import('com.solarix.ampoliros.module.Module');
             $tmp_mod = new Module($amp_db, '');
             $tmp_mod->Install(TMP_PATH . 'modinst/reupdate');
             clearstatcache();
             if (file_exists(TMP_PATH . 'modinst/reupdate')) {
                 unlink(TMP_PATH . 'modinst/reupdate');
             }
         }
         // Startup hook
         if ($this->state != Ampoliros::STATE_SETUP) {
             import('com.solarix.ampoliros.util.Hook');
             $hook = new Hook($amp_db, 'ampoliros', 'instance');
             switch ($hook->CallHooks('startup', $null, '')) {
                 case Hook::RESULT_ABORT:
                     $this->abort('Bootstrap aborted', Ampoliros::INTERFACE_CONSOLE);
                     break;
             }
         }
         // Bootstrap end
         $this->bootstrapped = true;
         $GLOBALS['gEnv']['runtime']['bootstrap'] = $this->bootstrapped;
     }
 }
Ejemplo n.º 2
0
function main()
{
    if (!USE_DB_SESSION) {
        validateSessionPath();
    }
    global $request;
    if (DEBUG & _DEBUG_APD and extension_loaded("apd")) {
        apd_set_session_trace(9);
    }
    // Postpone warnings
    global $ErrorManager;
    if (defined('E_STRICT')) {
        // and (E_ALL & E_STRICT)) // strict php5?
        $ErrorManager->setPostponedErrorMask(E_NOTICE | E_USER_NOTICE | E_USER_WARNING | E_WARNING | E_STRICT);
    } else {
        $ErrorManager->setPostponedErrorMask(E_NOTICE | E_USER_NOTICE | E_USER_WARNING | E_WARNING);
    }
    $request = new WikiRequest();
    $action = $request->getArg('action');
    if (substr($action, 0, 3) != 'zip') {
        if ($action == 'pdf') {
            $ErrorManager->setPostponedErrorMask(-1);
        }
        // everything
        //else // reject postponing of warnings
        //    $ErrorManager->setPostponedErrorMask(E_NOTICE|E_USER_NOTICE);
    }
    /*
     * Allow for disabling of markup cache.
     * (Mostly for debugging ... hopefully.)
     *
     * See also <?plugin WikiAdminUtils action=purge-cache ?>
     */
    if (!defined('WIKIDB_NOCACHE_MARKUP')) {
        if ($request->getArg('nocache')) {
            // 1 or purge
            define('WIKIDB_NOCACHE_MARKUP', $request->getArg('nocache'));
        } else {
            define('WIKIDB_NOCACHE_MARKUP', false);
        }
        // redundant, but explicit
    }
    // Initialize with system defaults in case user not logged in.
    // Should this go into constructor?
    $request->initializeTheme();
    $request->updateAuthAndPrefs();
    $request->initializeLang();
    //FIXME:
    //if ($user->is_authenticated())
    //  $LogEntry->user = $user->getId();
    // Memory optimization:
    // http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/
    // kill the global PEAR _PEAR_destructor_object_list
    if (!empty($_PEAR_destructor_object_list)) {
        $_PEAR_destructor_object_list = array();
    }
    $request->possiblyDeflowerVirginWiki();
    // hack! define proper actions for these.
    if (defined('WIKI_XMLRPC') and WIKI_XMLRPC) {
        return;
    }
    if (defined('WIKI_SOAP') and WIKI_SOAP) {
        return;
    }
    $validators = array('wikiname' => WIKI_NAME, 'args' => wikihash($request->getArgs()), 'prefs' => wikihash($request->getPrefs()));
    if (CACHE_CONTROL == 'STRICT') {
        $dbi = $request->getDbh();
        $timestamp = $dbi->getTimestamp();
        $validators['mtime'] = $timestamp;
        $validators['%mtime'] = (int) $timestamp;
    }
    // FIXME: we should try to generate strong validators when possible,
    // but for now, our validator is weak, since equal validators do not
    // indicate byte-level equality of content.  (Due to DEBUG timing output, etc...)
    //
    // (If DEBUG if off, this may be a strong validator, but I'm going
    // to go the paranoid route here pending further study and testing.)
    //
    $validators['%weak'] = true;
    $request->setValidators($validators);
    $request->handleAction();
    if (DEBUG and DEBUG & _DEBUG_INFO) {
        phpinfo(INFO_VARIABLES | INFO_MODULES);
    }
    $request->finish();
}
 /**
  * Bootstraps the Innomatic container.
  *
  * @param string $home Complete path of the directory containing the
  * Innomatic webapp.
  * @param string $configuration Complete path of the Innomatic
  * configuration file.
  */
 public function bootstrap($home, $configuration)
 {
     if ($this->bootstrapped) {
         return;
     }
     $this->home = $home;
     // Reads the configuration
     $this->configurationFile = $configuration;
     $this->config = new InnomaticSettings($configuration);
     // *********************************************************************
     // PHP environment
     // *********************************************************************
     // PHP
     $timelimit = $this->config->value('PHPExecutionTimeLimit');
     if (!strlen($timelimit)) {
         $timelimit = 0;
     }
     set_time_limit($timelimit);
     ignore_user_abort(true);
     // Adds global override classes folder to the include path.
     set_include_path($this->home . 'core/overrides/classes/' . PATH_SEPARATOR . get_include_path());
     // *********************************************************************
     // Innomatic state, environment, mode, interface and edition
     // *********************************************************************
     // Waits until system is in upgrade phase
     if ($this->lockOverride == false) {
         while (file_exists($this->home . 'core/temp/upgrading_system_lock')) {
             $this->state = \Innomatic\Core\InnomaticContainer::STATE_UPGRADE;
             clearstatcache();
             sleep(1);
         }
     }
     // Checks if system is in setup phase and sets the state
     if (file_exists($this->home . 'core/temp/setup_lock')) {
         $this->state = \Innomatic\Core\InnomaticContainer::STATE_SETUP;
         if (extension_loaded('APD')) {
             apd_set_session_trace(35);
         }
     } else {
         switch ($this->config->value('PlatformState')) {
             case 'debug':
                 $this->state = \Innomatic\Core\InnomaticContainer::STATE_DEBUG;
                 if (extension_loaded('APD')) {
                     apd_set_session_trace(35);
                 }
                 break;
             case 'production':
                 $this->state = \Innomatic\Core\InnomaticContainer::STATE_PRODUCTION;
                 break;
             default:
                 $this->state = \Innomatic\Core\InnomaticContainer::STATE_PRODUCTION;
         }
     }
     // Environment
     switch ($this->config->value('PlatformEnvironment')) {
         case 'development':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_DEVELOPMENT;
             break;
         case 'integration':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_INTEGRATION;
             break;
         case 'staging':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_STAGING;
             break;
         case 'production':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_PRODUCTION;
             break;
         default:
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_PRODUCTION;
     }
     // Interface
     //$this->interface = \Innomatic\Core\InnomaticContainer::INTERFACE_UNKNOWN;
     // Mode
     //$this->mode = \Innomatic\Core\InnomaticContainer::MODE_ROOT;
     // Edition
     if ($this->config->value('PlatformEdition') == 'enterprise' or $this->config->value('PlatformEdition') == 'singletenant') {
         $this->edition = \Innomatic\Core\InnomaticContainer::EDITION_SINGLETENANT;
     }
     // *********************************************************************
     // Pid and shutdown function
     // *********************************************************************
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
         $this->pid = md5(microtime());
         if (!file_exists($this->home . 'core/temp/pids/')) {
             @mkdir($this->home . 'core/temp/pids/');
         }
         touch($this->home . 'core/temp/pids/' . $this->pid, time());
         register_shutdown_function(array($this, 'shutdown'));
     }
     // *********************************************************************
     // Innomatic platform name
     // *********************************************************************
     $this->platformName = $this->config->value('PlatformName');
     $this->platformGroup = $this->config->value('PlatformGroup');
     // *********************************************************************
     // Innomatic error handler
     // *********************************************************************
     //set_error_handler(array($this, 'errorHandler'));
     // *********************************************************************
     // Innomatic root
     // *********************************************************************
     $this->country = $this->config->value('RootCountry');
     $this->language = $this->config->value('RootLanguage');
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
         // Innomatic central database
         //
         $dasnString = $this->config->value('RootDatabaseType') . '://' . $this->config->value('RootDatabaseUser') . ':' . $this->config->value('RootDatabasePassword') . '@' . $this->config->value('RootDatabaseHost') . ':' . $this->config->value('RootDatabasePort') . '/' . $this->config->value('RootDatabaseName') . '?' . 'logfile=' . $this->getHome() . 'core/log/innomatic_root_db.log';
         $this->rootDb = \Innomatic\Dataaccess\DataAccessFactory::getDataAccess(new \Innomatic\Dataaccess\DataAccessSourceName($dasnString));
         if (!$this->rootDb->connect()) {
             $this->abort('Database not connected');
         }
     }
     // *********************************************************************
     // Run time state and interface defined data
     // *********************************************************************
     // Debugger
     if ($this->state == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) {
         $this->loadTimer = new \Innomatic\Debug\LoadTime(LoadTime::LOADTIME_MODE_CONTINUOUS);
         $this->loadTimer->Mark('start');
         $this->dbLoadTimer = new \Innomatic\Debug\LoadTime(LoadTime::LOADTIME_MODE_STARTSTOP);
     }
     // Security
     $securityReportsInterval = $this->config->value('SecurityReportsInterval');
     if ($securityReportsInterval > 0) {
         $lastSecurityReport = $this->config->value('SecurityLastReportTime');
         if (!$lastSecurityReport or $lastSecurityReport < time() - $securityReportsInterval * 3600 * 24) {
             $innomaticSecurity = new \Innomatic\Security\SecurityManager();
             $innomaticSecurity->sendReport();
             unset($innomaticSecurity);
         }
     }
     unset($securityReportsInterval);
     // Maintenance
     $maintenanceHandler = new \Innomatic\Maintenance\MaintenanceHandler();
     $maintenanceInterval = $maintenanceHandler->getMaintenanceInterval();
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_MAINTENANCE and $maintenanceInterval > 0) {
         $lastMaintenance = $maintenanceHandler->getLastMaintenanceTime();
         if (!$lastMaintenance or $lastMaintenance < time() - $maintenanceInterval * 3600 * 24) {
             $innomaticMaintenance = new \Innomatic\Maintenance\MaintenanceHandler();
             $innomaticMaintenance->doMaintenance();
             $innomaticMaintenance->sendReport();
             unset($innomaticMaintenance);
         }
     }
     unset($maintenanceInterval);
     // *********************************************************************
     // Auto exec routines
     // *********************************************************************
     // Application reupdate check
     if (file_exists($this->home . 'core/temp/appinst/reupdate')) {
         $tmpmod = new \Innomatic\Application\Application($this->rootDb, '');
         $tmpmod->install($this->home . 'core/temp/appinst/reupdate');
         clearstatcache();
         if (file_exists($this->home . 'core/temp/appinst/reupdate')) {
             unlink($this->home . 'core/temp/appinst/reupdate');
         }
     }
     // Startup hook
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
         $hook = new \Innomatic\Process\Hook($this->rootDb, 'innomatic', 'instance');
         $null = '';
         switch ($hook->callHooks('startup', $null, '')) {
             case \Innomatic\Process\Hook::RESULT_ABORT:
                 $this->abort('Bootstrap aborted');
                 break;
         }
     }
     // Bootstrap end
     $this->bootstrapped = true;
 }