Skip to content
Snippets Groups Projects
Commit b68bfac5 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Usage of migration scripts from command line

parent 5086450f
No related branches found
No related tags found
No related merge requests found
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -50,6 +50,7 @@ error_reporting(0);
@set_time_limit(120);
error_reporting($err);
$setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):'auto';
$langs->setDefaultLang($setuplang);
$versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]);
......@@ -74,6 +75,22 @@ if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initial
* View
*/
if (! $versionfrom && ! $versionto)
{
print 'Error: Parameter versionfrom or versionto missing.'."\n";
print 'Upgrade must be ran from cmmand line with parameters or called from page install/index.php (like a first install) instead of page install/upgrade.php'."\n";
// Test if batch mode
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
if (substr($sapi_type, 0, 3) == 'cli')
{
print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n";
}
exit;
}
pHeader('',"upgrade2",GETPOST('action'),'versionfrom='.$versionfrom.'&versionto='.$versionto);
$actiondone=0;
......@@ -85,12 +102,6 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
print '<h3>'.$langs->trans("DatabaseMigration").'</h3>';
if (! $versionfrom && ! $versionto)
{
print '<div class="error">Parameter versionfrom or versionto missing. Upgrade is launched from page install/index.php (like a first install) instead of install/upgrade.php</div>';
exit;
}
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
$error=0;
......
......@@ -83,6 +83,21 @@ if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initial
* View
*/
if (! $versionfrom && ! $versionto)
{
print 'Error: Parameter versionfrom or versionto missing.'."\n";
print 'Upgrade must be ran from cmmand line with parameters or called from page install/index.php (like a first install) instead of page install/upgrade.php'."\n";
// Test if batch mode
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
if (substr($sapi_type, 0, 3) == 'cli')
{
print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n";
}
exit;
}
pHeader('','etape5',GETPOST("action")?GETPOST("action"):'upgrade','versionfrom='.$versionfrom.'&versionto='.$versionto);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment