From 6da82e03be68bf8335477d70e075866554f2dbb5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Apr 2012 23:18:36 +0200 Subject: [PATCH] Uniformize code --- htdocs/install/check.php | 8 ++++---- htdocs/install/etape1.php | 7 ++++--- htdocs/install/etape2.php | 7 ++++--- htdocs/install/etape4.php | 14 +++++++------- htdocs/install/etape5.php | 6 ++++-- htdocs/install/fileconf.php | 6 +++--- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index c48f4c7f599..dae2a0e4a8a 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -35,11 +35,11 @@ $langs->setDefaultLang($setuplang); $langs->load("install"); -// Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard. -if (! isset($force_install_dolibarrlogin)) $force_install_dolibarrlogin=''; +// Now we load forced value from install.forced.php file. $useforcedwizard=false; -if (@file_exists("./install.forced.php")) { $useforcedwizard=true; include_once("./install.forced.php"); } -else if (@file_exists("/etc/dolibarr/install.forced.php")) { $useforcedwizard=include_once("/etc/dolibarr/install.forced.php"); } +$forcedfile="./install.forced.php"; +if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; +if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once($forcedfile); } dolibarr_install_syslog("Dolibarr install/upgrade process started"); diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index b57b0e8a1c3..9859b7ed02e 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -43,10 +43,11 @@ $passroot=isset($_POST["db_pass_root"])?$_POST["db_pass_root"]:""; // Repertoire des pages dolibarr $main_dir=isset($_POST["main_dir"])?trim($_POST["main_dir"]):''; -// Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard. +// Now we load forced value from install.forced.php file. $useforcedwizard=false; -if (file_exists("./install.forced.php")) { $useforcedwizard=true; include_once("./install.forced.php"); } -else if (file_exists("/etc/dolibarr/install.forced.php")) { $useforcedwizard=include_once("/etc/dolibarr/install.forced.php"); } +$forcedfile="./install.forced.php"; +if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; +if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once($forcedfile); } dolibarr_install_syslog("--- etape1: Entering etape1.php page"); diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 59ea5ec8bba..b8373847c25 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -52,10 +52,11 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2; if ($dolibarr_main_db_type == "mssql") $choix=3; //if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into etape2.php page'); -// Init "forced values" to nothing. "forced values" are used after a Doliwamp install wizard. +// Now we load forced value from install.forced.php file. $useforcedwizard=false; -if (file_exists("./install.forced.php")) { $useforcedwizard=true; include_once("./install.forced.php"); } -else if (file_exists("/etc/dolibarr/install.forced.php")) { $useforcedwizard=include_once("/etc/dolibarr/install.forced.php"); } +$forcedfile="./install.forced.php"; +if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; +if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once($forcedfile); } dolibarr_install_syslog("--- etape2: Entering etape2.php page"); diff --git a/htdocs/install/etape4.php b/htdocs/install/etape4.php index d9f27fe4e32..eb392ae2e86 100644 --- a/htdocs/install/etape4.php +++ b/htdocs/install/etape4.php @@ -36,11 +36,11 @@ $langs->setDefaultLang($setuplang); $langs->load("admin"); $langs->load("install"); -// Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard. -if (! isset($force_install_dolibarrlogin)) $force_install_dolibarrlogin=''; +// Now we load forced value from install.forced.php file. $useforcedwizard=false; -if (file_exists("./install.forced.php")) { $useforcedwizard=true; include_once("./install.forced.php"); } -else if (file_exists("/etc/dolibarr/install.forced.php")) { $useforcedwizard=include_once("/etc/dolibarr/install.forced.php"); } +$forcedfile="./install.forced.php"; +if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; +if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once($forcedfile); } dolibarr_install_syslog("--- etape4: Entering etape4.php page"); @@ -74,7 +74,7 @@ $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db- if ($db->ok == 1) { print ''.$langs->trans("DolibarrAdminLogin").' :'; - print ''; + print ''; print ''.$langs->trans("Password").' :'; print ''; print ''.$langs->trans("PasswordAgain").' :'; @@ -106,9 +106,9 @@ if ($db->ok == 1) } -$db->close(); - dolibarr_install_syslog("--- install/etape4.php end", LOG_INFO); pFooter($err,$setuplang); + +$db->close(); ?> diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 49d8259b0de..f63eafe1ef3 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -61,9 +61,11 @@ if (! isset($force_install_databasepass)) $force_install_databasepass=''; if (! isset($force_install_databaserootlogin)) $force_install_databaserootlogin=''; if (! isset($force_install_databaserootpass)) $force_install_databaserootpass=''; if (! isset($force_install_lockinstall)) $force_install_lockinstall=''; +// Now we load forced value from install.forced.php file. $useforcedwizard=false; -if (file_exists("./install.forced.php")) { $useforcedwizard=true; include_once("./install.forced.php"); } -else if (file_exists("/etc/dolibarr/install.forced.php")) { $useforcedwizard=include_once("/etc/dolibarr/install.forced.php"); } +$forcedfile="./install.forced.php"; +if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; +if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once($forcedfile); } dolibarr_install_syslog("--- etape5: Entering etape5.php page", LOG_INFO); diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 8fe90ac479f..44dc2011de1 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -53,14 +53,14 @@ if (! isset($force_install_databaserootlogin)) $force_install_databaserootlogin= if (! isset($force_install_databaserootpass)) $force_install_databaserootpass=''; // Now we load forced value from install.forced.php file. $useforcedwizard=false; -if (file_exists("./install.forced.php")) { $useforcedwizard=true; include_once("./install.forced.php"); } -else if (file_exists("/etc/dolibarr/install.forced.php")) { $useforcedwizard=include_once("/etc/dolibarr/install.forced.php"); } +$forcedfile="./install.forced.php"; +if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; +if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once($forcedfile); } dolibarr_install_syslog("Fileconf: Entering fileconf.php page"); - /* * View */