Fix: Usage of migration scripts from command line

This commit is contained in:
Laurent Destailleur 2014-11-06 13:46:12 +01:00
parent 5086450f35
commit b68bfac593
5 changed files with 32 additions and 6 deletions

0
htdocs/install/mysql/migration/3.5.0-3.6.0.sql Normal file → Executable file
View File

0
htdocs/install/mysql/migration/3.6.0-3.7.0.sql Normal file → Executable file
View File

0
htdocs/install/mysql/migration/repair.sql Normal file → Executable file
View File

23
htdocs/install/upgrade.php Normal file → Executable file
View File

@ -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;

15
htdocs/install/upgrade2.php Normal file → Executable file
View File

@ -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);