Fix: MAIN_VERSION_LAST_INSTALL was not saved
This commit is contained in:
parent
2aa5173f29
commit
f0aec97efb
@ -21,11 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/install/etape5.php
|
* \file htdocs/install/etape5.php
|
||||||
\ingroup install
|
* \ingroup install
|
||||||
\brief Page de fin d'installation ou de migration
|
* \brief Page de fin d'installation ou de migration
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once("./inc.php");
|
include_once("./inc.php");
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ dolibarr_install_syslog("etape5: Entering etape5.php page", LOG_INFO);
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// If install, check pass and pass_verif used to create admin account
|
// If install, check pass and pass_verif used to create admin account
|
||||||
if ($_POST["action"] == "set")
|
if ($_POST["action"] == "set")
|
||||||
@ -81,54 +81,54 @@ if ($_POST["action"] == "set")
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pHeader($langs->trans("SetupEnd"),"etape5");
|
pHeader($langs->trans("SetupEnd"),"etape5");
|
||||||
|
|
||||||
if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
||||||
{
|
{
|
||||||
print '<table cellspacing="0" cellpadding="2" width="100%">';
|
print '<table cellspacing="0" cellpadding="2" width="100%">';
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// decode database pass if needed
|
// decode database pass if needed
|
||||||
if (! empty($dolibarr_main_db_encrypted_pass))
|
if (! empty($dolibarr_main_db_encrypted_pass))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php");
|
require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php");
|
||||||
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
$conf->db->type = $dolibarr_main_db_type;
|
$conf->db->type = $dolibarr_main_db_type;
|
||||||
$conf->db->host = $dolibarr_main_db_host;
|
$conf->db->host = $dolibarr_main_db_host;
|
||||||
$conf->db->port = $dolibarr_main_db_port;
|
$conf->db->port = $dolibarr_main_db_port;
|
||||||
$conf->db->name = $dolibarr_main_db_name;
|
$conf->db->name = $dolibarr_main_db_name;
|
||||||
$conf->db->user = $dolibarr_main_db_user;
|
$conf->db->user = $dolibarr_main_db_user;
|
||||||
$conf->db->pass = $dolibarr_main_db_pass;
|
$conf->db->pass = $dolibarr_main_db_pass;
|
||||||
|
|
||||||
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
|
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
|
|
||||||
// If first install
|
// If first install
|
||||||
if ($_POST["action"] == "set")
|
if ($_POST["action"] == "set")
|
||||||
{
|
{
|
||||||
// Active module user
|
// Active module user
|
||||||
$modName='modUser';
|
$modName='modUser';
|
||||||
$file = $modName . ".class.php";
|
$file = $modName . ".class.php";
|
||||||
dolibarr_install_syslog('install/etape5.php Load module user '.DOL_DOCUMENT_ROOT ."/includes/modules/".$file, LOG_INFO);
|
dolibarr_install_syslog('install/etape5.php Load module user '.DOL_DOCUMENT_ROOT ."/includes/modules/".$file, LOG_INFO);
|
||||||
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/".$file);
|
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/".$file);
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
$objMod->init();
|
$objMod->init();
|
||||||
|
|
||||||
if ($db->connected == 1)
|
if ($db->connected == 1)
|
||||||
{
|
{
|
||||||
$conf->setValues($db);
|
$conf->setValues($db);
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
include_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
include_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
||||||
|
|
||||||
$createuser=new User($db);
|
$createuser=new User($db);
|
||||||
$createuser->id=0;
|
$createuser->id=0;
|
||||||
|
|
||||||
$newuser = new User($db);
|
$newuser = new User($db);
|
||||||
$newuser->nom='SuperAdmin';
|
$newuser->nom='SuperAdmin';
|
||||||
$newuser->prenom='';
|
$newuser->prenom='';
|
||||||
@ -138,66 +138,60 @@ if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
|||||||
$newuser->entity=0;
|
$newuser->entity=0;
|
||||||
|
|
||||||
$result=$newuser->create($createuser,1);
|
$result=$newuser->create($createuser,1);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
print $langs->trans("AdminLoginCreatedSuccessfuly",$_POST["login"])."<br>";
|
print $langs->trans("AdminLoginCreatedSuccessfuly",$_POST["login"])."<br>";
|
||||||
$success = 1;
|
$success = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($newuser->error == 'ErrorLoginAlreadyExists')
|
if ($newuser->error == 'ErrorLoginAlreadyExists')
|
||||||
{
|
{
|
||||||
dolibarr_install_syslog('install/etape5.php AdminLoginAlreadyExists', LOG_WARNING);
|
dolibarr_install_syslog('install/etape5.php AdminLoginAlreadyExists', LOG_WARNING);
|
||||||
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists",$_POST["login"])."</div><br>";
|
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists",$_POST["login"])."</div><br>";
|
||||||
$success = 1;
|
$success = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_install_syslog('install/etape5.php FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
|
dolibarr_install_syslog('install/etape5.php FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
|
||||||
print '<br>'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'<br><br>';
|
print '<br>'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'<br><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($success)
|
if ($success)
|
||||||
{
|
{
|
||||||
// Si install non Français, on configure pour fonctionner en mode internationnal
|
$db->begin();
|
||||||
if ($langs->defaultlang != "fr_FR")
|
|
||||||
{
|
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_INSTALL const to '.DOL_VERSION, LOG_DEBUG);
|
||||||
$db->query("UPDATE llx_const set value='eldy_backoffice.php' WHERE name='MAIN_MENU_BARRETOP';");
|
$db->query("DELETE FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL'");
|
||||||
$db->query("UPDATE llx_const set value='eldy_backoffice.php' WHERE name='MAIN_MENU_BARRELEFT';");
|
$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values('MAIN_VERSION_LAST_INSTALL','".DOL_VERSION."','chaine',0,'Dolibarr version when install',0)");
|
||||||
|
|
||||||
$db->query("UPDATE llx_const set value='eldy_frontoffice.php' WHERE name='MAIN_MENUFRONT_BARRETOP';");
|
|
||||||
$db->query("UPDATE llx_const set value='eldy_frontoffice.php' WHERE name='MAIN_MENUFRONT_BARRELEFT';");
|
|
||||||
}
|
|
||||||
|
|
||||||
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_INSTALL const to '.DOL_VERSION, LOG_DEBUG);
|
|
||||||
$db->query("DELETE FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL'");
|
|
||||||
$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values('MAIN_VERSION_LAST_INSTALL','".DOL_VERSION."','chaine',0,'Dolibarr version for last install,0')");
|
|
||||||
|
|
||||||
dolibarr_install_syslog('install/etape5.php Remove MAIN_NOT_INSTALLED const', LOG_DEBUG);
|
dolibarr_install_syslog('install/etape5.php Remove MAIN_NOT_INSTALLED const', LOG_DEBUG);
|
||||||
$db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
|
$db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
|
||||||
}
|
|
||||||
}
|
$db->commit();
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
print $langs->trans("Error")."<br>";
|
else
|
||||||
}
|
{
|
||||||
}
|
print $langs->trans("Error")."<br>";
|
||||||
|
}
|
||||||
// If upgrade
|
}
|
||||||
if ($_POST["action"] == "upgrade")
|
|
||||||
{
|
// If upgrade
|
||||||
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_UPGRADE const to value '.DOL_VERSION, LOG_DEBUG);
|
if ($_POST["action"] == "upgrade")
|
||||||
$db->query("DELETE FROM llx_const WHERE name='MAIN_VERSION_LAST_UPGRADE'");
|
{
|
||||||
|
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_UPGRADE const to value '.DOL_VERSION, LOG_DEBUG);
|
||||||
|
$db->query("DELETE FROM llx_const WHERE name='MAIN_VERSION_LAST_UPGRADE'");
|
||||||
$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values('MAIN_VERSION_LAST_UPGRADE','".DOL_VERSION."','chaine',0,'Dolibarr version for last upgrade',0)");
|
$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values('MAIN_VERSION_LAST_UPGRADE','".DOL_VERSION."','chaine',0,'Dolibarr version for last upgrade',0)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// May fail if parameter already defined
|
|
||||||
$resql=$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values('MAIN_LANG_DEFAULT','".$setuplang."','chaine',0,'Default language',1)");
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
$db->close();
|
// May fail if parameter already defined
|
||||||
|
$resql=$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values('MAIN_LANG_DEFAULT','".$setuplang."','chaine',0,'Default language',1)");
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
$db->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<br>";
|
print "<br>";
|
||||||
@ -207,8 +201,8 @@ print "<br>";
|
|||||||
if ($_POST["action"] == "set")
|
if ($_POST["action"] == "set")
|
||||||
{
|
{
|
||||||
// Fin install
|
// Fin install
|
||||||
print $langs->trans("SystemIsInstalled")."<br>";
|
print $langs->trans("SystemIsInstalled")."<br>";
|
||||||
if (empty($force_install_lockinstall))
|
if (empty($force_install_lockinstall))
|
||||||
{
|
{
|
||||||
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
||||||
}
|
}
|
||||||
@ -219,18 +213,18 @@ if ($_POST["action"] == "set")
|
|||||||
fwrite($fp, "This is a lock file to prevent use of install pages");
|
fwrite($fp, "This is a lock file to prevent use of install pages");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
|
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// If upgrade
|
// If upgrade
|
||||||
if ($_POST["action"] == "upgrade")
|
if ($_POST["action"] == "upgrade")
|
||||||
{
|
{
|
||||||
// Fin install
|
// Fin install
|
||||||
print $langs->trans("SystemIsUpgraded")."<br>";
|
print $langs->trans("SystemIsUpgraded")."<br>";
|
||||||
if (empty($force_install_lockinstall))
|
if (empty($force_install_lockinstall))
|
||||||
{
|
{
|
||||||
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
||||||
}
|
}
|
||||||
@ -241,7 +235,7 @@ if ($_POST["action"] == "upgrade")
|
|||||||
fwrite($fp, "This is a lock file to prevent use of install pages");
|
fwrite($fp, "This is a lock file to prevent use of install pages");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<br>";
|
print "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user