Qual: Add error message if using wrong parameter into upgrade.php script
First try to test migration into travis.
This commit is contained in:
parent
aa69927089
commit
b3229a4021
@ -56,7 +56,7 @@ before_script:
|
||||
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
|
||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
|
||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
|
||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi"
|
||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.4.0.sql; fi"
|
||||
- echo Create config file htdocs/conf/conf.php
|
||||
- echo '<?php ' > htdocs/conf/conf.php
|
||||
- sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
|
||||
@ -84,13 +84,14 @@ before_script:
|
||||
|
||||
|
||||
script:
|
||||
- cd htdocs/install; php upgrade.php 3.4.0 3.5.0
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
|
||||
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php
|
||||
- phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
|
||||
after_script:
|
||||
# - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log
|
||||
|
||||
@ -365,47 +365,54 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
}
|
||||
}
|
||||
|
||||
// Loop on each migrate files
|
||||
foreach($filelist as $file)
|
||||
if (count($filelist) == 0)
|
||||
{
|
||||
print '<tr><td colspan="2"><hr></td></tr>';
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>'."\n";
|
||||
|
||||
// Run sql script
|
||||
$ok=run_sql($dir.$file, 0, '', 1);
|
||||
|
||||
// Scan if there is migration scripts for modules htdocs/module/sql or htdocs/custom/module/sql
|
||||
$modulesfile = array();
|
||||
foreach ($conf->file->dol_document_root as $type => $dirroot)
|
||||
{
|
||||
$handlemodule=@opendir($dirroot); // $dirroot may be '..'
|
||||
if (is_resource($handlemodule))
|
||||
{
|
||||
while (($filemodule = readdir($handlemodule))!==false)
|
||||
{
|
||||
if (! preg_match('/\./',$filemodule) && is_dir($dirroot.'/'.$filemodule.'/sql')) // We exclude filemodule that contains . (are not directories) and are not directories.
|
||||
{
|
||||
//print "Scan for ".$dirroot . '/' . $filemodule . '/sql/'.$file;
|
||||
if (is_file($dirroot . '/' . $filemodule . '/sql/'.$file))
|
||||
{
|
||||
$modulesfile[$dirroot . '/' . $filemodule . '/sql/'.$file] = '/' . $filemodule . '/sql/'.$file;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handlemodule);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($modulesfile as $modulefilelong => $modulefileshort)
|
||||
{
|
||||
print '<tr><td colspan="2"><hr></td></tr>';
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ChoosedMigrateScript").' (external modules)</td><td align="right">'.$modulefileshort.'</td></tr>'."\n";
|
||||
print '<div class="error">'.$langs->trans("ErrorNoMigrationFilesFoundForParameters").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loop on each migrate files
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
print '<tr><td colspan="2"><hr></td></tr>';
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>'."\n";
|
||||
|
||||
// Run sql script
|
||||
$okmodule=run_sql($modulefilelong, 0, '', 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not.
|
||||
}
|
||||
$ok=run_sql($dir.$file, 0, '', 1);
|
||||
|
||||
}
|
||||
// Scan if there is migration scripts for modules htdocs/module/sql or htdocs/custom/module/sql
|
||||
$modulesfile = array();
|
||||
foreach ($conf->file->dol_document_root as $type => $dirroot)
|
||||
{
|
||||
$handlemodule=@opendir($dirroot); // $dirroot may be '..'
|
||||
if (is_resource($handlemodule))
|
||||
{
|
||||
while (($filemodule = readdir($handlemodule))!==false)
|
||||
{
|
||||
if (! preg_match('/\./',$filemodule) && is_dir($dirroot.'/'.$filemodule.'/sql')) // We exclude filemodule that contains . (are not directories) and are not directories.
|
||||
{
|
||||
//print "Scan for ".$dirroot . '/' . $filemodule . '/sql/'.$file;
|
||||
if (is_file($dirroot . '/' . $filemodule . '/sql/'.$file))
|
||||
{
|
||||
$modulesfile[$dirroot . '/' . $filemodule . '/sql/'.$file] = '/' . $filemodule . '/sql/'.$file;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handlemodule);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($modulesfile as $modulefilelong => $modulefileshort)
|
||||
{
|
||||
print '<tr><td colspan="2"><hr></td></tr>';
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ChoosedMigrateScript").' (external modules)</td><td align="right">'.$modulefileshort.'</td></tr>'."\n";
|
||||
|
||||
// Run sql script
|
||||
$okmodule=run_sql($modulefilelong, 0, '', 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user