diff --git a/.travis.yml b/.travis.yml index cccc1efe1c4..de9e7e00947 100644 --- a/.travis.yml +++ b/.travis.yml @@ -303,6 +303,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. Set this to +e if you want to go to the end to see log files. diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 508f60cfd9a..4b86b6ac32f 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -80,6 +80,7 @@ if (@file_exists($forcedfile)) { // If forced install is enabled, replace the 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 46c84a01351..0b576ac341d 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -64,6 +64,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");