Skip to content

Commit

Permalink
Merge pull request #2 from Dolibarr/develop
Browse files Browse the repository at this point in the history
dolibarr up to date fork
  • Loading branch information
wdammak authored May 2, 2018
2 parents 300d696 + 9e18c95 commit 013b5af
Show file tree
Hide file tree
Showing 1,001 changed files with 9,083 additions and 10,701 deletions.
Empty file modified .gitignore
100755 → 100644
Empty file.
229 changes: 117 additions & 112 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/

# We use dist: precise to have php 5.3 available
dist: precise
dist: trusty
sudo: required

language: php
Expand Down Expand Up @@ -140,137 +140,143 @@ install:
echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo
before_script:
- |
echo Start travis
echo Current dir is `pwd`
echo Home dir is `echo ~`
echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
- |
echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
phpenv config-add /tmp/xdebug.ini
echo
- |
echo "Setting up PHP"
echo
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
before_script:
- |
echo Start travis
echo Current dir is `pwd`
echo Home dir is `echo ~`
echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
- |
echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
phpenv config-add /tmp/xdebug.ini
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
echo
- |
if [ "$DEBUG" = true ]; then
echo "Debugging informations"
- |
echo "Setting up PHP"
echo
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
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
echo
- |
echo "Versions information"
# Check PHP
php -i
echo "PHP version"
php -i | head -
# Check PHP CodeSniffer installation
echo "PHPCS version"
which phpcs
phpcs --version
phpcs -i
phpcs --version | head -
phpcs -i | head -
# Check PHPUnit installation
echo "PHPUnit version"
which phpunit
phpunit --version
# Check MySQL
mysql --version
mysql -e "SELECT VERSION();"
phpunit --version | head -
# Check Apache version
echo "Apache version"
apache2 -v | head -
# Check MariaDb
echo "MariaDb version"
mysql --version | head -
mysql -e "SELECT VERSION();" | head -
echo
fi
- |
echo "Setting up database"
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
echo "MySQL"
mysql -e 'DROP DATABASE IF EXISTS travis;'
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
mysql -e 'FLUSH PRIVILEGES;'
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
fi
if [ "$DB" = 'postgresql' ]; then
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
#pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
fi
# TODO: SQLite
echo
- |
echo "Setting up database"
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
echo "MySQL"
mysql -e 'DROP DATABASE IF EXISTS travis;'
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
mysql -e 'FLUSH PRIVILEGES;'
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
fi
if [ "$DB" = 'postgresql' ]; then
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
#pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
fi
# TODO: SQLite
echo
- |
export CONF_FILE=htdocs/conf/conf.php
echo "Setting up Dolibarr $CONF_FILE"
echo '<?php ' > $CONF_FILE
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_host=\'127.0.0.1\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_name=\'travis\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
fi
if [ "$DB" = 'postgresql' ]; then
echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
fi
# TODO: SQLite
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
cat $CONF_FILE
echo
- |
export CONF_FILE=htdocs/conf/conf.php
echo "Setting up Dolibarr $CONF_FILE"
echo '<?php ' > $CONF_FILE
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_host=\'127.0.0.1\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_name=\'travis\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
fi
if [ "$DB" = 'postgresql' ]; then
echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
fi
# TODO: SQLite
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
cat $CONF_FILE
echo
- |
echo "Create documents directory and set permissions"
# and admin/temp subdirectory needed for unit tests
mkdir -p documents/admin/temp
echo "first line" > documents/dolibarr.log
echo
- |
echo "Create documents directory and set permissions"
# and admin/temp subdirectory needed for unit tests
mkdir -p documents/admin/temp
echo "first line" > documents/dolibarr.log
echo
- |
echo "Setting up Apache + FPM"
- echo "Setting up Apache + FPM"
- sudo apt-get update
- sudo apt-get install apache2 libapache2-mod-fastcgi
# enable php-fpm
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_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
# Copy the included pool
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
fi
if [ "$DEBUG" = true ]; then
cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
fi
sudo a2enmod rewrite actions fastcgi alias
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
if [ "$DEBUG" = true ]; then
cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
fi
~/.phpenv/versions/$PHP_VERSION_NAME/sbin/php-fpm
# configure apache virtual hosts
sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/default
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$TRAVIS_BUILD_DIR?g" --in-place /etc/apache2/sites-available/default
if [ "$DEBUG" = true ]; then
sudo cat /etc/apache2/sites-available/default
fi
sudo service apache2 restart
echo
- 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
# 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
- sudo a2enmod rewrite actions fastcgi alias
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# configure apache virtual hosts for precise
#- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
#- sudo cat /etc/apache2/sites-available/default
# configure apache virtual hosts for trusty
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
- sudo cat /etc/apache2/sites-available/000-default.conf
- sudo service apache2 restart



script:
- |
echo "Checking webserver availability"
echo "Checking webserver availability by a wget -O - http://127.0.0.1"
# Ensure we catch errors
set -e
wget http://127.0.0.1
if [ "$DEBUG" = true ]; then
cat index.html
fi
# The wget should return a page with line '<meta name="generator" content="Dolibarr installer">
wget -O - http://127.0.0.1 > test.html
head test.html
set +e
echo
Expand Down Expand Up @@ -338,7 +344,6 @@ script:
- |
echo "Unit testing"
phpunit --version
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
set -e
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
Expand Down
9 changes: 6 additions & 3 deletions build/travis-ci/apache.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<VirtualHost *:80>
DocumentRoot %TRAVIS_BUILD_DIR%/htdocs

<Directory "%TRAVIS_BUILD_DIR%/htdocs">
<Directory "%TRAVIS_BUILD_DIR%/htdocs/">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>

# Wire up Apache to use Travis CI's php-fpm.
Expand All @@ -14,5 +13,9 @@
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization

<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>
</VirtualHost>
8 changes: 3 additions & 5 deletions dev/setup/codesniffer/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@

<rule ref="Generic.NamingConventions.ConstructorName" />
<!-- Check if we use PHP4 constructor instead of __construct() -->
<rule ref="Generic.NamingConventions.ConstructorName.OldStyle">
<severity>0</severity>
</rule>
<rule ref="Generic.NamingConventions.ConstructorName.OldStyle" />

<rule ref="Generic.NamingConventions.UpperCaseConstantName" />

Expand All @@ -156,8 +154,8 @@
<!-- Warning when using @ before functions -->
<!-- <rule ref="Generic.PHP.NoSilencedErrors" /> -->

<!-- Say if null, true, false must be uppercase -->
<!-- <rule ref="Generic.PHP.UpperCaseConstant" /> -->
<!-- Say if null, true, false must be uppercase (Rule 2.5 of PSR2 https://www.php-fig.org/psr/psr-2/) -->
<rule ref="Generic.PHP.LowerCaseConstant" />

<rule ref="Generic.Strings.UnnecessaryStringConcat" />

Expand Down
10 changes: 8 additions & 2 deletions dev/tools/github_authors_peryear.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/sh

FROM=2016-01-01
TO=2016-12-31
if [ "x$1" = "x" ]; then
echo "Usage: $0 YEAR"
exit
fi


FROM=$1-01-01
TO=$1-12-31

echo "git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l"
git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l
Expand Down
5 changes: 3 additions & 2 deletions dev/tools/github_commits_perversion.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#/bin/bash
Releases=("3.8" "3.9" "4.0" "5.0", "develop")
Dates=("2010-01-01", "2011-01-01", "2012-01-01", "2013-01-01", "2014-01-01", "2015-01-01", "2016-07-01")
Releases=("3.8" "3.9" "4.0" "5.0" "6.0" " 7.0" "develop")
Dates=("2013-01-01", "2014-01-01", "2015-01-01", "2016-07-01", "2017-02-01", "2017-07-01", "2018-02-01", "2050-01-01")
let "counter = 1"

for i in "${Releases[@]}"
do
echo "=== $counter git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]}"
git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]}
echo -n "Total $i: "
git log --pretty=oneline --after=${Dates[counter-1]} --before=${Dates[counter]} | wc -l
Expand Down
2 changes: 1 addition & 1 deletion dev/tools/test/testtcpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
Expand Down
2 changes: 1 addition & 1 deletion dev/tools/test/testutf.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);

//set image scale factor
//$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
Expand Down
Loading

0 comments on commit 013b5af

Please sign in to comment.