Amlioration de l'install pour grer les install mais aussi mises a jours
This commit is contained in:
parent
29332bed28
commit
9ed3aa644a
@ -22,12 +22,15 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/install/check.php
|
||||
\ingroup install
|
||||
\brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilité de le créer
|
||||
\version $Revision$
|
||||
\file htdocs/install/check.php
|
||||
\ingroup install
|
||||
\brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilité de le créer
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
$err = 0;
|
||||
$allowinstall = 0;
|
||||
$allowupgrade = 0;
|
||||
|
||||
include_once("./inc.php");
|
||||
|
||||
@ -35,28 +38,36 @@ $setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["select
|
||||
$langs->defaultlang=$setuplang;
|
||||
$langs->load("install");
|
||||
|
||||
pHeader($langs->trans("DolibarrWelcome"), "licence"); // Etape suivante = license
|
||||
|
||||
pHeader($langs->trans("DolibarrWelcome"),""); // Etape suivante = license
|
||||
|
||||
print $langs->trans("InstallEasy")."<br>";
|
||||
|
||||
// Si fichier présent et lisible
|
||||
if (is_readable($conffile))
|
||||
{
|
||||
$confexists=1;
|
||||
include_once($conffile);
|
||||
$confexists=1;
|
||||
include_once($conffile);
|
||||
|
||||
// Deja installé, on peut upgrader
|
||||
// \todo Test if database ok
|
||||
$allowupgrade=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si non on le crée
|
||||
$confexists=0;
|
||||
$fp = @fopen("$conffile", "w");
|
||||
if($fp)
|
||||
// Si non on le crée
|
||||
$confexists=0;
|
||||
$fp = @fopen("$conffile", "w");
|
||||
if($fp)
|
||||
{
|
||||
@fwrite($fp, '<?php');
|
||||
@fputs($fp,"\n");
|
||||
@fputs($fp,"?>");
|
||||
fclose($fp);
|
||||
@fwrite($fp, '<?php');
|
||||
@fputs($fp,"\n");
|
||||
@fputs($fp,"?>");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
// First install, on ne peut pas upgrader
|
||||
$allowupgrade=0;
|
||||
}
|
||||
|
||||
// Si fichier absent et n'a pu etre créé
|
||||
@ -74,7 +85,7 @@ if (!file_exists($conffile))
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<br /><br />";
|
||||
print "<br />\n";
|
||||
// Si ficiher présent mais ne peut etre modifié
|
||||
if (!is_writable($conffile))
|
||||
{
|
||||
@ -88,7 +99,7 @@ else
|
||||
print $langs->trans("ConfFileIsNotWritable");
|
||||
print "<br />";
|
||||
|
||||
$err++;
|
||||
$allowinstall=0;
|
||||
}
|
||||
// Si fichier présent et peut etre modifié
|
||||
else
|
||||
@ -101,13 +112,59 @@ else
|
||||
}
|
||||
print "<br />";
|
||||
print $langs->trans("ConfFileIsWritable");
|
||||
print "<br /><br />";
|
||||
print $langs->trans("YouCanContinue");
|
||||
print "<br />";
|
||||
|
||||
$allowinstall=1;
|
||||
}
|
||||
print "<br />\n";
|
||||
print "<br />\n";
|
||||
|
||||
// Si pas d'erreur, on affiche le bouton pour passer à l'étape suivante
|
||||
|
||||
|
||||
print $langs->trans("ChooseYourSetupMode");
|
||||
|
||||
print '<table width="100%" cellspacing="0" cellpadding="4" border="1">';
|
||||
|
||||
print '<tr><td nowrap><b>'.$langs->trans("FreshInstall").'</b></td><td>';
|
||||
print $langs->trans("FreshInstallDesc").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($allowinstall)
|
||||
{
|
||||
print '<a href="licence.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("InstallNotAllowed");
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td nowrap><b>'.$langs->trans("Upgrade").'</b></td><td>';
|
||||
print $langs->trans("UpgradeDesc").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($allowupgrade)
|
||||
{
|
||||
print '<a href="upgrade.php?action=upgrade&selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NotAvailable");
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print "\n";
|
||||
|
||||
}
|
||||
|
||||
// Si pas d'erreur, on affiche le bouton pour passer à l'étape suivante
|
||||
if ($err == 0) pFooter();
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '</body>';
|
||||
print '</html>';
|
||||
|
||||
?>
|
||||
|
||||
@ -20,146 +20,149 @@
|
||||
*/
|
||||
|
||||
body {
|
||||
font-size:14px;
|
||||
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #cac8c0;
|
||||
margin-left: 5%;
|
||||
margin-right: 5%;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 5%;
|
||||
font-size:13px;
|
||||
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #cac8c0;
|
||||
margin-left: 5%;
|
||||
margin-right: 5%;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 5%;
|
||||
}
|
||||
|
||||
div.titre {
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
}
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
}
|
||||
|
||||
span.titre {
|
||||
font-size:1.1em;
|
||||
font-weight: bold;
|
||||
background: #dcdcd3;
|
||||
color: #990033;
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
border: 1px solid #8CACBB;
|
||||
}
|
||||
font-size:1.1em;
|
||||
font-weight: bold;
|
||||
background: #dcdcd3;
|
||||
color: #990033;
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
border: 1px solid #8CACBB;
|
||||
}
|
||||
|
||||
|
||||
div.soustitre {
|
||||
font-size:1.1em;
|
||||
font-weight: bold;
|
||||
color: #990033;
|
||||
padding: 0em 1.2em 0.5em 2em;
|
||||
margin: 1.2em 1.2em 1.2em 1.2em;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
border-right: 1px solid #8CACBB;
|
||||
text-align: right;
|
||||
}
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
color: #990033;
|
||||
padding: 0em 1.2em 0.5em 2em;
|
||||
margin: 1.2em 1.2em 1.2em 1.2em;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
border-right: 1px solid #8CACBB;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
div.main {
|
||||
background: #dcdcd3;
|
||||
text-align: left;
|
||||
border: 1px solid #8CACBB;
|
||||
}
|
||||
div.main {
|
||||
background: #dcdcd3;
|
||||
text-align: left;
|
||||
border: 1px solid #8CACBB;
|
||||
}
|
||||
|
||||
div.main-inside {
|
||||
padding-left: 20px;
|
||||
padding-right: 50px;
|
||||
margin-bottom: 50px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
padding-left: 20px;
|
||||
padding-right: 50px;
|
||||
margin-bottom: 50px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
div.ok {
|
||||
color: #114466;
|
||||
color: #114466;
|
||||
}
|
||||
|
||||
div.warning {
|
||||
color: #777711;
|
||||
color: #777711;
|
||||
}
|
||||
|
||||
div.error {
|
||||
color: #550000; font-weight: bold;
|
||||
padding: 0.2em 0.2em 0.2em 0.2em;
|
||||
margin: 0.5em 0em 0.5em 0em;
|
||||
border: 1px solid #6C7C8B;
|
||||
color: #550000; font-weight: bold;
|
||||
padding: 0.2em 0.2em 0.2em 0.2em;
|
||||
margin: 0.5em 0em 0.5em 0em;
|
||||
border: 1px solid #6C7C8B;
|
||||
}
|
||||
|
||||
div.barrebottom {
|
||||
text-align: right;
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
text-align: right;
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
div.footer {
|
||||
background-color: #dcdff4;
|
||||
font-size: 10px;
|
||||
border-top: solid black 1px;
|
||||
padding-left: 5px;
|
||||
text-align: center;
|
||||
background-color: #dcdff4;
|
||||
font-size: 10px;
|
||||
border-top: solid black 1px;
|
||||
padding-left: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.header {
|
||||
background-color: #dcdff4;
|
||||
border-bottom: solid black 1px;
|
||||
padding-left: 5px;
|
||||
text-align: center;
|
||||
background-color: #dcdff4;
|
||||
border-bottom: solid black 1px;
|
||||
padding-left: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.footer p {
|
||||
margin: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
a:link,a:visited,a:active {
|
||||
text-decoration:none;
|
||||
text-decoration:none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration:underline;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
a.titre {
|
||||
text-decoration:none;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
|
||||
div.comment {
|
||||
text-decoration:none;
|
||||
color:black;
|
||||
font-size: 13px;
|
||||
text-decoration:none;
|
||||
color:black;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
div.main-inside h2 {
|
||||
font-size:18px;
|
||||
font-weight: bold;
|
||||
color: #990033;
|
||||
font-size:18px;
|
||||
font-weight: bold;
|
||||
color: #990033;
|
||||
}
|
||||
|
||||
tr.bg1 {
|
||||
background-color: #E5E5E5;
|
||||
tr.bg1 {
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
tr.bg2 {
|
||||
background-color: #B5E5E5;
|
||||
tr.bg2 {
|
||||
background-color: #B5E5E5;
|
||||
}
|
||||
|
||||
td.label {
|
||||
background: #dcdcd3;
|
||||
color: #990033;
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
}
|
||||
background: #dcdcd3;
|
||||
color: #990033;
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
}
|
||||
|
||||
td.comment {
|
||||
background: #dcdcd3;
|
||||
color: black;
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
text-decoration:none;
|
||||
font-size: 13px;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
}
|
||||
background: #dcdcd3;
|
||||
color: black;
|
||||
padding: 0.5em 0.5em 0.5em;
|
||||
margin: 0em 0em 0em 0em;
|
||||
text-decoration:none;
|
||||
font-size: 13px;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,10 @@
|
||||
|
||||
include_once("./inc.php");
|
||||
|
||||
$grant_query='';
|
||||
$etape = 2;
|
||||
$ok = 0;
|
||||
|
||||
|
||||
// Cette page peut etre longue. On augmente le délai par défaut de 30 à 60.
|
||||
// Ne fonctionne que si on est pas en safe_mode.
|
||||
@ -44,8 +48,6 @@ $langs->load("install");
|
||||
|
||||
pHeader($langs->trans("CreateDatabaseObjects"),"etape4");
|
||||
|
||||
$grant_query='';
|
||||
$etape = 2;
|
||||
|
||||
if (file_exists($conffile))
|
||||
{
|
||||
@ -66,6 +68,7 @@ else
|
||||
|
||||
require ($dolibarr_main_document_root . "/conf/conf.class.php");
|
||||
|
||||
|
||||
if ($_POST["action"] == "set")
|
||||
{
|
||||
print '<h2>'.$langs->trans("Database").'</h2>';
|
||||
@ -81,7 +84,6 @@ if ($_POST["action"] == "set")
|
||||
$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);
|
||||
$ok = 0;
|
||||
if ($db->connected == 1)
|
||||
{
|
||||
print "<tr><td>";
|
||||
|
||||
@ -51,24 +51,36 @@ else
|
||||
require ($dolibarr_main_document_root . "/conf/conf.class.php");
|
||||
|
||||
|
||||
if ($_POST["action"] == "set")
|
||||
if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
||||
{
|
||||
if ($_POST["pass"] <> $_POST["pass_verif"])
|
||||
// If install, check pass and pass_verif used to create admin account
|
||||
if ($_POST["action"] == "set")
|
||||
{
|
||||
Header("Location: etape4.php?error=1&selectlang=$setuplang");
|
||||
if ($_POST["pass"] <> $_POST["pass_verif"])
|
||||
{
|
||||
Header("Location: etape4.php?error=1&selectlang=$setuplang");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strlen(trim($_POST["pass"])) == 0)
|
||||
{
|
||||
Header("Location: etape4.php?error=2&selectlang=$setuplang");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strlen(trim($_POST["login"])) == 0)
|
||||
{
|
||||
Header("Location: etape4.php?error=3&selectlang=$setuplang");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(trim($_POST["pass"])) == 0)
|
||||
|
||||
// If upgrade
|
||||
if ($_POST["action"] == "upgrade")
|
||||
{
|
||||
Header("Location: etape4.php?error=2&selectlang=$setuplang");
|
||||
}
|
||||
|
||||
if (strlen(trim($_POST["login"])) == 0)
|
||||
{
|
||||
Header("Location: etape4.php?error=3&selectlang=$setuplang");
|
||||
}
|
||||
|
||||
|
||||
pHeader($langs->trans("SetupEnd"),"etape5");
|
||||
|
||||
print '<table cellspacing="0" cellpadding="2" width="100%">';
|
||||
@ -83,45 +95,50 @@ if ($_POST["action"] == "set")
|
||||
|
||||
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
||||
$ok = 0;
|
||||
if ($db->connected == 1)
|
||||
{
|
||||
$sql = "INSERT INTO llx_user(datec,login,pass,admin,name,code) VALUES (now()";
|
||||
$sql .= ",'".$_POST["login"]."'";
|
||||
$sql .= ",'".$_POST["pass"]."'";
|
||||
$sql .= ",1,'Administrateur','ADM')";
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
// If first install
|
||||
if ($_POST["action"] == "set")
|
||||
{
|
||||
print $langs->trans("AdminLoginCreatedSuccessfuly")."<br>";
|
||||
$success = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
if ($db->connected == 1)
|
||||
{
|
||||
print $langs->trans("AdminLoginAlreadyExists",$_POST["login"])."<br>";
|
||||
$sql = "INSERT INTO llx_user(datec,login,pass,admin,name,code) VALUES (now()";
|
||||
$sql .= ",'".$_POST["login"]."'";
|
||||
$sql .= ",'".$_POST["pass"]."'";
|
||||
$sql .= ",1,'Administrateur','ADM')";
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
print $langs->trans("AdminLoginCreatedSuccessfuly")."<br>";
|
||||
$success = 1;
|
||||
}
|
||||
else {
|
||||
print $langs->trans("FailedToCreateAdminLogin")."<br>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($success)
|
||||
{
|
||||
$db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
|
||||
|
||||
// Si install non Français, on configure pour fonctionner en mode internationnal
|
||||
if ($langs->defaultlang != "fr_FR")
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE llx_const set value='eldy.php' WHERE name='MAIN_MENU_BARRETOP';");
|
||||
$db->query("UPDATE llx_const set value='eldy.php' WHERE name='MAIN_MENU_BARRELEFT';");
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
print $langs->trans("AdminLoginAlreadyExists",$_POST["login"])."<br>";
|
||||
$success = 1;
|
||||
}
|
||||
else {
|
||||
print $langs->trans("FailedToCreateAdminLogin")."<br>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($success)
|
||||
{
|
||||
$db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
|
||||
|
||||
// Si install non Français, on configure pour fonctionner en mode internationnal
|
||||
if ($langs->defaultlang != "fr_FR")
|
||||
{
|
||||
$db->query("UPDATE llx_const set value='eldy.php' WHERE name='MAIN_MENU_BARRETOP';");
|
||||
$db->query("UPDATE llx_const set value='eldy.php' WHERE name='MAIN_MENU_BARRELEFT';");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
@ -129,14 +146,30 @@ if ($_POST["action"] == "set")
|
||||
|
||||
print "<br>";
|
||||
|
||||
// Fin install
|
||||
print $langs->trans("SystemIsInstalled")."<br>";
|
||||
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
||||
|
||||
print "<br>";
|
||||
// If first install
|
||||
if ($_POST["action"] == "set")
|
||||
{
|
||||
// Fin install
|
||||
print $langs->trans("SystemIsInstalled")."<br>";
|
||||
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
||||
|
||||
print "<br>";
|
||||
|
||||
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
|
||||
}
|
||||
|
||||
// If upgrade
|
||||
if ($_POST["action"] == "upgrade")
|
||||
{
|
||||
// Fin install
|
||||
print $langs->trans("SystemIsUpgraded")."<br>";
|
||||
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
||||
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
|
||||
// Lien vers setup
|
||||
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
|
||||
print '<a href="'.$dolibarr_main_url_root .'/admin/index.php?mainmenu=home&leftmenu=setup">';
|
||||
print $langs->trans("GoToSetupArea");
|
||||
print '</a>';
|
||||
|
||||
@ -46,7 +46,7 @@ $langs = new Translate("../langs", $langcode);
|
||||
|
||||
|
||||
|
||||
function pHeader($soutitre,$next)
|
||||
function pHeader($soutitre,$next,$action='set')
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
@ -62,7 +62,8 @@ function pHeader($soutitre,$next)
|
||||
|
||||
print '<span class="titre"><a class="titre" href="index.php">'.$langs->trans("DolibarrSetup").'</a></span>';
|
||||
|
||||
print '<form action="'.$next.'.php" method="POST"><input type="hidden" name="action" value="set">';
|
||||
print '<form action="'.$next.'.php" method="POST">';
|
||||
print '<input type="hidden" name="action" value="'.$action.'">';
|
||||
print '<div class="main">';
|
||||
if ($soutitre) {
|
||||
print '<div class="soustitre">'.$soutitre.'</div>';
|
||||
|
||||
215
htdocs/install/upgrade.php
Normal file
215
htdocs/install/upgrade.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/install/upgrade.php
|
||||
\brief Execute le script de migration
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
include_once("./inc.php");
|
||||
|
||||
$grant_query='';
|
||||
$etape = 2;
|
||||
$ok = 0;
|
||||
|
||||
|
||||
// Cette page peut etre longue. On augmente le délai par défaut de 30 à 60.
|
||||
// Ne fonctionne que si on est pas en safe_mode.
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
set_time_limit(60);
|
||||
error_reporting($err);
|
||||
|
||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langcode);
|
||||
$langs->defaultlang=$setuplang;
|
||||
$langs->load("admin");
|
||||
$langs->load("install");
|
||||
|
||||
|
||||
pHeader($langs->trans("MigrateScript"),"etape5","upgrade");
|
||||
|
||||
|
||||
if (file_exists($conffile))
|
||||
{
|
||||
include_once($conffile);
|
||||
}
|
||||
|
||||
if($dolibarr_main_db_type == "mysql")
|
||||
{
|
||||
require ($dolibarr_main_document_root . "/lib/mysql.lib.php");
|
||||
$choix=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
require ($dolibarr_main_document_root . "/lib/pgsql.lib.php");
|
||||
require ($dolibarr_main_document_root . "/lib/grant.postgres.php");
|
||||
$choix=2;
|
||||
}
|
||||
|
||||
require ($dolibarr_main_document_root . "/conf/conf.class.php");
|
||||
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == "upgrade")
|
||||
{
|
||||
print '<h2>'.$langs->trans("Database").'</h2>';
|
||||
|
||||
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
|
||||
$error=0;
|
||||
|
||||
$conf = new Conf();// on pourrait s'en passer
|
||||
$conf->db->type = $dolibarr_main_db_type;
|
||||
$conf->db->host = $dolibarr_main_db_host;
|
||||
$conf->db->name = $dolibarr_main_db_name;
|
||||
$conf->db->user = $dolibarr_main_db_user;
|
||||
$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);
|
||||
if ($db->connected == 1)
|
||||
{
|
||||
print "<tr><td nowrap>";
|
||||
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
|
||||
$ok = 1 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr><td>Erreur lors de la création de : $dolibarr_main_db_name</td><td align=\"right\">".$langs->trans("Error")."</td></tr>";
|
||||
}
|
||||
|
||||
if ($ok)
|
||||
{
|
||||
if($db->database_selected == 1)
|
||||
{
|
||||
|
||||
dolibarr_syslog("Connexion réussie à la base : $dolibarr_main_db_name");
|
||||
}
|
||||
else
|
||||
{
|
||||
$ok = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
* Chargement fichiers dans migration
|
||||
*
|
||||
***************************************************************************************/
|
||||
if ($ok)
|
||||
{
|
||||
if ($choix==1) $dir = "../../mysql/migration/";
|
||||
else $dir = "../../pgsql/migration/";
|
||||
$migfile='1.1.0-2.0.0.sql';
|
||||
|
||||
$i = 0;
|
||||
$ok = 0;
|
||||
$handle=opendir($dir);
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (eregi($migfile,$file))
|
||||
{
|
||||
print '<tr><td nowrap>';
|
||||
print $langs->trans("MigrateScript").' :</td><td align="right">'.$file.'</td></tr>';
|
||||
|
||||
$name = substr($file, 0, strlen($file) - 4);
|
||||
$buffer = '';
|
||||
$fp = fopen($dir.$file,"r");
|
||||
if ($fp)
|
||||
{
|
||||
while (!feof ($fp))
|
||||
{
|
||||
$buf = fgets($fp, 4096);
|
||||
$buf = ereg_replace('--(.*)','',$buf); // Delete SQL comments
|
||||
//print $buf.'<br>';
|
||||
$buffer .= $buf;
|
||||
if (eregi(';',$buffer))
|
||||
{
|
||||
// Found new request
|
||||
$arraysql[$i]=$buffer;
|
||||
$i++;
|
||||
$buffer='';
|
||||
}
|
||||
}
|
||||
if ($buffer) $arraysql[$i]=$buffer;
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
// Loop on each request
|
||||
foreach($arraysql as $i=>$sql)
|
||||
{
|
||||
// print '<tr><td>'.$langs->trans("Request").' '.$i.'</td>';
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
// print '<td align="right">OK</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$errno=$db->errno();
|
||||
$okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS',
|
||||
'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
||||
'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
|
||||
'DB_ERROR_RECORD_ALREADY_EXISTS',
|
||||
'DB_ERROR_NOSUCHTABLE',
|
||||
'DB_ERROR_NOSUCHFIELD'
|
||||
);
|
||||
if (in_array($errno,$okerror))
|
||||
{
|
||||
// print '<td align="right">'.$langs->trans("OK").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Request").' '.$i.'</td>';
|
||||
print '<td>'.$langs->trans("Error")." ".$db->errno()." ".$db->error()."</td>";
|
||||
print '</tr>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// print '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans("ProcessMigrateScript").'</td><td align="right">'.$langs->trans("OK").'</td></tr>';
|
||||
$ok = 1;
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="error">'.$langs->trans("ErrorWrongParameters").'</div>';
|
||||
}
|
||||
|
||||
pFooter(!$ok);
|
||||
|
||||
?>
|
||||
@ -49,6 +49,7 @@ PleaseTypeALogin=Please type a login !
|
||||
PasswordsMismatch=Passwords differs, please try again !
|
||||
SetupEnd=End of setup
|
||||
SystemIsInstalled=Your system is now installed.
|
||||
SystemIsUpgraded=Dolibarr has been upgraded successfully.
|
||||
YouNeedToPersonalizeSetup=Now you must configure Dolibarr to match your needs (Look choice, functionnalities, ...). For this, click on the following link:
|
||||
AdminLoginCreatedSuccessfuly=Administrator login created successfuly.
|
||||
GoToSetupArea=Go to setup area
|
||||
@ -59,4 +60,14 @@ DolibarrAdminLogin=Dolibarr admin login
|
||||
FailedToCreateAdminLogin=Failed to create Dolibarr administator account.
|
||||
AdminLoginAlreadyExists=Dolibarr administrator account '%s' already exists.
|
||||
WarningRemoveInstallDir=Warning, for security reasons, once install is finished, you have to remove the install directory.
|
||||
ThisPHPDoesNotSupportTypeBase=This PHP system does not support interfaces to access database type %s
|
||||
ThisPHPDoesNotSupportTypeBase=This PHP system does not support interfaces to access database type %s
|
||||
MigrateScript=Migrate script
|
||||
ProcessMigrateScript=Script processing
|
||||
ChooseYourSetupMode=Choose your setup mode and click "Start"...
|
||||
FreshInstall=Fresh install
|
||||
FreshInstallDesc=Use this mode if this is your first install. If not, this mode can repair a not complete previous install but if you want to upgrade your version, choose other mode
|
||||
Upgrade=Upgrade
|
||||
UpgradeDesc=Use this mode if you had replaced old Dolibarr files with files of a new version
|
||||
Start=Start
|
||||
InstallNotAllowed=Installation non permise
|
||||
NotAvailable=Not available
|
||||
@ -49,6 +49,7 @@ PleaseTypeALogin=Veuillez saisir un login !
|
||||
PasswordsMismatch=Les mots de passe ne correspondent pas, veuillez réessayer !
|
||||
SetupEnd=Fin de l'installation
|
||||
SystemIsInstalled=Votre système est maintenant installé.
|
||||
SystemIsUpgraded=Dolibarr a été mis à jour avec succès.
|
||||
YouNeedToPersonalizeSetup=Vous devez maintenant configurer Dolibarr selon vos besoins (Choix de l'apparence, des fonctionnalités, etc.). Pour cela, cliquez sur le lien ci-dessous:
|
||||
AdminLoginCreatedSuccessfuly=Création du compte administrateur réussie.
|
||||
GoToSetupArea=Accès à l'espace de configuration
|
||||
@ -59,4 +60,14 @@ DolibarrAdminLogin=Login de l'administrateur Dolibarr
|
||||
FailedToCreateAdminLogin=Echec de la création du compte administrateur Dolibarr.
|
||||
AdminLoginAlreadyExists=Compte administrateur Dolibarr '%s' déjà existant.
|
||||
WarningRemoveInstallDir=Attention, pour des raisons de sécurité, une fois l'installation terminé, il est nécessaire de supprimer le répertoire install.
|
||||
ThisPHPDoesNotSupportTypeBase=Le système PHP ne supporta pas les interfaces d'accès pour les base %s
|
||||
ThisPHPDoesNotSupportTypeBase=Le système PHP ne supporta pas les interfaces d'accès pour les base %s
|
||||
MigrateScript=Script de migration
|
||||
ProcessMigrateScript=Exécution du script
|
||||
ChooseYourSetupMode=Choisissez votre mode d'installation et cliquez sur "Démarrer"...
|
||||
FreshInstall=Première installation
|
||||
FreshInstallDesc=Utiliser ce mode si c'est votre première installation. Si ce n'est pas le cas, ce mode peut réparer une installation précédente défectueuse mais si vous voulez juste mettre à jour, choisissez l'autre mode
|
||||
Upgrade=Mise à jour
|
||||
UpgradeDesc=Utilisez ce mode si vous venez de remplacer les vieux fichiers de Dolibarr par ceux d'une version récente
|
||||
Start=Démarrer
|
||||
InstallNotAllowed=Install not allowed
|
||||
NotAvailable=Non disponible
|
||||
|
||||
@ -150,8 +150,8 @@ if (! $user->societe_id) // Si utilisateur interne
|
||||
$conf->top_menu=$conf->global->MAIN_MENU_BARRETOP;
|
||||
$conf->left_menu=$conf->global->MAIN_MENU_BARRELEFT;
|
||||
// Pour compatibilité
|
||||
if ($conf->top_menu == 'eldy.php') $conf->top_menu='eldy_frontoffice.php';
|
||||
if ($conf->left_menu == 'eldy.php') $conf->left_menu='eldy_frontoffice.php';
|
||||
if ($conf->top_menu == 'eldy.php') $conf->top_menu='eldy_backoffice.php';
|
||||
if ($conf->left_menu == 'eldy.php') $conf->left_menu='eldy_backoffice.php';
|
||||
}
|
||||
else // Si utilisateur externe
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user