diff --git a/.travis.yml b/.travis.yml index 10a2b6e8347..a4d6dbc92d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,16 +64,6 @@ matrix: - php: nightly # We exclude some combinations not usefull to save Travis CPU exclude: - - php: '5.4' - env: DB=postgresql - - php: '5.5' - env: DB=postgresql - - php: '5.6' - env: DB=postgresql - - php: '7.0' - env: DB=postgresql - - php: '7.1' - env: DB=postgresql - php: hhvm env: DB=postgresql - php: nightly @@ -201,7 +191,7 @@ before_script: 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 + #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 @@ -298,6 +288,63 @@ script: # TODO: Check CSS (csslint?) +- | + export INSTALL_FORCED_FILE=htdocs/install/install.forced.php + echo "Setting up Dolibarr $INSTALL_FORCED_FILE" + # Ensure we catch errors + set +e + echo ' $INSTALL_FORCED_FILE + echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then + echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE + fi + if [ "$DB" = 'postgresql' ]; then + echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE + fi + echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE + # TODO: SQLite + #cat $INSTALL_FORCED_FILE + echo "Installation test" + cd htdocs/install + php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log + php step2.php set >> $TRAVIS_BUILD_DIR/install.log + if [ "$?" -ne "0" ]; then + echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" + exit 1 + fi + cd ../.. + rm $INSTALL_FORCED_FILE + #cat $TRAVIS_BUILD_DIR/install.log + set +e + echo + + - | + echo "Setting up database to test migrations" + 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 "Upgrading Dolibarr" # Ensure we catch errors diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 838ef34afa3..add57f5d853 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -82,6 +82,7 @@ if (@file_exists($forcedfile)) { // If forced install is enabled, let's replace post values. These are empty because form fields are disabled. if ($force_install_noedit) { $main_dir = detect_dolibarr_main_document_root(); + if (!empty($argv[1])) $main_dir = $argv[1]; // override when executing the script in command line if (!empty($force_install_main_data_root)) { $main_data_dir = $force_install_main_data_root; } else { diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 44661c191d7..e0e7d71c25d 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -65,6 +65,8 @@ if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.fo if (@file_exists($forcedfile)) { $useforcedwizard = true; include_once $forcedfile; + // test for travis + if (!empty($argv[1]) && $argv[1] == "set") $action = "set"; } dolibarr_install_syslog("--- step2: entering step2.php page"); @@ -620,8 +622,15 @@ else print 'Parameter action=set not defined'; } +$ret=0; +if (! $ok && isset($argv[1])) $ret=1; +dol_syslog("Exit ".$ret); + dolibarr_install_syslog("--- step2: end"); pFooter($ok?0:1,$setuplang); if (isset($db) && is_object($db)) $db->close(); + +// Return code if ran from command line +if ($ret) exit($ret);