Skip to content

Commit

Permalink
Add a local define file for a clean override of some options
Browse files Browse the repository at this point in the history
Just create a `config/local_define.php`; add overdidable
defines declarations in it (GLPI_DEMO_MODE and GLPI_USE_CSRF_CHECK
for now)

Ensure based_config is always loaded before define file
  • Loading branch information
trasher committed Jan 31, 2017
1 parent 6f2a6f7 commit 010d6f5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/config/config_db*
/config/config_path.php
/config/local_define.php
/tests/config_db*
/plugins/
/files/
Expand Down
2 changes: 1 addition & 1 deletion inc/autoload.function.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
die("Sorry. You can't access this file directly");
}

include_once (GLPI_ROOT."/inc/define.php");
include_once (GLPI_ROOT."/inc/based_config.php");
include_once (GLPI_ROOT."/inc/define.php");

define ('NS_GLPI', 'Glpi\\');
define ('NS_PLUG', 'GlpiPlugin\\');
Expand Down
13 changes: 10 additions & 3 deletions inc/define.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,21 @@
* @brief
*/

if (file_exists(GLPI_CONFIG_DIR . '/local_define.php')) {
require_once GLPI_CONFIG_DIR . '/local_define.php';
}

// Current version of GLPI
define("GLPI_VERSION", "9.2");
define("GLPI_SCHEMA_VERSION", "9.2");
define('GLPI_MIN_PHP', '5.6.0');
define('GLPI_YEAR', '2016');
define("GLPI_DEMO_MODE", "0");

define("GLPI_USE_CSRF_CHECK", "1");
if (!defined('GLPI_DEMO_MODE')) {
define('GLPI_DEMO_MODE', '0');
}
if (!defined('GLPI_USE_CSRF_CHECK')) {
define('GLPI_USE_CSRF_CHECK', '1');
}
define("GLPI_CSRF_EXPIRES", "7200");
define("GLPI_CSRF_MAX_TOKENS", "100");

Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

//Load GLPI constants
define('GLPI_ROOT', __DIR__);
include (GLPI_ROOT . "/inc/based_config.php");
include_once (GLPI_ROOT . "/inc/define.php");

// Check PHP version not to have trouble
Expand All @@ -48,9 +49,8 @@
}

define('DO_NOT_CHECK_HTTP_REFERER', 1);
// If config_db doesn't exist -> start installation
include (GLPI_ROOT . "/inc/based_config.php");

// If config_db doesn't exist -> start installation
if (!file_exists(GLPI_CONFIG_DIR . "/config_db.php")) {
include_once (GLPI_ROOT . "/inc/autoload.function.php");
Html::redirect("install/install.php");
Expand Down

0 comments on commit 010d6f5

Please sign in to comment.