From f311deb405e6d07be8a537f461ec4085bd136d7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 16:14:45 +0100 Subject: [PATCH 01/24] Fix hash for gol_getprefix must not contains special char. --- htdocs/core/lib/functions.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5d1a977d049..f27224c645f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -616,7 +616,7 @@ if (! function_exists('dol_getprefix')) /** * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. * The prefix for session is unique in a web context only and is unique for instance and avoid conflict - * between multi-instances, even when having two instances with one root dir or two instances in virtual servers. + * between multi-instances, even when having two instances with same root dir or two instances in same virtual server. * The prefix for email is unique if MAIL_PREFIX_FOR_EMAIL_ID is set to a value, otherwise value may be same than other instance. * * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) @@ -634,16 +634,16 @@ if (! function_exists('dol_getprefix')) if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"]; } - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); } if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { - return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); - // Use this for a "readable" cookie name + return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); + // Use this for a "readable" key //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); } } From 4ffd7de9f7aa32662381c2cc9941dfab4683e3aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 16:15:05 +0100 Subject: [PATCH 02/24] doc --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f27224c645f..fffe95cbb0c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -616,7 +616,7 @@ if (! function_exists('dol_getprefix')) /** * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. * The prefix for session is unique in a web context only and is unique for instance and avoid conflict - * between multi-instances, even when having two instances with same root dir or two instances in same virtual server. + * between multi-instances, even when having two instances with same root dir or two instances in same virtual servers. * The prefix for email is unique if MAIL_PREFIX_FOR_EMAIL_ID is set to a value, otherwise value may be same than other instance. * * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) From 8569987b6095f44665ae2e1d9668ebb22ca6f99b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 16:26:16 +0100 Subject: [PATCH 03/24] Fix travis for php 7.3 --- .travis.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 02ac5a1c805..aac89618c42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,7 +133,7 @@ install: if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then composer -n require phpunit/phpunit ^5 fi - if [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + if [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then composer -n require phpunit/phpunit ^5 fi echo @@ -168,13 +168,9 @@ before_script: echo "Set timezone" echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini if [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then - #echo - #echo "Enabling APC for PHP <= 5.4" - # Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6! - #echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini + # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1, 7.2 and nightly! echo echo "Enabling Memcached for PHP <= 5.4" - # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1, 7.2 and nightly! echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini fi phpenv rehash @@ -256,7 +252,7 @@ before_script: # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - | - if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then # Copy the included pool sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf fi From 213a5c9d5d1bd27518cae70339e291b2c56d8d48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 16:40:36 +0100 Subject: [PATCH 04/24] Add apache error log --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index aac89618c42..657c1bc228a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -211,6 +211,7 @@ before_script: fi if [ "$DB" = 'postgresql' ]; then #pgloader mysql://root:pass@127.0.0.1/dolibarr_35 postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dev + echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis pgloader mysql://root@127.0.0.1/travis postgresql:///travis fi # TODO: SQLite @@ -280,6 +281,7 @@ script: # The wget should return a page with line ' wget -O - http://127.0.0.1 > test.html head test.html + tail /var/log/apache2/error.log set +e echo From 9efe10301494738ecfc2fc92724adf904c34b9f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 16:44:35 +0100 Subject: [PATCH 05/24] Fix travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 657c1bc228a..dd5d97fd8a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -281,7 +281,7 @@ script: # The wget should return a page with line ' wget -O - http://127.0.0.1 > test.html head test.html - tail /var/log/apache2/error.log + sudo cat /var/log/apache2/error.log set +e echo From 88635e309903d90fab4fda29b3e6ad7c64979840 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 16:54:04 +0100 Subject: [PATCH 06/24] Try to get log --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dd5d97fd8a3..ed585e2970f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -276,8 +276,8 @@ before_script: script: - | echo "Checking webserver availability by a wget -O - http://127.0.0.1" - # Ensure we catch errors - set -e + # Ensure we stop on error with set -e + set +e # The wget should return a page with line ' wget -O - http://127.0.0.1 > test.html head test.html From 616aa1f81cf2dc9b7310d97d7ffdb6b9d67a943f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 17:10:14 +0100 Subject: [PATCH 07/24] Fix var not defined --- htdocs/core/modules/modDeplacement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php index 285d795ea11..e5c7146729f 100644 --- a/htdocs/core/modules/modDeplacement.class.php +++ b/htdocs/core/modules/modDeplacement.class.php @@ -139,7 +139,7 @@ class modDeplacement extends DolibarrModules $childids = $user->getAllChildIds(); $childids[]=$user->id; - if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; + if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $this->export_sql_end[$r] .=' AND d.fk_user IN ('.join(',',$childids).')'; } } From 9a6517a3bdc60ce8ca2f091b3b8826c044434ba9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 17:38:05 +0100 Subject: [PATCH 08/24] Try to trap apache log --- .travis.yml | 4 ++-- build/travis-ci/apache.conf | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ed585e2970f..48ea16ab886 100644 --- a/.travis.yml +++ b/.travis.yml @@ -281,7 +281,7 @@ script: # The wget should return a page with line ' wget -O - http://127.0.0.1 > test.html head test.html - sudo cat /var/log/apache2/error.log + sudo cat /var/log/apache2/travis_error_log set +e echo @@ -379,7 +379,7 @@ after_failure: done # Apache log file echo "Debugging informations for file apache error.log" - sudo cat /var/log/apache2/error.log + sudo cat /var/log/apache2/travis_error_log if [ "$DEBUG" = true ]; then # Dolibarr log file echo "Debugging informations for file dolibarr.log (latest 50 lines)" diff --git a/build/travis-ci/apache.conf b/build/travis-ci/apache.conf index a4965c40d68..60a4095c34a 100644 --- a/build/travis-ci/apache.conf +++ b/build/travis-ci/apache.conf @@ -1,5 +1,6 @@ DocumentRoot %TRAVIS_BUILD_DIR%/htdocs + ErrorLog /var/log/apache2/travis_error_log Options FollowSymLinks MultiViews ExecCGI From 9712da21cb08f1f0cf273a13711eeb714e2f241f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2019 18:00:20 +0100 Subject: [PATCH 09/24] Try to fix pgsql connection --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 48ea16ab886..6b3b8af1edf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -229,9 +229,11 @@ before_script: echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE + echo '$'dolibarr_main_db_port=\'3306\'';' >> $CONF_FILE fi if [ "$DB" = 'postgresql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE + echo '$'dolibarr_main_db_port=\'5432\'';' >> $CONF_FILE fi # TODO: SQLite echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE @@ -370,7 +372,7 @@ after_success: after_failure: - | echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous commande that fails are enclosed with set +e + # This part of code is executed only if previous command that fails are enclosed with set +e # Upgrade log files for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` do From 168ff1a8063b3d47f679aa0e9bc0e1b8b493d6ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jan 2019 13:22:56 +0100 Subject: [PATCH 10/24] Fix phpcs --- dev/setup/codesniffer/ruleset.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 67bf58e51ed..1ac4f504959 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -50,7 +50,19 @@ 0 - + + 0 + + + 0 + + + 0 + + + 0 + +