Commit 096fdfc6 authored by redmatrix's avatar redmatrix

consolidate all the sys_boot functionality that is common between the web...

consolidate all the sys_boot functionality that is common between the web server and the cli daemon manager. Get rid of yet another global variable ($default_timezone) whilst doing so.
parent 8e4889bd
......@@ -13,65 +13,7 @@ class WebServer {
require_once('boot.php');
if(file_exists('.htsite.php'))
include('.htsite.php');
// miniApp is a conversion object from old style .htconfig.php files
$a = new \miniApp;
// our central App object
\App::init();
/*
* Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode.
*/
\App::$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
@include('.htconfig.php');
if(! defined('UNO'))
define('UNO', 0);
$a->convert();
\App::$timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
date_default_timezone_set(\App::$timezone);
/*
* Try to open the database;
*/
require_once('include/dba/dba_driver.php');
if(! \App::$install) {
\DBA::dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, \App::$install);
if(! \DBA::$dba->connected) {
system_unavailable();
}
unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
/**
* Load configs from db. Overwrite configs from .htconfig.php
*/
load_config('config');
load_config('system');
load_config('feature');
\App::$session = new Session();
\App::$session->init();
load_hooks();
call_hooks('init_1');
}
sys_boot();
\App::$language = get_best_language();
......
......@@ -579,6 +579,72 @@ define ( 'ITEM_IS_STICKY', 1000 );
define ( 'DBTYPE_MYSQL', 0 );
define ( 'DBTYPE_POSTGRES', 1 );
function sys_boot() {
// our central App object
\App::init();
/*
* Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode.
*/
// miniApp is a conversion object from old style .htconfig.php files
$a = new \miniApp;
\App::$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
@include('.htconfig.php');
if(! defined('UNO'))
define('UNO', 0);
if(array_key_exists('default_timezone',get_defined_vars())) {
\App::$config['system']['timezone'] = $default_timezone;
}
$a->convert();
\App::$timezone = ((\App::$config['system']['timezone']) ? \App::$config['system']['timezone'] : 'UTC');
date_default_timezone_set(\App::$timezone);
/*
* Try to open the database;
*/
require_once('include/dba/dba_driver.php');
if(! \App::$install) {
\DBA::dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, \App::$install);
if(! \DBA::$dba->connected) {
system_unavailable();
}
unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
/**
* Load configs from db. Overwrite configs from .htconfig.php
*/
load_config('config');
load_config('system');
load_config('feature');
\App::$session = new \Zotlabs\Web\Session();
\App::$session->init();
load_hooks();
call_hooks('init_1');
}
}
/**
*
* Reverse the effect of magic_quotes_gpc if it is enabled.
......
......@@ -6,33 +6,7 @@ require_once('boot.php');
function cli_startup() {
global $default_timezone;
$a = new miniApp;
App::init();
@include(".htconfig.php");
$a->convert();
if(! defined('UNO'))
define('UNO', 0);
App::$timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
date_default_timezone_set(App::$timezone);
require_once('include/dba/dba_driver.php');
DBA::dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
App::$session = new Zotlabs\Web\Session();
App::$session->init();
load_config('system');
sys_boot();
App::set_baseurl(get_config('system','baseurl'));
load_hooks();
}
\ No newline at end of file
......@@ -37,11 +37,11 @@ define( 'UNO', 0 );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = 'America/Los_Angeles';
App::$config['system']['timezone'] = 'America/Los_Angeles';
// What is your site name? DO NOT ADD A TRAILING SLASH!
App::$config['system']['baseurl'] = 'https://myredsite.example';
App::$config['system']['baseurl'] = 'https://mysite.example';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = 'if the auto install failed, put a unique random string here';
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name? DO NOT ADD A TRAILING SLASH!
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -29,7 +29,7 @@ define( 'UNO', {{$uno}} );
// Choisissez votre emplacement géographique. Si vous ntes pas certain, utilisez "America/Los_Angeles".
// Vous pourrez le changer plus tard et ce réglage n'affecte que les visiteurs anonymes.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// Quel sera le nom de votre site?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
......@@ -28,7 +28,7 @@ define( 'UNO', {{$uno}} );
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
$default_timezone = '{{$timezone}}';
App::$config['system']['timezone'] = '{{$timezone}}';
// What is your site name?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment