aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-26 16:33:01 -0700
committerredmatrix <git@macgirvin.com>2016-05-26 16:33:01 -0700
commit096fdfc61b5381bd3f7918a7c5f6004461354f32 (patch)
tree7d664358e06fd2228aab13a60b719a50d88b49f9 /boot.php
parent8e4889bdf1454b3ddb183c25926286d62faa642a (diff)
downloadvolse-hubzilla-096fdfc61b5381bd3f7918a7c5f6004461354f32.tar.gz
volse-hubzilla-096fdfc61b5381bd3f7918a7c5f6004461354f32.tar.bz2
volse-hubzilla-096fdfc61b5381bd3f7918a7c5f6004461354f32.zip
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.
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/boot.php b/boot.php
index 2fa7d8061..b0ef5b3b9 100755
--- a/boot.php
+++ b/boot.php
@@ -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.