From 46a4d7ed34b4c3b64f341b00809d293a495e33a4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 11 Oct 2017 10:38:04 +0200 Subject: move config/config_path.php to inc/downstream.php use /etc/glpi/local_define.php to allow local path change --- 2800.patch | 125 ------------------------- 457e348266100a8d43720b614e898552d1fe24e5.patch | 67 +++++++++++++ glpi-9.1-config_path.php | 33 ------- glpi-9.1-config_path_test.php | 24 ----- glpi-9.2-config_path.php | 44 +++++++++ glpi-9.2-config_path_test.php | 24 +++++ glpi-localdef.patch | 16 ++++ glpi.spec | 27 ++++-- 8 files changed, 169 insertions(+), 191 deletions(-) delete mode 100644 2800.patch create mode 100644 457e348266100a8d43720b614e898552d1fe24e5.patch delete mode 100644 glpi-9.1-config_path.php delete mode 100644 glpi-9.1-config_path_test.php create mode 100644 glpi-9.2-config_path.php create mode 100644 glpi-9.2-config_path_test.php create mode 100644 glpi-localdef.patch diff --git a/2800.patch b/2800.patch deleted file mode 100644 index 5bbec35..0000000 --- a/2800.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 599e1c7859ee1369b98d9ad825a26ca745e92810 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 21 Sep 2017 10:14:16 +0200 -Subject: [PATCH 1/5] retrieve test server URI from environment - ---- - tests/bootstrap.php | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/bootstrap.php b/tests/bootstrap.php -index a1793d32b3..cd8cc691a0 100644 ---- a/tests/bootstrap.php -+++ b/tests/bootstrap.php -@@ -34,7 +34,7 @@ - - define('GLPI_CONFIG_DIR', __DIR__); - define('GLPI_LOG_DIR', __DIR__ . '/files/_log'); --define('GLPI_URI', 'http://localhost:8088'); -+define('GLPI_URI', (getenv('GLPI_URI') ?: 'http://localhost:8088')); - define('TU_USER', '_test_user'); - define('TU_PASS', 'PhpUnit_4'); - - -From d3f2a000407a3f5066b89f5272359e97f49bca46 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 21 Sep 2017 10:26:21 +0200 -Subject: [PATCH 2/5] fix test - ---- - tests/units/NotificationEventAjax.php | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/units/NotificationEventAjax.php b/tests/units/NotificationEventAjax.php -index 814aae3deb..ef90f74f5e 100644 ---- a/tests/units/NotificationEventAjax.php -+++ b/tests/units/NotificationEventAjax.php -@@ -167,7 +167,7 @@ public function testRaise() { - 'replytoname' => null, - 'headers' => '', - 'body_html' => null, -- 'body_text' => 'URL : http://localhost:8088/index.php?redirect=ticket_'.$ticket->getID().'&noAUTO=1 -+ 'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&noAUTO=1 - - Ticket: Description - - -From 374d28644abed93766698ffa15036680c9d4dbfc Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 21 Sep 2017 10:30:18 +0200 -Subject: [PATCH 3/5] fix test, relying on "vendor" is terribly bad... - ---- - tests/units/Config.php | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/tests/units/Config.php b/tests/units/Config.php -index 16865fcd46..8cbb570fab 100644 ---- a/tests/units/Config.php -+++ b/tests/units/Config.php -@@ -247,10 +247,12 @@ public function testGetLibraryDir() { - $this->boolean(\Config::getLibraryDir('abcde'))->isFalse(); - - $expected = realpath(__DIR__ . '/../../vendor/phpmailer/phpmailer'); -- $this->string(\Config::getLibraryDir('PHPMailer'))->isIdenticalTo($expected); -+ if (is_dir($expected)) { // skip when system library is used -+ $this->string(\Config::getLibraryDir('PHPMailer'))->isIdenticalTo($expected); - -- $mailer = new \PHPMailer(); -- $this->string(\Config::getLibraryDir($mailer))->isIdenticalTo($expected); -+ $mailer = new \PHPMailer(); -+ $this->string(\Config::getLibraryDir($mailer))->isIdenticalTo($expected); -+ } - - $expected = realpath(__DIR__ . '/../'); - $this->string(\Config::getLibraryDir('getItemByTypeName'))->isIdenticalTo($expected); - -From efcf895548cb06667376f1ef6bc473f1299e069d Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 21 Sep 2017 10:36:10 +0200 -Subject: [PATCH 4/5] fix - ---- - tests/units/NotificationEventAjax.php | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/units/NotificationEventAjax.php b/tests/units/NotificationEventAjax.php -index ef90f74f5e..da1dabc600 100644 ---- a/tests/units/NotificationEventAjax.php -+++ b/tests/units/NotificationEventAjax.php -@@ -167,7 +167,7 @@ public function testRaise() { - 'replytoname' => null, - 'headers' => '', - 'body_html' => null, -- 'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&noAUTO=1 -+ 'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&noAUTO=1 - - Ticket: Description - - -From ae7b72cdcae66c063aee460d4939954a8988b66e Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 21 Sep 2017 10:54:33 +0200 -Subject: [PATCH 5/5] create GLPI_SKIP_ONLINE - ---- - tests/units/NotificationMailing.php | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/tests/units/NotificationMailing.php b/tests/units/NotificationMailing.php -index 3373143371..3f488df840 100644 ---- a/tests/units/NotificationMailing.php -+++ b/tests/units/NotificationMailing.php -@@ -44,8 +44,10 @@ public function testCheck() { - $this->boolean($instance->check('user'))->isFalse(); - $this->boolean($instance->check('user@localhost'))->isTrue(); - $this->boolean($instance->check('user@localhost.dot'))->isTrue(); -- $this->boolean($instance->check('user@localhost.dot', ['checkdns' => true]))->isFalse(); -- $this->boolean($instance->check('user@glpi-project.org', ['checkdns' => true]))->isTrue(); -+ if (!getenv('GLPI_SKIP_ONLINE')) { -+ $this->boolean($instance->check('user@localhost.dot', ['checkdns' => true]))->isFalse(); -+ $this->boolean($instance->check('user@glpi-project.org', ['checkdns' => true]))->isTrue(); -+ } - } - - public function testSendNotification() { diff --git a/457e348266100a8d43720b614e898552d1fe24e5.patch b/457e348266100a8d43720b614e898552d1fe24e5.patch new file mode 100644 index 0000000..b9435e0 --- /dev/null +++ b/457e348266100a8d43720b614e898552d1fe24e5.patch @@ -0,0 +1,67 @@ +From 457e348266100a8d43720b614e898552d1fe24e5 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 28 Sep 2017 16:49:18 +0200 +Subject: [PATCH] config/config_path.php => inc/downstream.php + +ensure local_define is loaded before downstream.php +--- + inc/api.class.php | 6 ++++-- + inc/based_config.php | 11 +++++++++-- + inc/define.php | 4 ---- + 3 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/inc/api.class.php b/inc/api.class.php +index 3ae2966ce1..85eea1d74e 100644 +--- a/inc/api.class.php ++++ b/inc/api.class.php +@@ -247,8 +247,10 @@ protected function retrieveSession() { + $current = session_id(); + $session = trim($this->parameters['session_token']); + +- if (file_exists(GLPI_ROOT . "/config/config_path.php")) { +- include_once (GLPI_ROOT . "/config/config_path.php"); ++ if (file_exists(GLPI_ROOT . '/inc/downstream.php')) { ++ include_once (GLPI_ROOT . '/inc/downstream.php'); ++ } else if (file_exists(GLPI_ROOT . '/config/config_path.php')) { // For compatibility, deprecated ++ include_once (GLPI_ROOT . '/config/config_path.php'); + } + if (!defined("GLPI_SESSION_DIR")) { + define("GLPI_SESSION_DIR", GLPI_ROOT . "/files/_sessions"); +diff --git a/inc/based_config.php b/inc/based_config.php +index ac6dacb893..d952712f77 100644 +--- a/inc/based_config.php ++++ b/inc/based_config.php +@@ -46,9 +46,16 @@ + date_default_timezone_set(@date_default_timezone_get()); + } + ++// If this file exists, it is load ++if (file_exists(GLPI_ROOT. '/config/local_define.php')) { ++ require_once GLPI_ROOT. '/config/local_define.php'; ++} ++ + // If this file exists, it is load, allow to set configdir/dumpdir elsewhere +-if (file_exists(GLPI_ROOT ."/config/config_path.php")) { +- include_once(GLPI_ROOT ."/config/config_path.php"); ++if (file_exists(GLPI_ROOT . '/inc/downstream.php')) { ++ include_once (GLPI_ROOT . '/inc/downstream.php'); ++} else if (file_exists(GLPI_ROOT . '/config/config_path.php')) { // For compatibility, deprecated ++ include_once (GLPI_ROOT . '/config/config_path.php'); + } + + // Default location for database configuration : config_db.php +diff --git a/inc/define.php b/inc/define.php +index b66e00cfdb..4df3619015 100644 +--- a/inc/define.php ++++ b/inc/define.php +@@ -34,10 +34,6 @@ + * @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'); + if (substr(GLPI_VERSION, -4) === '-dev') { diff --git a/glpi-9.1-config_path.php b/glpi-9.1-config_path.php deleted file mode 100644 index 0c35e70..0000000 --- a/glpi-9.1-config_path.php +++ /dev/null @@ -1,33 +0,0 @@ - - 9.2-4 +- move config/config_path.php to inc/downstream.php +- use /etc/glpi/local_define.php to allow local path change + * Wed Sep 27 2017 Remi Collet - 9.2-3 - add missing minified JS and CSS files -- cgit