summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--2800.patch125
-rw-r--r--457e348266100a8d43720b614e898552d1fe24e5.patch67
-rw-r--r--glpi-9.1-config_path.php33
-rw-r--r--glpi-9.2-config_path.php44
-rw-r--r--glpi-9.2-config_path_test.php (renamed from glpi-9.1-config_path_test.php)0
-rw-r--r--glpi-localdef.patch16
-rw-r--r--glpi.spec27
7 files changed, 145 insertions, 167 deletions
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 <remi@remirepo.net>
-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 <remi@remirepo.net>
-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().'&amp;noAUTO=1
-+ 'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&amp;noAUTO=1
-
- Ticket: Description
-
-
-From 374d28644abed93766698ffa15036680c9d4dbfc Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-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 <remi@remirepo.net>
-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().'&amp;noAUTO=1
-+ 'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&amp;noAUTO=1
-
- Ticket: Description
-
-
-From ae7b72cdcae66c063aee460d4939954a8988b66e Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-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 <remi@remirepo.net>
+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 @@
-<?php
-// for Redhat/Fedora RPM defaults
-
-// Config
-define('GLPI_CONFIG_DIR', '/etc/glpi');
-
-// Runtime Data
-define('GLPI_DOC_DIR', '/var/lib/glpi/files');
-define('GLPI_CRON_DIR', GLPI_DOC_DIR . '/_cron');
-define('GLPI_DUMP_DIR', GLPI_DOC_DIR . '/_dumps');
-define('GLPI_GRAPH_DIR', GLPI_DOC_DIR . '/_graphs');
-define('GLPI_LOCK_DIR', GLPI_DOC_DIR . '/_lock');
-define('GLPI_PICTURE_DIR', GLPI_DOC_DIR . '/_pictures');
-define('GLPI_PLUGIN_DOC_DIR', GLPI_DOC_DIR . '/_plugins');
-define('GLPI_RSS_DIR', GLPI_DOC_DIR . '/_rss');
-define('GLPI_SESSION_DIR', GLPI_DOC_DIR . '/_sessions');
-define('GLPI_TMP_DIR', GLPI_DOC_DIR . '/_tmp');
-define('GLPI_UPLOAD_DIR', GLPI_DOC_DIR . '/_uploads');
-
-// Log
-define('GLPI_LOG_DIR', '/var/log/glpi');
-
-// System libraries
-define('GLPI_HTMLAWED', '/usr/share/php/htmLawed/htmLawed.php');
-
-// Fonts
-define('GLPI_FONT_FREESANS', '/usr/share/fonts/gnu-free/FreeSans.ttf');
-
-// Use system cron
-define('GLPI_SYSTEM_CRON', true);
-
-// Packaging
-define('GLPI_INSTALL_MODE', 'RPM');
diff --git a/glpi-9.2-config_path.php b/glpi-9.2-config_path.php
new file mode 100644
index 0000000..30d30a0
--- /dev/null
+++ b/glpi-9.2-config_path.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Red Hat / Fedora RPM default configuration
+ *
+ * Modifying this file in-place is not recommended, because
+ * changes will be overwritten during package upgrades.
+ *
+ * If you want to customize the behaviour, the best way is to
+ * create and use the /etc/glpi/local_define.php file.
+ *
+**/
+
+
+// Config
+define('GLPI_CONFIG_DIR', '/etc/glpi');
+
+// Runtime Data
+defined('GLPI_VAR_DIR') or define('GLPI_VAR_DIR', '/var/lib/glpi/files');
+defined('GLPI_DOC_DIR') or define('GLPI_DOC_DIR', GLPI_VAR_DIR);
+defined('GLPI_CRON_DIR') or define('GLPI_CRON_DIR', GLPI_VAR_DIR . '/_cron');
+defined('GLPI_DUMP_DIR') or define('GLPI_DUMP_DIR', GLPI_VAR_DIR . '/_dumps');
+defined('GLPI_GRAPH_DIR') or define('GLPI_GRAPH_DIR', GLPI_VAR_DIR . '/_graphs');
+defined('GLPI_LOCK_DIR') or define('GLPI_LOCK_DIR', GLPI_VAR_DIR . '/_lock');
+defined('GLPI_PICTURE_DIR') or define('GLPI_PICTURE_DIR', GLPI_VAR_DIR . '/_pictures');
+defined('GLPI_PLUGIN_DOC_DIR') or define('GLPI_PLUGIN_DOC_DIR', GLPI_VAR_DIR . '/_plugins');
+defined('GLPI_RSS_DIR') or define('GLPI_RSS_DIR', GLPI_VAR_DIR . '/_rss');
+defined('GLPI_SESSION_DIR') or define('GLPI_SESSION_DIR', GLPI_VAR_DIR . '/_sessions');
+defined('GLPI_TMP_DIR') or define('GLPI_TMP_DIR', GLPI_VAR_DIR . '/_tmp');
+defined('GLPI_UPLOAD_DIR') or define('GLPI_UPLOAD_DIR', GLPI_VAR_DIR . '/_uploads');
+
+// Log
+defined('GLPI_LOG_DIR') or define('GLPI_LOG_DIR', '/var/log/glpi');
+
+// System libraries
+define('GLPI_HTMLAWED', '/usr/share/php/htmLawed/htmLawed.php');
+
+// Fonts
+define('GLPI_FONT_FREESANS', '/usr/share/fonts/gnu-free/FreeSans.ttf');
+
+// Use system cron
+define('GLPI_SYSTEM_CRON', true);
+
+// Packaging
+define('GLPI_INSTALL_MODE', 'RPM');
diff --git a/glpi-9.1-config_path_test.php b/glpi-9.2-config_path_test.php
index 05c24f2..05c24f2 100644
--- a/glpi-9.1-config_path_test.php
+++ b/glpi-9.2-config_path_test.php
diff --git a/glpi-localdef.patch b/glpi-localdef.patch
new file mode 100644
index 0000000..7b7be8d
--- /dev/null
+++ b/glpi-localdef.patch
@@ -0,0 +1,16 @@
+diff -up ./inc/based_config.php.rpm ./inc/based_config.php
+--- ./inc/based_config.php.rpm 2017-10-11 09:59:42.446010854 +0200
++++ ./inc/based_config.php 2017-10-11 10:11:47.457934585 +0200
+@@ -46,9 +46,9 @@ if (!empty($tz)) {
+ 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 from etc (RPM specific)
++if (file_exists('/etc/glpi/local_define.php')) {
++ require_once '/etc/glpi/local_define.php';
+ }
+
+ // If this file exists, it is load, allow to set configdir/dumpdir elsewhere
diff --git a/glpi.spec b/glpi.spec
index 553b37a..1f35627 100644
--- a/glpi.spec
+++ b/glpi.spec
@@ -43,7 +43,7 @@
Name: %{gh_project}
Version: 9.2
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Free IT asset management software
Summary(fr): Gestion Libre de Parc Informatique
@@ -54,14 +54,19 @@ URL: http://www.glpi-project.org/
Source0: https://github.com/%{gh_owner}/%{name}/archive/%{gh_commit}/%{name}-%{version}%{?prever}-%{gh_short}.tar.gz
Source1: %{name}-httpd.conf
-Source2: %{name}-9.1-config_path.php
-Source12: %{name}-9.1-config_path_test.php
+Source2: %{name}-9.2-config_path.php
+Source12: %{name}-9.2-config_path_test.php
Source3: %{name}-logrotate
Source4: %{name}-nginx.conf
Source5: %{name}-fedora-autoloader.php
# Temporary minify script, waiting for consolidation/robo
Source6: %{name}-minify.php
+# Upstream to use local_define.php and inc/downstream.php
+Patch0: https://github.com/glpi-project/glpi/commit/457e348266100a8d43720b614e898552d1fe24e5.patch
+# RPM patch to use /etc/glpi/local_define.php
+Patch1: glpi-localdef.patch
+
BuildArch: noarch
BuildRequires: gettext
%if %{with_tests}
@@ -213,6 +218,8 @@ techniciens grâce à une maintenance plus cohérente.
%prep
%setup -q -n %{name}-%{gh_commit}
+%patch0 -p1
+%patch1 -p1
grep %{version} inc/define.php
@@ -233,7 +240,7 @@ ln -s /usr/share/fonts/fontawesome/fontawesome-webfont.ttf lib/font-awesome-4.7.
: bundled JS libraries
ls lib
-cp %{SOURCE2} config/config_path.php
+cp %{SOURCE2} inc/downstream.php
cp %{SOURCE6} tools/minify.php
mkdir vendor
@@ -296,10 +303,9 @@ install -Dpm 0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/nginx/default.d/glpi.co
%endif
# ===== config =====
-cp -ar config %{buildroot}/%{_datadir}/%{name}/config
-
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}
touch %{buildroot}%{_sysconfdir}/%{name}/config_db.php
+touch %{buildroot}%{_sysconfdir}/%{name}/local_define.php
# ===== files =====
mkdir -p %{buildroot}/%{_localstatedir}/lib/%{name}
@@ -327,7 +333,6 @@ rm -f %{buildroot}%{_localstatedir}/lib/%{name}/files/.htaccess
# Proctection in /etc/httpd/conf.d/glpi.conf
rm -f %{buildroot}%{_datadir}/%{name}/install/mysql/.htaccess
rm -f %{buildroot}%{_datadir}/%{name}/locales/.htaccess
-rm -f %{buildroot}%{_datadir}/%{name}/config/.htaccess
rm -f %{buildroot}%{_datadir}/%{name}/scripts/.htaccess
@@ -395,7 +400,7 @@ while [ $n -gt 0 ]; do
done
: Set tests configuration
-cp %{SOURCE12} config/config_path.php
+cp %{SOURCE12} inc/downstream.php
: Run upstream test suite
php tools/cliinstall.php --host=127.0.0.1:3308 --db=glpitest --user=root --tests --force --lang=en_GB || RET=1
@@ -463,6 +468,7 @@ fi
%attr(2770,root,apache) %dir %{_sysconfdir}/%{name}
%ghost %config(noreplace,missingok) %{_sysconfdir}/%{name}/config_db.php
+%ghost %config(noreplace,missingok) %{_sysconfdir}/%{name}/local_define.php
%config(noreplace) %{_sysconfdir}/httpd/conf.d/glpi.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
@@ -480,7 +486,6 @@ fi
# License file required by installation process
%{_datadir}/%{name}/COPYING.txt
%{_datadir}/%{name}/ajax
-%{_datadir}/%{name}/config
%{_datadir}/%{name}/css
%{_datadir}/%{name}/front
%{_datadir}/%{name}/inc
@@ -497,6 +502,10 @@ fi
%changelog
+* Wed Oct 11 2017 Remi Collet <remi@remirepo.net> - 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 <remi@remirepo.net> - 9.2-3
- add missing minified JS and CSS files