From d70a18d52144b55949151cc3b9ccc99c3bac48a3 Mon Sep 17 00:00:00 2001 From: rvelices Date: Mon, 19 Dec 2011 20:25:42 +0000 Subject: simplification of 'startup phase' - multisite.inc.php is not required anymore / database.inc.php is included after config. git-svn-id: http://piwigo.org/svn/trunk@12768 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/common.inc.php | 35 ++++++----------------------------- include/config_default.inc.php | 2 +- include/constants.php | 2 +- upgrade.php | 18 +++--------------- upgrade_feed.php | 25 +++++++------------------ 5 files changed, 18 insertions(+), 64 deletions(-) diff --git a/include/common.inc.php b/include/common.inc.php index d4e8984e8..724fc83d3 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -73,23 +73,6 @@ $header_msgs = array(); $header_notes = array(); $filter = array(); -if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php')) -{ - include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'); - define('PWG_LOCAL_DIR', $conf['local_dir_site']); -} -else -{ - define('PWG_LOCAL_DIR', 'local/'); -} - -@include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php'); -if (!defined('PHPWG_INSTALLED')) -{ - header('Location: install.php'); - exit; -} - foreach( array( 'array_intersect_key', //PHP 5 >= 5.1.0RC1 'hash_hmac', //(hash) - enabled by default as of PHP 5.1.2 @@ -105,21 +88,15 @@ foreach( array( include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); -if (isset($conf['local_dir_site'])) -{ - @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php'); -} +defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/'); -// that's for migration from 2.2, will be deprecated in 2.4 -if (isset($conf['order_by'])) -{ - $conf['order_by_custom'] = $conf['order_by']; -} -if (isset($conf['order_by_inside_category'])) + +@include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php'); +if (!defined('PHPWG_INSTALLED')) { - $conf['order_by_inside_category_custom'] = $conf['order_by_inside_category']; + header('Location: install.php'); + exit; } - include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php'); if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors'])) diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 06d01a396..883018ed5 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -502,7 +502,7 @@ $conf['apache_authentication'] = false; // // All informations contained in these tables and column are related to // piwigo_users table. -$conf['users_table'] = $prefixeTable.'users'; +$conf['users_table'] = null; // If you decide to use external authentication // change conf below by $conf['external_authentification'] = true; diff --git a/include/constants.php b/include/constants.php index 6a7e4a7a4..cfc7e9c87 100644 --- a/include/constants.php +++ b/include/constants.php @@ -73,7 +73,7 @@ if (!defined('USER_ACCESS_TABLE')) if (!defined('USER_GROUP_TABLE')) define('USER_GROUP_TABLE', $prefixeTable.'user_group'); if (!defined('USERS_TABLE')) - define('USERS_TABLE', $conf['users_table']); + define('USERS_TABLE', isset($conf['users_table']) ? $conf['users_table'] : $prefixeTable.'users' ); if (!defined('USER_INFOS_TABLE')) define('USER_INFOS_TABLE', $prefixeTable.'user_infos'); if (!defined('USER_FEED_TABLE')) diff --git a/upgrade.php b/upgrade.php index 43cf70b7a..d06c29205 100644 --- a/upgrade.php +++ b/upgrade.php @@ -24,15 +24,9 @@ define('PHPWG_ROOT_PATH', './'); // load config file -if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php')) -{ - include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'); - define('PWG_LOCAL_DIR', $conf['local_dir_site']); -} -else -{ - define('PWG_LOCAL_DIR', 'local/'); -} +include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); +@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); +defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/'); $config_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'config/database.inc.php'; $config_file_contents = @file_get_contents($config_file); @@ -47,12 +41,6 @@ if ($php_end_tag === false) } include($config_file); -include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); -@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); -if (isset($conf['local_dir_site'])) -{ - @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php'); -} // $conf is not used for users tables - define cannot be re-defined define('USERS_TABLE', $prefixeTable.'users'); diff --git a/upgrade_feed.php b/upgrade_feed.php index ee48bd0e4..8ff3c842f 100644 --- a/upgrade_feed.php +++ b/upgrade_feed.php @@ -29,28 +29,17 @@ if (version_compare(PHP_VERSION, '5', '<')) define('PHPWG_ROOT_PATH', './'); +include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); +@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); +defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/'); + +include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php'); +include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php'); + include_once(PHPWG_ROOT_PATH.'include/functions.inc.php'); include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php'); -if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php')) -{ - include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'); - define('PWG_LOCAL_DIR', $conf['local_dir_site']); -} -else -{ - define('PWG_LOCAL_DIR', 'local/'); -} - -include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php'); -include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); -@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); -if (isset($conf['local_dir_site'])) -{ - @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php'); -} -include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php'); // +-----------------------------------------------------------------------+ // | Check Access and exit when it is not ok | -- cgit v1.2.3