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

Merge pull request #3152 from GPCsolutions/install

Install
parents 43c0e7e2 f3c31995
No related branches found
No related tags found
No related merge requests found
...@@ -242,7 +242,7 @@ if ($upgrade) { ...@@ -242,7 +242,7 @@ if ($upgrade) {
[ "versionfrom", $upgrade->{'version'} ], [ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ], [ "versionto", $ver ],
); );
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory. # Remove the installation directory.
...@@ -268,12 +268,12 @@ else { ...@@ -268,12 +268,12 @@ else {
[ "usealternaterootdir", "1" ], [ "usealternaterootdir", "1" ],
[ "main_alt_dir_name", "custom" ], [ "main_alt_dir_name", "custom" ],
); );
local $err = &call_dolibarr_wizard_page(\@params, "etape1", $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, "step1", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Populate database) # Second page (Populate database)
local @params = ( [ "action", "set" ] ); local @params = ( [ "action", "set" ] );
local $err = &call_dolibarr_wizard_page(\@params, "etape2", $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, "step2", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Add administrator account) # Third page (Add administrator account)
...@@ -282,7 +282,7 @@ else { ...@@ -282,7 +282,7 @@ else {
[ "pass", $dompass ], [ "pass", $dompass ],
[ "pass_verif", $dompass ], [ "pass_verif", $dompass ],
); );
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file. # Remove the installation directory and protect config file.
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -43,8 +44,7 @@ $forcedfile="./install.forced.php"; ...@@ -43,8 +44,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; } if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("Dolibarr install/upgrade process started"); dolibarr_install_syslog("--- check: Dolibarr install/upgrade process started");
/* /*
...@@ -167,11 +167,11 @@ if ($memmaxorig != '') ...@@ -167,11 +167,11 @@ if ($memmaxorig != '')
} }
// If config file presente and filled // If config file present and filled
clearstatcache(); clearstatcache();
if (is_readable($conffile) && filesize($conffile) > 8) if (is_readable($conffile) && filesize($conffile) > 8)
{ {
dolibarr_install_syslog("conf file '$conffile' already defined"); dolibarr_install_syslog("check: conf file '" . $conffile . "' already defined");
$confexists=1; $confexists=1;
include_once $conffile; include_once $conffile;
...@@ -189,19 +189,19 @@ if (is_readable($conffile) && filesize($conffile) > 8) ...@@ -189,19 +189,19 @@ if (is_readable($conffile) && filesize($conffile) > 8)
else else
{ {
// If not, we create it // If not, we create it
dolibarr_install_syslog("we try to create conf file '$conffile'"); dolibarr_install_syslog("check: we try to create conf file '" . $conffile . "'");
$confexists=0; $confexists=0;
// First we try by copying example // First we try by copying example
if (@copy($conffile.".example", $conffile)) if (@copy($conffile.".example", $conffile))
{ {
// Success // Success
dolibarr_install_syslog("copied file ".$conffile.".example into ".$conffile." done successfully."); dolibarr_install_syslog("check: successfully copied file " . $conffile . ".example into " . $conffile);
} }
else else
{ {
// If failed, we try to create an empty file // If failed, we try to create an empty file
dolibarr_install_syslog("failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING); dolibarr_install_syslog("check: failed to copy file " . $conffile . ".example into " . $conffile . ". We try to create it.", LOG_WARNING);
$fp = @fopen($conffile, "w"); $fp = @fopen($conffile, "w");
if ($fp) if ($fp)
...@@ -210,7 +210,7 @@ else ...@@ -210,7 +210,7 @@ else
@fputs($fp,"\n"); @fputs($fp,"\n");
fclose($fp); fclose($fp);
} }
else dolibarr_install_syslog("failed to create a new file ".$conffile." into current dir ".getcwd().". Check permission.", LOG_ERR); else dolibarr_install_syslog("check: failed to create a new file " . $conffile . " into current dir " . getcwd() . ". Please check permissions.", LOG_ERR);
} }
// First install, we can't upgrade // First install, we can't upgrade
...@@ -282,7 +282,7 @@ else ...@@ -282,7 +282,7 @@ else
if (! file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php")) if (! file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php"))
{ {
print '<font class="error">A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.</font><br>'."\n"; print '<font class="error">A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.</font><br>'."\n";
dol_syslog("A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to ".$dolibarr_main_document_root." that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.", LOG_WARNING); dol_syslog("A '" . $conffiletoshow . "' file exists with a dolibarr_main_document_root to " . $dolibarr_main_document_root . " that seems wrong. Try to fix or remove the '" . $conffiletoshow . "' file.", LOG_WARNING);
} }
else else
{ {
...@@ -531,5 +531,6 @@ $(".runupgrade").click(function() { ...@@ -531,5 +531,6 @@ $(".runupgrade").click(function() {
</script>'; </script>';
dolibarr_install_syslog("--- check: end");
pFooter(true); // Never display next button pFooter(true); // Never display next button
...@@ -36,7 +36,7 @@ $langs->setDefaultLang($setuplang); ...@@ -36,7 +36,7 @@ $langs->setDefaultLang($setuplang);
$langs->load("install"); $langs->load("install");
$langs->load("errors"); $langs->load("errors");
dolibarr_install_syslog("Fileconf: Entering fileconf.php page"); dolibarr_install_syslog("--- fileconf: entering fileconf.php page");
// You can force preselected values of the config step of Dolibarr by adding a file // You can force preselected values of the config step of Dolibarr by adding a file
// install.forced.php into directory htdocs/install (This is the case with some wizard // install.forced.php into directory htdocs/install (This is the case with some wizard
...@@ -71,12 +71,14 @@ if (@file_exists($forcedfile)) { ...@@ -71,12 +71,14 @@ if (@file_exists($forcedfile)) {
session_start(); // To be able to keep info into session (used for not loosing pass during navigation. pass must not transit throug parmaeters) session_start(); // To be able to keep info into session (used for not loosing pass during navigation. pass must not transit throug parmaeters)
pHeader($langs->trans("ConfigurationFile"),"etape1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/')); pHeader($langs->trans("ConfigurationFile"),"step1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/'));
// Test if we can run a first install process // Test if we can run a first install process
if (! is_writable($conffile)) if (! is_writable($conffile))
{ {
print $langs->trans("ConfFileIsNotWritable",$conffiletoshow); print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
dolibarr_install_syslog("fileconf: config file is not writable", LOG_WARNING);
dolibarr_install_syslog("--- fileconf: end");
pFooter(1,$setuplang,'jscheckparam'); pFooter(1,$setuplang,'jscheckparam');
exit; exit;
} }
...@@ -584,4 +586,5 @@ function jscheckparam() ...@@ -584,4 +586,5 @@ function jscheckparam()
// $db->close(); Not database connexion yet // $db->close(); Not database connexion yet
dolibarr_install_syslog("--- fileconf: end");
pFooter($err,$setuplang,'jscheckparam'); pFooter($err,$setuplang,'jscheckparam');
...@@ -375,13 +375,13 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='') ...@@ -375,13 +375,13 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='')
print '<!-- Includes CSS for JQuery -->'."\n"; print '<!-- Includes CSS for JQuery -->'."\n";
if ($jQueryUiCustomPath) print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery if ($jQueryUiCustomPath) print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
else print '<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.'/jquery-ui-latest.custom.css" />'."\n"; // JQuery else print '<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.'/jquery-ui.custom.css" />'."\n"; // JQuery
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
if ($jQueryCustomPath) print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n"; if ($jQueryCustomPath) print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n";
else print '<script type="text/javascript" src="../includes/jquery/js/jquery-latest.min.js"></script>'."\n"; else print '<script type="text/javascript" src="../includes/jquery/js/jquery.min.js"></script>'."\n";
if ($jQueryUiCustomPath) print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n"; if ($jQueryUiCustomPath) print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n";
else print '<script type="text/javascript" src="../includes/jquery/js/jquery-ui-latest.custom.min.js"></script>'."\n"; else print '<script type="text/javascript" src="../includes/jquery/js/jquery-ui.custom.min.js"></script>'."\n";
print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n"; print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n";
print '</head>'."\n"; print '</head>'."\n";
......
...@@ -28,8 +28,7 @@ include_once '../core/class/html.formadmin.class.php'; ...@@ -28,8 +28,7 @@ include_once '../core/class/html.formadmin.class.php';
$err = 0; $err = 0;
// Si fichier conf existe deja et rempli, on est pas sur une premiere install, // If the config file exists and is filled, we're not on first install so we skip the language selection page
// on ne passe donc pas par la page de choix de langue
if (file_exists($conffile) && isset($dolibarr_main_url_root)) if (file_exists($conffile) && isset($dolibarr_main_url_root))
{ {
header("Location: check.php?testget=ok"); header("Location: check.php?testget=ok");
...@@ -45,7 +44,7 @@ $langs->load("admin"); ...@@ -45,7 +44,7 @@ $langs->load("admin");
$formadmin=new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''. $formadmin=new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''.
pHeader("", "check"); // Etape suivante = check pHeader("", "check"); // Next step = check
// Ask installation language // Ask installation language
...@@ -62,6 +61,6 @@ print '</table></div>'; ...@@ -62,6 +61,6 @@ print '</table></div>';
print '<br><br>'.$langs->trans("SomeTranslationAreUncomplete"); print '<br><br>'.$langs->trans("SomeTranslationAreUncomplete");
// Si pas d'erreur, on affiche le bouton pour passer a l'etape suivante // If there's no error, we display the next step button
if ($err == 0) pFooter(0); if ($err == 0) pFooter(0);
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
*/ */
/** /**
* \file htdocs/install/repair.php * \file htdocs/install/repair.php
* \brief Run repair script * \brief Run repair script
*/ */
...@@ -29,7 +30,7 @@ require_once $dolibarr_main_document_root.'/core/class/extrafields.class.php'; ...@@ -29,7 +30,7 @@ require_once $dolibarr_main_document_root.'/core/class/extrafields.class.php';
require_once 'lib/repair.lib.php'; require_once 'lib/repair.lib.php';
$grant_query=''; $grant_query='';
$etape = 2; $step = 2;
$ok = 0; $ok = 0;
...@@ -54,8 +55,8 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2; ...@@ -54,8 +55,8 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2;
if ($dolibarr_main_db_type == "mssql") $choix=3; if ($dolibarr_main_db_type == "mssql") $choix=3;
dolibarr_install_syslog("repair: Entering upgrade.php page"); dolibarr_install_syslog("--- repair: entering upgrade.php page");
if (! is_object($conf)) dolibarr_install_syslog("repair: conf file not initialized",LOG_ERR); if (! is_object($conf)) dolibarr_install_syslog("repair: conf file not initialized", LOG_ERR);
/* /*
...@@ -105,13 +106,13 @@ if ($db->connected) ...@@ -105,13 +106,13 @@ if ($db->connected)
{ {
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>"; print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerConnection")." : $dolibarr_main_db_host ".$langs->transnoentities("OK")); dolibarr_install_syslog("repair: " . $langs->transnoentities("ServerConnection") . ": " . $dolibarr_main_db_host . $langs->transnoentities("OK"));
$ok = 1; $ok = 1;
} }
else else
{ {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>"; print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)); dolibarr_install_syslog("repair: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0; $ok = 0;
} }
...@@ -121,13 +122,13 @@ if ($ok) ...@@ -121,13 +122,13 @@ if ($ok)
{ {
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>"; print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
dolibarr_install_syslog("repair: Database connection successfull : $dolibarr_main_db_name"); dolibarr_install_syslog("repair: database connection successful: " . $dolibarr_main_db_name);
$ok=1; $ok=1;
} }
else else
{ {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>"; print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)); dolibarr_install_syslog("repair: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok=0; $ok=0;
} }
} }
...@@ -139,7 +140,7 @@ if ($ok) ...@@ -139,7 +140,7 @@ if ($ok)
$versionarray=$db->getVersionArray(); $versionarray=$db->getVersionArray();
print '<tr><td>'.$langs->trans("ServerVersion").'</td>'; print '<tr><td>'.$langs->trans("ServerVersion").'</td>';
print '<td align="right">'.$version.'</td></tr>'; print '<td align="right">'.$version.'</td></tr>';
dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerVersion")." : $version"); dolibarr_install_syslog("repair: " . $langs->transnoentities("ServerVersion") . ": " . $version);
//print '<td align="right">'.join('.',$versionarray).'</td></tr>'; //print '<td align="right">'.join('.',$versionarray).'</td></tr>';
} }
...@@ -514,6 +515,7 @@ print '<div class="center"><a href="../index.php?mainmenu=home'.(isset($_POST["l ...@@ -514,6 +515,7 @@ print '<div class="center"><a href="../index.php?mainmenu=home'.(isset($_POST["l
print $langs->trans("GoToDolibarr"); print $langs->trans("GoToDolibarr");
print '</a></div>'; print '</a></div>';
dolibarr_install_syslog("--- repair: end");
pFooter(1,$setuplang); pFooter(1,$setuplang);
if ($db->connected) $db->close(); if ($db->connected) $db->close();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
*/ */
/** /**
* \file htdocs/install/etape1.php * \file htdocs/install/step1.php
* \ingroup install * \ingroup install
* \brief Build conf file on disk * \brief Build conf file on disk
*/ */
...@@ -64,7 +65,7 @@ $forcedfile="./install.forced.php"; ...@@ -64,7 +65,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; } if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape1: Entering etape1.php page"); dolibarr_install_syslog("--- step1: entering step1.php page");
$error = 0; $error = 0;
...@@ -74,7 +75,7 @@ $error = 0; ...@@ -74,7 +75,7 @@ $error = 0;
*/ */
pHeader($langs->trans("ConfigurationFile"),"etape2"); pHeader($langs->trans("ConfigurationFile"),"step2");
// Test if we can run a first install process // Test if we can run a first install process
if (! is_writable($conffile)) if (! is_writable($conffile))
...@@ -185,7 +186,7 @@ if (! $error) ...@@ -185,7 +186,7 @@ if (! $error)
$db=getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, $db_port); $db=getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, $db_port);
dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG); dol_syslog("databasefortest=" . $databasefortest . " connected=" . $db->connected . " database_selected=" . $db->database_selected, LOG_DEBUG);
//print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected; //print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected;
if (empty($_POST["db_create_database"]) && $db->connected && ! $db->database_selected) if (empty($_POST["db_create_database"]) && $db->connected && ! $db->database_selected)
...@@ -276,7 +277,7 @@ if (! $error && $db->connected) ...@@ -276,7 +277,7 @@ if (! $error && $db->connected)
print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">'; print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
$db_character_set=$defaultCharacterSet; $db_character_set=$defaultCharacterSet;
$db_collation=$defaultDBSortingCollation; $db_collation=$defaultDBSortingCollation;
dolibarr_install_syslog("db_character_set=".$db_character_set." db_collation=".$db_collation); dolibarr_install_syslog("step1: db_character_set=" . $db_character_set . " db_collation=" . $db_collation);
} }
...@@ -286,8 +287,9 @@ if (! $error && $db->connected && $action == "set") ...@@ -286,8 +287,9 @@ if (! $error && $db->connected && $action == "set")
umask(0); umask(0);
foreach($_POST as $key => $value) foreach($_POST as $key => $value)
{ {
if (! preg_match('/^db_pass/i', $key)) if (! preg_match('/^db_pass/i', $key)) {
dolibarr_install_syslog("Choice for ".$key." = ".$value); dolibarr_install_syslog("step1: choice for " . $key . " = " . $value);
}
} }
// Show title of step // Show title of step
...@@ -299,7 +301,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -299,7 +301,7 @@ if (! $error && $db->connected && $action == "set")
{ {
if (! is_dir($main_dir)) if (! is_dir($main_dir))
{ {
dolibarr_install_syslog("etape1: Repertoire '".$main_dir."' inexistant ou non accessible"); dolibarr_install_syslog("step1: directory '" . $main_dir . "' is unavailable or can't be accessed");
print "<tr><td>"; print "<tr><td>";
print $langs->trans("ErrorDirDoesNotExists",$main_dir).'<br>'; print $langs->trans("ErrorDirDoesNotExists",$main_dir).'<br>';
...@@ -314,7 +316,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -314,7 +316,7 @@ if (! $error && $db->connected && $action == "set")
if (! $error) if (! $error)
{ {
dolibarr_install_syslog("etape1: Directory '".$main_dir."' exists"); dolibarr_install_syslog("step1: directory '" . $main_dir . "' exists");
} }
...@@ -343,7 +345,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -343,7 +345,7 @@ if (! $error && $db->connected && $action == "set")
$pathhtaccess=$main_data_dir.'/.htaccess'; $pathhtaccess=$main_data_dir.'/.htaccess';
if (! file_exists($pathhtaccess)) if (! file_exists($pathhtaccess))
{ {
dolibarr_install_syslog("etape1: .htaccess file does not exists, we create it in '".$main_data_dir."'"); dolibarr_install_syslog("step1: .htaccess file did not exist, we created it in '" . $main_data_dir . "'");
$handlehtaccess=@fopen($pathhtaccess,'w'); $handlehtaccess=@fopen($pathhtaccess,'w');
if ($handlehtaccess) if ($handlehtaccess)
{ {
...@@ -351,7 +353,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -351,7 +353,7 @@ if (! $error && $db->connected && $action == "set")
fwrite($handlehtaccess,'Deny from all'."\n"); fwrite($handlehtaccess,'Deny from all'."\n");
fclose($handlehtaccess); fclose($handlehtaccess);
dolibarr_install_syslog("etape1: .htaccess file created"); dolibarr_install_syslog("step1: .htaccess file created");
} }
} }
...@@ -372,7 +374,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -372,7 +374,7 @@ if (! $error && $db->connected && $action == "set")
{ {
if (is_dir($dir[$i])) if (is_dir($dir[$i]))
{ {
dolibarr_install_syslog("etape1: Directory '".$dir[$i]."' exists"); dolibarr_install_syslog("step1: directory '" . $dir[$i] . "' exists");
} }
else else
{ {
...@@ -387,7 +389,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -387,7 +389,7 @@ if (! $error && $db->connected && $action == "set")
} }
else else
{ {
dolibarr_install_syslog("etape1: Directory '".$dir[$i]."' created"); dolibarr_install_syslog("step1: directory '" . $dir[$i] . "' created");
} }
} }
} }
...@@ -475,7 +477,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -475,7 +477,7 @@ if (! $error && $db->connected && $action == "set")
// Si creation utilisateur admin demandee, on le cree // Si creation utilisateur admin demandee, on le cree
if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on") if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on")
{ {
dolibarr_install_syslog("etape1: Create database user: ".$dolibarr_main_db_user); dolibarr_install_syslog("step1: create database user: " . $dolibarr_main_db_user);
//print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port; //print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port;
$databasefortest=$conf->db->name; $databasefortest=$conf->db->name;
...@@ -523,7 +525,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -523,7 +525,7 @@ if (! $error && $db->connected && $action == "set")
|| $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
|| $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS') || $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS')
{ {
dolibarr_install_syslog("etape1: User already exists"); dolibarr_install_syslog("step1: user already exists");
print '<tr><td>'; print '<tr><td>';
print $langs->trans("UserCreation").' : '; print $langs->trans("UserCreation").' : ';
print $dolibarr_main_db_user; print $dolibarr_main_db_user;
...@@ -532,7 +534,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -532,7 +534,7 @@ if (! $error && $db->connected && $action == "set")
} }
else else
{ {
dolibarr_install_syslog("etape1: Failed to create user"); dolibarr_install_syslog("step1: failed to create user", LOG_ERR);
print '<tr><td>'; print '<tr><td>';
print $langs->trans("UserCreation").' : '; print $langs->trans("UserCreation").' : ';
print $dolibarr_main_db_user; print $dolibarr_main_db_user;
...@@ -569,7 +571,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -569,7 +571,7 @@ if (! $error && $db->connected && $action == "set")
// If database creation is asked, we create it // If database creation is asked, we create it
if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on")) if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on"))
{ {
dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user, LOG_DEBUG); dolibarr_install_syslog("step1: create database: " . $dolibarr_main_db_name . " " . $dolibarr_main_db_character_set . " " . $dolibarr_main_db_collation . " " . $dolibarr_main_db_user);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port); $newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
//print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit; //print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
...@@ -587,11 +589,11 @@ if (! $error && $db->connected && $action == "set") ...@@ -587,11 +589,11 @@ if (! $error && $db->connected && $action == "set")
$check1=$newdb->getDefaultCharacterSetDatabase(); $check1=$newdb->getDefaultCharacterSetDatabase();
$check2=$newdb->getDefaultCollationDatabase(); $check2=$newdb->getDefaultCollationDatabase();
dolibarr_install_syslog('etape1: Note that default server was charset='.$check1.' collation='.$check2, LOG_DEBUG); dolibarr_install_syslog('step1: note that default server was charset=' . $check1 . ' collation=' . $check2);
// If values differs, we save conf file again // If values differs, we save conf file again
//if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('etape1: Value for character_set is not the one asked for database creation', LOG_WARNING); //if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING);
//if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('etape1: Value for collation is not the one asked for database creation', LOG_WARNING); //if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING);
} }
else else
{ {
...@@ -603,7 +605,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -603,7 +605,7 @@ if (! $error && $db->connected && $action == "set")
print '<br>'; print '<br>';
print '</td></tr>'; print '</td></tr>';
dolibarr_install_syslog('etape1: Failed to create database '.$dolibarr_main_db_name.' '.$newdb->lasterrno().' '.$newdb->lasterror(), LOG_ERR); dolibarr_install_syslog('step1: failed to create database ' . $dolibarr_main_db_name . ' ' . $newdb->lasterrno() . ' ' . $newdb->lasterror(), LOG_ERR);
$error++; $error++;
} }
$newdb->close(); $newdb->close();
...@@ -632,14 +634,14 @@ if (! $error && $db->connected && $action == "set") ...@@ -632,14 +634,14 @@ if (! $error && $db->connected && $action == "set")
// We test access with dolibarr database user (not admin) // We test access with dolibarr database user (not admin)
if (! $error) if (! $error)
{ {
dolibarr_install_syslog("etape1: connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name, LOG_DEBUG); dolibarr_install_syslog("step1: connection type=" . $conf->db->type . " on host=" . $conf->db->host . " port=" . $conf->db->port . " user=" . $conf->db->user . " name=" . $conf->db->name);
//print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name; //print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name;
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->connected) if ($db->connected)
{ {
dolibarr_install_syslog("etape1: connexion to server by user ".$conf->db->user." is ok", LOG_DEBUG); dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " ok");
print "<tr><td>"; print "<tr><td>";
print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : "; print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_host; print $dolibarr_main_db_host;
...@@ -650,7 +652,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -650,7 +652,7 @@ if (! $error && $db->connected && $action == "set")
// si acces serveur ok et acces base ok, tout est ok, on ne va pas plus loin, on a meme pas utilise le compte root. // si acces serveur ok et acces base ok, tout est ok, on ne va pas plus loin, on a meme pas utilise le compte root.
if ($db->database_selected) if ($db->database_selected)
{ {
dolibarr_install_syslog("etape1: connexion to database : ".$conf->db->name.", by user : ".$conf->db->user." is ok", LOG_DEBUG); dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " ok");
print "<tr><td>"; print "<tr><td>";
print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : "; print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_name; print $dolibarr_main_db_name;
...@@ -662,7 +664,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -662,7 +664,7 @@ if (! $error && $db->connected && $action == "set")
} }
else else
{ {
dolibarr_install_syslog("etape1: connexion to database ".$conf->db->name.", by user : ".$conf->db->user." has failed", LOG_ERR); dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " failed", LOG_ERR);
print "<tr><td>"; print "<tr><td>";
print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : "; print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_name; print $dolibarr_main_db_name;
...@@ -682,7 +684,7 @@ if (! $error && $db->connected && $action == "set") ...@@ -682,7 +684,7 @@ if (! $error && $db->connected && $action == "set")
} }
else else
{ {
dolibarr_install_syslog("etape1: la connexion au serveur par le user ".$conf->db->user." est rate"); dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " failed", LOG_ERR);
print "<tr><td>"; print "<tr><td>";
print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : "; print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_host; print $dolibarr_main_db_host;
...@@ -723,7 +725,7 @@ function jsinfo() ...@@ -723,7 +725,7 @@ function jsinfo()
<?php <?php
dolibarr_install_syslog("--- install/etape1.php end", LOG_INFO); dolibarr_install_syslog("--- step1: end");
pFooter($error,$setuplang,'jsinfo',1); pFooter($error,$setuplang,'jsinfo',1);
...@@ -744,7 +746,6 @@ function write_main_file($mainfile,$main_dir) ...@@ -744,7 +746,6 @@ function write_main_file($mainfile,$main_dir)
fputs($fp, '<?php'."\n"); fputs($fp, '<?php'."\n");
fputs($fp, "// Wrapper to include main into htdocs\n"); fputs($fp, "// Wrapper to include main into htdocs\n");
fputs($fp, "include_once '".$main_dir."/main.inc.php';\n"); fputs($fp, "include_once '".$main_dir."/main.inc.php';\n");
fputs($fp, '?>');
fclose($fp); fclose($fp);
} }
} }
...@@ -766,7 +767,6 @@ function write_master_file($masterfile,$main_dir) ...@@ -766,7 +767,6 @@ function write_master_file($masterfile,$main_dir)
fputs($fp, '<?php'."\n"); fputs($fp, '<?php'."\n");
fputs($fp, "// Wrapper to include master into htdocs\n"); fputs($fp, "// Wrapper to include master into htdocs\n");
fputs($fp, "include_once '".$main_dir."/master.inc.php';\n"); fputs($fp, "include_once '".$main_dir."/master.inc.php';\n");
fputs($fp, '?>');
fclose($fp); fclose($fp);
} }
} }
...@@ -928,7 +928,6 @@ function write_conf_file($conffile) ...@@ -928,7 +928,6 @@ function write_conf_file($conffile)
fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';'); fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';');
fputs($fp,"\n"); fputs($fp,"\n");
fputs($fp, '?>');
fclose($fp); fclose($fp);
if (file_exists("$conffile")) if (file_exists("$conffile"))
......
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2015 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -18,8 +19,8 @@ ...@@ -18,8 +19,8 @@
*/ */
/** /**
* \file htdocs/install/etape2.php * \file htdocs/install/step2.php
* \ingroup install * \ingroup install
* \brief Create tables, primary keys, foreign keys, indexes and functions into database and then load reference data * \brief Create tables, primary keys, foreign keys, indexes and functions into database and then load reference data
*/ */
...@@ -27,7 +28,7 @@ include 'inc.php'; ...@@ -27,7 +28,7 @@ include 'inc.php';
require_once $dolibarr_main_document_root.'/core/class/conf.class.php'; require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
$etape = 2; $step = 2;
$ok = 0; $ok = 0;
...@@ -54,7 +55,7 @@ if ($dolibarr_main_db_type == "mssql") $choix=3; ...@@ -54,7 +55,7 @@ if ($dolibarr_main_db_type == "mssql") $choix=3;
if ($dolibarr_main_db_type == "sqlite") $choix=4; if ($dolibarr_main_db_type == "sqlite") $choix=4;
if ($dolibarr_main_db_type == "sqlite3") $choix=5; if ($dolibarr_main_db_type == "sqlite3") $choix=5;
//if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into etape2.php page'); //if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page');
// Now we load forced value from install.forced.php file. // Now we load forced value from install.forced.php file.
$useforcedwizard=false; $useforcedwizard=false;
...@@ -62,14 +63,14 @@ $forcedfile="./install.forced.php"; ...@@ -62,14 +63,14 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; } if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape2: Entering etape2.php page"); dolibarr_install_syslog("--- step2: entering step2.php page");
/* /*
* View * View
*/ */
pHeader($langs->trans("CreateDatabaseObjects"),"etape4"); pHeader($langs->trans("CreateDatabaseObjects"),"step4");
// Test if we can run a first install process // Test if we can run a first install process
if (! is_writable($conffile)) if (! is_writable($conffile))
...@@ -103,11 +104,11 @@ if ($action == "set") ...@@ -103,11 +104,11 @@ if ($action == "set")
{ {
if($db->database_selected) if($db->database_selected)
{ {
dolibarr_install_syslog("etape2: Connexion successful to database : ".$conf->db->name); dolibarr_install_syslog("step2: successful connection to database: " . $conf->db->name);
} }
else else
{ {
dolibarr_install_syslog("etape2: Connexion failed to database : ".$conf->db->name); dolibarr_install_syslog("step2: failed connection to database :" . $conf->db->name, LOG_ERR);
print "<tr><td>Failed to select database ".$conf->db->name.'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>'; print "<tr><td>Failed to select database ".$conf->db->name.'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
$ok = 0 ; $ok = 0 ;
} }
...@@ -131,7 +132,7 @@ if ($action == "set") ...@@ -131,7 +132,7 @@ if ($action == "set")
$requestnb=0; $requestnb=0;
// To disable some code, so you can call step2 with url like // To disable some code, so you can call step2 with url like
// http://localhost/dolibarrnew/install/etape2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements // http://localhost/dolibarrnew/install/step2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements
$createtables=isset($_GET['createtables'])?GETPOST('createtables'):1; $createtables=isset($_GET['createtables'])?GETPOST('createtables'):1;
$createkeys=isset($_GET['createkeys'])?GETPOST('createkeys'):1; $createkeys=isset($_GET['createkeys'])?GETPOST('createkeys'):1;
$createfunctions=isset($_GET['createfunctions'])?GETPOST('createfunction'):1; $createfunctions=isset($_GET['createfunctions'])?GETPOST('createfunction'):1;
...@@ -155,7 +156,7 @@ if ($action == "set") ...@@ -155,7 +156,7 @@ if ($action == "set")
$ok = 0; $ok = 0;
$handle=opendir($dir); $handle=opendir($dir);
dolibarr_install_syslog("Open tables directory ".$dir." handle=".$handle,LOG_DEBUG); dolibarr_install_syslog("step2: open tables directory " . $dir . " handle=" . $handle);
$tablefound = 0; $tablefound = 0;
$tabledata=array(); $tabledata=array();
if (is_resource($handle)) if (is_resource($handle))
...@@ -211,7 +212,7 @@ if ($action == "set") ...@@ -211,7 +212,7 @@ if ($action == "set")
//print "<tr><td>Creation de la table $name/td>"; //print "<tr><td>Creation de la table $name/td>";
$requestnb++; $requestnb++;
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("step2: request: " . $buffer);
$resql=$db->query($buffer,0,'dml'); $resql=$db->query($buffer,0,'dml');
if ($resql) if ($resql)
{ {
...@@ -241,7 +242,7 @@ if ($action == "set") ...@@ -241,7 +242,7 @@ if ($action == "set")
print "</td>"; print "</td>";
print '<td><font class="error">'.$langs->trans("Error").' Failed to open file '.$dir.$file.'</td></tr>'; print '<td><font class="error">'.$langs->trans("Error").' Failed to open file '.$dir.$file.'</td></tr>';
$error++; $error++;
dolibarr_install_syslog("Failed to open file ".$dir.$file,LOG_ERR); dolibarr_install_syslog("step2: failed to open file " . $dir . $file, LOG_ERR);
} }
} }
...@@ -257,7 +258,7 @@ if ($action == "set") ...@@ -257,7 +258,7 @@ if ($action == "set")
else else
{ {
print '<tr><td>'.$langs->trans("ErrorFailedToFindSomeFiles",$dir).'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>'; print '<tr><td>'.$langs->trans("ErrorFailedToFindSomeFiles",$dir).'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
dolibarr_install_syslog("Failed to find files to create database in directory ".$dir,LOG_ERR); dolibarr_install_syslog("step2: failed to find files to create database in directory " . $dir, LOG_ERR);
} }
} }
...@@ -275,7 +276,7 @@ if ($action == "set") ...@@ -275,7 +276,7 @@ if ($action == "set")
$okkeys = 0; $okkeys = 0;
$handle=opendir($dir); $handle=opendir($dir);
dolibarr_install_syslog("Open keys directory ".$dir." handle=".$handle,LOG_DEBUG); dolibarr_install_syslog("step2: open keys directory " . $dir . " handle=" . $handle);
$tablefound = 0; $tablefound = 0;
$tabledata=array(); $tabledata=array();
if (is_resource($handle)) if (is_resource($handle))
...@@ -354,7 +355,7 @@ if ($action == "set") ...@@ -354,7 +355,7 @@ if ($action == "set")
//print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>"; //print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>";
$requestnb++; $requestnb++;
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("step2: request: " . $buffer);
$resql=$db->query($buffer,0,'dml'); $resql=$db->query($buffer,0,'dml');
if ($resql) if ($resql)
{ {
...@@ -390,7 +391,7 @@ if ($action == "set") ...@@ -390,7 +391,7 @@ if ($action == "set")
print "</td>"; print "</td>";
print '<td><font class="error">'.$langs->trans("Error")." Failed to open file ".$dir.$file."</font></td></tr>"; print '<td><font class="error">'.$langs->trans("Error")." Failed to open file ".$dir.$file."</font></td></tr>";
$error++; $error++;
dolibarr_install_syslog("Failed to open file ".$dir.$file,LOG_ERR); dolibarr_install_syslog("step2: failed to open file " . $dir . $file, LOG_ERR);
} }
} }
...@@ -421,7 +422,7 @@ if ($action == "set") ...@@ -421,7 +422,7 @@ if ($action == "set")
if (file_exists($dir.$file)) if (file_exists($dir.$file))
{ {
$fp = fopen($dir.$file,"r"); $fp = fopen($dir.$file,"r");
dolibarr_install_syslog("Open function file ".$dir.$file." handle=".$fp,LOG_DEBUG); dolibarr_install_syslog("step2: open function file " . $dir . $file . " handle=" . $fp);
if ($fp) if ($fp)
{ {
$buffer=''; $buffer='';
...@@ -444,7 +445,7 @@ if ($action == "set") ...@@ -444,7 +445,7 @@ if ($action == "set")
$buffer=trim($buffer); $buffer=trim($buffer);
if ($buffer) if ($buffer)
{ {
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("step2: request: " . $buffer);
print "<!-- Insert line : ".$buffer."<br>-->\n"; print "<!-- Insert line : ".$buffer."<br>-->\n";
$resql=$db->query($buffer,0,'dml'); $resql=$db->query($buffer,0,'dml');
if ($resql) if ($resql)
...@@ -500,7 +501,7 @@ if ($action == "set") ...@@ -500,7 +501,7 @@ if ($action == "set")
// Insert data // Insert data
$handle=opendir($dir); $handle=opendir($dir);
dolibarr_install_syslog("Open directory data ".$dir." handle=".$handle,LOG_DEBUG); dolibarr_install_syslog("step2: open directory data " . $dir . " handle=" . $handle);
$tablefound = 0; $tablefound = 0;
$tabledata=array(); $tabledata=array();
if (is_resource($handle)) if (is_resource($handle))
...@@ -526,7 +527,7 @@ if ($action == "set") ...@@ -526,7 +527,7 @@ if ($action == "set")
{ {
$name = substr($file, 0, dol_strlen($file) - 4); $name = substr($file, 0, dol_strlen($file) - 4);
$fp = fopen($dir.$file,"r"); $fp = fopen($dir.$file,"r");
dolibarr_install_syslog("Open data file ".$dir.$file." handle=".$fp,LOG_DEBUG); dolibarr_install_syslog("step2: open data file " . $dir . $file . " handle=" . $fp);
if ($fp) if ($fp)
{ {
$arrayofrequests=array(); $arrayofrequests=array();
...@@ -555,7 +556,7 @@ if ($action == "set") ...@@ -555,7 +556,7 @@ if ($action == "set")
} }
fclose($fp); fclose($fp);
dolibarr_install_syslog("Found ".$linefound." records, defined ".count($arrayofrequests)." group(s).",LOG_DEBUG); dolibarr_install_syslog("step2: found " . $linefound . " records, defined " . count($arrayofrequests) . " group(s).");
$okallfile=1; $okallfile=1;
$db->begin(); $db->begin();
...@@ -569,7 +570,7 @@ if ($action == "set") ...@@ -569,7 +570,7 @@ if ($action == "set")
$buffer=preg_replace('/llx_/i',$dolibarr_main_db_prefix,$buffer); $buffer=preg_replace('/llx_/i',$dolibarr_main_db_prefix,$buffer);
} }
//dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); //dolibarr_install_syslog("step2: request: " . $buffer);
$resql=$db->query($buffer,1); $resql=$db->query($buffer,1);
if ($resql) if ($resql)
{ {
...@@ -613,7 +614,7 @@ else ...@@ -613,7 +614,7 @@ else
print 'Parameter action=set not defined'; print 'Parameter action=set not defined';
} }
dolibarr_install_syslog("--- install/etape2.php end", LOG_INFO); dolibarr_install_syslog("--- step2: end");
pFooter(!$ok,$setuplang); pFooter(!$ok,$setuplang);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
*/ */
/** /**
* \file htdocs/install/etape4.php * \file htdocs/install/step4.php
* \ingroup install * \ingroup install
* \brief Ask login and password of Dolibarr admin user * \brief Ask login and password of Dolibarr admin user
*/ */
...@@ -42,7 +43,7 @@ $forcedfile="./install.forced.php"; ...@@ -42,7 +43,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; } if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape4: Entering etape4.php page"); dolibarr_install_syslog("--- step4: entering step4.php page");
$err=0; $err=0;
$ok = 0; $ok = 0;
...@@ -53,7 +54,7 @@ $ok = 0; ...@@ -53,7 +54,7 @@ $ok = 0;
* View * View
*/ */
pHeader($langs->trans("AdminAccountCreation"),"etape5"); pHeader($langs->trans("AdminAccountCreation"),"step5");
// Test if we can run a first install process // Test if we can run a first install process
if (! is_writable($conffile)) if (! is_writable($conffile))
...@@ -106,7 +107,7 @@ if ($db->ok) ...@@ -106,7 +107,7 @@ if ($db->ok)
} }
dolibarr_install_syslog("--- install/etape4.php end", LOG_INFO); dolibarr_install_syslog("--- step4: end");
pFooter($err,$setuplang); pFooter($err,$setuplang);
......
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -20,8 +21,8 @@ ...@@ -20,8 +21,8 @@
*/ */
/** /**
* \file htdocs/install/etape5.php * \file htdocs/install/step5.php
* \ingroup install * \ingroup install
* \brief Last page of upgrade or install process * \brief Last page of upgrade or install process
*/ */
...@@ -68,7 +69,7 @@ $forcedfile="./install.forced.php"; ...@@ -68,7 +69,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; } if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape5: Entering etape5.php page", LOG_INFO); dolibarr_install_syslog("--- step5: entering step5.php page");
/* /*
...@@ -80,19 +81,19 @@ if ($action == "set") ...@@ -80,19 +81,19 @@ if ($action == "set")
{ {
if ($_POST["pass"] <> $_POST["pass_verif"]) if ($_POST["pass"] <> $_POST["pass_verif"])
{ {
header("Location: etape4.php?error=1&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:'')); header("Location: step4.php?error=1&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit; exit;
} }
if (dol_strlen(trim($_POST["pass"])) == 0) if (dol_strlen(trim($_POST["pass"])) == 0)
{ {
header("Location: etape4.php?error=2&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:'')); header("Location: step4.php?error=2&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit; exit;
} }
if (dol_strlen(trim($_POST["login"])) == 0) if (dol_strlen(trim($_POST["login"])) == 0)
{ {
header("Location: etape4.php?error=3&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:'')); header("Location: step4.php?error=3&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit; exit;
} }
} }
...@@ -102,7 +103,7 @@ if ($action == "set") ...@@ -102,7 +103,7 @@ if ($action == "set")
* View * View
*/ */
pHeader($langs->trans("SetupEnd"),"etape5"); pHeader($langs->trans("SetupEnd"),"step5");
print '<br>'; print '<br>';
// Test if we can run a first install process // Test if we can run a first install process
...@@ -153,7 +154,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -153,7 +154,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
// 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 ."/core/modules/".$file, LOG_INFO); dolibarr_install_syslog('step5: load module user ' . DOL_DOCUMENT_ROOT . "/core/modules/" . $file, LOG_INFO);
include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file; include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file;
$objMod = new $modName($db); $objMod = new $modName($db);
$result=$objMod->init(); $result=$objMod->init();
...@@ -188,13 +189,13 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -188,13 +189,13 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
{ {
if ($newuser->error == 'ErrorLoginAlreadyExists') if ($newuser->error == 'ErrorLoginAlreadyExists')
{ {
dolibarr_install_syslog('install/etape5.php AdminLoginAlreadyExists', LOG_WARNING); dolibarr_install_syslog('step5: 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('step5: FailedToCreateAdminLogin ' . $newuser->error, LOG_ERR);
print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>'; print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>';
} }
} }
...@@ -203,7 +204,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -203,7 +204,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
{ {
$db->begin(); $db->begin();
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_INSTALL const to '.$targetversion, LOG_DEBUG); dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'"); $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
if (! $resql) dol_print_error($db,'Error in setup program'); if (! $resql) dol_print_error($db,'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when install',0)"); $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when install',0)");
...@@ -212,7 +213,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -212,7 +213,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
if ($useforcedwizard) if ($useforcedwizard)
{ {
dolibarr_install_syslog('install/etape5.php set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG); dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'"); $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'");
if (! $resql) dol_print_error($db,'Error in setup program'); if (! $resql) dol_print_error($db,'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING',1).",".$db->encrypt(1,1).",'chaine',1,'Disable install warnings',0)"); $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING',1).",".$db->encrypt(1,1).",'chaine',1,'Disable install warnings',0)");
...@@ -232,7 +233,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -232,7 +233,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
print $langs->trans("ActivateModule",$modtoactivatenew).'<br>'; print $langs->trans("ActivateModule",$modtoactivatenew).'<br>';
$file=$modtoactivatenew.'.class.php'; $file=$modtoactivatenew.'.class.php';
dolibarr_install_syslog('install/etape5.php Activate module file='.$file); dolibarr_install_syslog('step5: activate module file=' . $file);
$res=dol_include_once("/core/modules/".$file); $res=dol_include_once("/core/modules/".$file);
$res=activateModule($modtoactivatenew,1); $res=activateModule($modtoactivatenew,1);
...@@ -240,7 +241,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -240,7 +241,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
} }
} }
dolibarr_install_syslog('install/etape5.php Remove MAIN_NOT_INSTALLED const', LOG_DEBUG); dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'"); $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'");
if (! $resql) dol_print_error($db,'Error in setup program'); if (! $resql) dol_print_error($db,'Error in setup program');
...@@ -271,7 +272,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -271,7 +272,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
if ($tagdatabase) if ($tagdatabase)
{ {
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_UPGRADE const to value '.$targetversion, LOG_DEBUG); dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value ' . $targetversion);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'"); $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'");
if (! $resql) dol_print_error($db,'Error in setup program'); if (! $resql) dol_print_error($db,'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version for last upgrade',0)"); $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version for last upgrade',0)");
...@@ -280,7 +281,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -280,7 +281,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
} }
else else
{ {
dolibarr_install_syslog('install/etape5.php We run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.', LOG_DEBUG); dolibarr_install_syslog('step5: we run an upgrade to version ' . $targetversion . ' but database was already upgraded to ' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
} }
} }
else else
...@@ -290,7 +291,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) ...@@ -290,7 +291,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
} }
else else
{ {
dol_print_error('','install/etape5.php Unknown choice of action'); dol_print_error('','step5.php: unknown choice of action');
} }
// May fail if parameter already defined // May fail if parameter already defined
...@@ -404,7 +405,7 @@ elseif (empty($action) || preg_match('/upgrade/i',$action)) ...@@ -404,7 +405,7 @@ elseif (empty($action) || preg_match('/upgrade/i',$action))
} }
else else
{ {
dol_print_error('','install/etape5.php Unknown choice of action'); dol_print_error('','step5.php: unknown choice of action');
} }
...@@ -413,6 +414,6 @@ else ...@@ -413,6 +414,6 @@ else
clearstatcache(); clearstatcache();
dolibarr_install_syslog("--- install/etape5.php Dolibarr setup finished", LOG_INFO); dolibarr_install_syslog("--- step5: Dolibarr setup finished");
pFooter(1,$setuplang); pFooter(1,$setuplang);
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -41,7 +42,7 @@ require_once $conffile; if (! isset($dolibarr_main_db_type)) $dolibarr_main_db_t ...@@ -41,7 +42,7 @@ require_once $conffile; if (! isset($dolibarr_main_db_type)) $dolibarr_main_db_t
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
$grant_query=''; $grant_query='';
$etape = 2; $step = 2;
$ok = 0; $ok = 0;
...@@ -70,8 +71,8 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2; ...@@ -70,8 +71,8 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2;
if ($dolibarr_main_db_type == "mssql") $choix=3; if ($dolibarr_main_db_type == "mssql") $choix=3;
dolibarr_install_syslog("upgrade: Entering upgrade.php page"); dolibarr_install_syslog("--- upgrade: Entering upgrade.php page");
if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initialized",LOG_ERR); if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initialized", LOG_ERR);
/* /*
...@@ -145,13 +146,13 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -145,13 +146,13 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{ {
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n"; print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerConnection")." : $dolibarr_main_db_host ".$langs->transnoentities("OK")); dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ServerConnection") . ": $dolibarr_main_db_host " . $langs->transnoentities("OK"));
$ok = 1; $ok = 1;
} }
else else
{ {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>\n"; print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)); dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0; $ok = 0;
} }
...@@ -161,13 +162,13 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -161,13 +162,13 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{ {
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n"; print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n";
dolibarr_install_syslog("upgrade: Database connection successfull : $dolibarr_main_db_name"); dolibarr_install_syslog("upgrade: Database connection successful: " . $dolibarr_main_db_name);
$ok=1; $ok=1;
} }
else else
{ {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n"; print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)); dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok=0; $ok=0;
} }
} }
...@@ -179,7 +180,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -179,7 +180,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$versionarray=$db->getVersionArray(); $versionarray=$db->getVersionArray();
print '<tr><td>'.$langs->trans("ServerVersion").'</td>'; print '<tr><td>'.$langs->trans("ServerVersion").'</td>';
print '<td align="right">'.$version.'</td></tr>'; print '<td align="right">'.$version.'</td></tr>';
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version"); dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ServerVersion") . ": " .$version);
// Test database version requirement // Test database version requirement
$versionmindb=$db::VERSIONMIN; $versionmindb=$db::VERSIONMIN;
...@@ -189,7 +190,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -189,7 +190,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{ {
// Warning: database version too low. // Warning: database version too low.
print "<tr><td>".$langs->trans("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n"; print "<tr><td>".$langs->trans("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))); dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorDatabaseVersionTooLow", join('.', $versionarray), join('.', $versionmindb)));
$ok=0; $ok=0;
} }
...@@ -216,7 +217,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -216,7 +217,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{ {
// Warning: database version too low. // Warning: database version too low.
print '<tr><td><div class="warning">'.$langs->trans("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion)."</div></td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n"; print '<tr><td><div class="warning">'.$langs->trans("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion)."</div></td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion)); dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorDatabaseVersionForbiddenForMigration", join('.', $versionarray), $listofforbiddenversion));
$ok=0; $ok=0;
break; break;
} }
...@@ -246,7 +247,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -246,7 +247,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$filles=array(); $filles=array();
$sql = "SELECT fk_categorie_mere, fk_categorie_fille"; $sql = "SELECT fk_categorie_mere, fk_categorie_fille";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: search duplicate", LOG_DEBUG); dolibarr_install_syslog("upgrade: search duplicate");
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
...@@ -263,7 +264,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -263,7 +264,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
} }
} }
dolibarr_install_syslog("upgrade: result is num=".$num." count(couples)=".count($couples)); dolibarr_install_syslog("upgrade: result is num=" . $num . " count(couples)=" . count($couples));
// If there is duplicates couples or child with two parents // If there is duplicates couples or child with two parents
if (count($couples) > 0 && $num > count($couples)) if (count($couples) > 0 && $num > count($couples))
...@@ -274,7 +275,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -274,7 +275,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
// We delete all // We delete all
$sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association"; $sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: delete association", LOG_DEBUG); dolibarr_install_syslog("upgrade: delete association");
$resqld=$db->query($sql); $resqld=$db->query($sql);
if ($resqld) if ($resqld)
{ {
...@@ -283,7 +284,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) ...@@ -283,7 +284,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{ {
$sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)"; $sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)";
$sql.=" VALUES(".$val['mere'].", ".$val['fille'].")"; $sql.=" VALUES(".$val['mere'].", ".$val['fille'].")";
dolibarr_install_syslog("upgrade: insert association", LOG_DEBUG); dolibarr_install_syslog("upgrade: insert association");
$resqli=$db->query($sql); $resqli=$db->query($sql);
if (! $resqli) $error++; if (! $resqli) $error++;
} }
...@@ -481,6 +482,7 @@ $ret=0; ...@@ -481,6 +482,7 @@ $ret=0;
if (! $ok && isset($argv[1])) $ret=1; if (! $ok && isset($argv[1])) $ret=1;
dol_syslog("Exit ".$ret); dol_syslog("Exit ".$ret);
dolibarr_install_syslog("--- upgrade: end");
pFooter(((! $ok && empty($_GET["ignoreerrors"])) || $dirmodule),$setuplang); pFooter(((! $ok && empty($_GET["ignoreerrors"])) || $dirmodule),$setuplang);
if ($db->connected) $db->close(); if ($db->connected) $db->close();
......
This diff is collapsed.
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