diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 1b619e45229..6b490acd6cd 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2005 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Océbo * @@ -19,11 +19,11 @@ */ /** - \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 $Id$ -*/ + \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 $Id$ + */ include_once("./inc.php"); $err = 0; @@ -44,8 +44,8 @@ dolibarr_install_syslog("check: Dolibarr install/upgrade process started"); /* -* View -*/ + * View + */ pHeader($langs->trans("DolibarrWelcome"),""); // Etape suivante = license @@ -61,12 +61,12 @@ print ''.$langs->trans("MiscellanousChecks").":
\n"; // Check PHP version if (versioncompare(versionphparray(),array(4,1)) < 0) { - print 'Error '.$langs->trans("ErrorPHPVersionTooLow",'4.1'); - $checksok=0; + print 'Error '.$langs->trans("ErrorPHPVersionTooLow",'4.1'); + $checksok=0; } else { - print 'Ok '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray()); + print 'Ok '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray()); } if (empty($force_install_nophpinfo)) print ' ('.$langs->trans("MoreInformation").')'; print "
\n"; @@ -78,35 +78,35 @@ if (! isset($_GET["testget"]) && ! isset($_POST["testpost"])) print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); print ' ('.$langs->trans("Recheck").')'; print "
\n"; - $checksok=0; + $checksok=0; } else { - print 'Ok '.$langs->trans("PHPSupportPOSTGETOk")."
\n"; + print 'Ok '.$langs->trans("PHPSupportPOSTGETOk")."
\n"; } // Check if sessions enabled if (! function_exists("session_id")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions")."
\n"; - $checksok=0; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions")."
\n"; + $checksok=0; } else { - print 'Ok '.$langs->trans("PHPSupportSessions")."
\n"; -/* - // On se fout des warning sur session_start, meme si pas moyen de mettre cookie dans http, car on ne test pas entre 2 pages mais au sein de la meme - print 'Ok Test sauvegarde donnée en session.'."
\n";; - @session_start(); - $_SESSION['test']=1; - session_write_close(); + print 'Ok '.$langs->trans("PHPSupportSessions")."
\n"; + /* + // On se fout des warning sur session_start, meme si pas moyen de mettre cookie dans http, car on ne test pas entre 2 pages mais au sein de la meme + print 'Ok Test sauvegarde donnée en session.'."
\n";; + @session_start(); + $_SESSION['test']=1; + session_write_close(); - @session_start(); - if (! $_SESSION['test']) print 'Error Echec récupération donnée en session. Votre PHP ne fonctionne pas correctement. Votre répertoire de sauvegarde des sessions est peut-être plein.'."
\n"; - else print 'Ok Succès récupération donnée en session.'."
\n"; - session_write_close(); -*/ + @session_start(); + if (! $_SESSION['test']) print 'Error Echec récupération donnée en session. Votre PHP ne fonctionne pas correctement. Votre répertoire de sauvegarde des sessions est peut-être plein.'."
\n"; + else print 'Ok Succès récupération donnée en session.'."
\n"; + session_write_close(); + */ } @@ -114,12 +114,12 @@ else if (! function_exists("imagecreate")) { $langs->load("errors"); - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD")."
\n"; - // $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install) + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD")."
\n"; + // $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install) } else { - print 'Ok '.$langs->trans("PHPSupportGD")."
\n"; + print 'Ok '.$langs->trans("PHPSupportGD")."
\n"; } @@ -138,11 +138,11 @@ if ($memmaxorig != '') } if ($memmax >= $memrequired) { - print 'Ok '.$langs->trans("PHPMemoryOK",$memmaxorig,$memrequiredorig)."
\n"; + print 'Ok '.$langs->trans("PHPMemoryOK",$memmaxorig,$memrequiredorig)."
\n"; } else - { - print 'Warning '.$langs->trans("PHPMemoryTooLow",$memmaxorig,$memrequiredorig)."
\n"; + { + print 'Warning '.$langs->trans("PHPMemoryTooLow",$memmaxorig,$memrequiredorig)."
\n"; } } @@ -152,18 +152,18 @@ clearstatcache(); if (is_readable($conffile) && filesize($conffile) > 8) { dolibarr_install_syslog("check: conf file '$conffile' already exists"); - $confexists=1; - include_once($conffile); - - // Deja installé, on peut upgrader - // \todo Test if database ok - $allowupgrade=1; + $confexists=1; + include_once($conffile); + + // Deja installé, on peut upgrader + // \todo Test if database ok + $allowupgrade=1; } else { - // Si non on le crée + // Si non on le crée dolibarr_install_syslog("check: we try to creat conf file '$conffile'"); - $confexists=0; + $confexists=0; # First we try by copying example if (@copy($conffile.".example", $conffile)) @@ -184,10 +184,10 @@ else @fputs($fp,"?>"); fclose($fp); } - } + } - // First install, on ne peut pas upgrader - $allowupgrade=0; + // First install, on ne peut pas upgrader + $allowupgrade=0; } @@ -195,128 +195,100 @@ else // Si fichier absent et n'a pu etre créé if (! file_exists($conffile)) { - //print 'Error '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated",$conffile); - print 'Error '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated",'conf.php'); - print "

"; - print $langs->trans("YouMustCreateWithPermission",'htdocs/conf/conf.php'); - print "

"; - - print $langs->trans("CorrectProblemAndReloadPage",$_SERVER['PHP_SELF'].'?testget=ok'); - $err++; + //print 'Error '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated",$conffile); + print 'Error '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated",'conf.php'); + print "

"; + print $langs->trans("YouMustCreateWithPermission",'htdocs/conf/conf.php'); + print "

"; + + print $langs->trans("CorrectProblemAndReloadPage",$_SERVER['PHP_SELF'].'?testget=ok'); + $err++; } else { - // Si fichier présent mais ne peut etre modifié - if (!is_writable($conffile)) - { - if ($confexists) - { - print 'Ok '.$langs->trans("ConfFileExists",'conf.php'); - } - else - { - print 'Ok '.$langs->trans("ConfFileCouldBeCreated",'conf.php'); - } - print "
"; - print 'Warning '.$langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php'); - print "
\n"; - - $allowinstall=0; - } - // Si fichier présent et peut etre modifié - else - { - if ($confexists) - { - print 'Ok '.$langs->trans("ConfFileExists",'conf.php'); - } - else - { - print 'Ok '.$langs->trans("ConfFileCouldBeCreated",'conf.php'); - } - print "
"; - print 'Ok '.$langs->trans("ConfFileIsWritable",'conf.php'); - print "
\n"; - - $allowinstall=1; - } - print "
\n"; - print "
\n"; + // Si fichier présent mais ne peut etre modifié + if (!is_writable($conffile)) + { + if ($confexists) + { + print 'Ok '.$langs->trans("ConfFileExists",'conf.php'); + } + else + { + print 'Ok '.$langs->trans("ConfFileCouldBeCreated",'conf.php'); + } + print "
"; + print 'Warning '.$langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php'); + print "
\n"; - // Si prerequis ok, on affiche le bouton pour passer à l'étape suivante + $allowinstall=0; + } + // Si fichier présent et peut etre modifié + else + { + if ($confexists) + { + print 'Ok '.$langs->trans("ConfFileExists",'conf.php'); + } + else + { + print 'Ok '.$langs->trans("ConfFileCouldBeCreated",'conf.php'); + } + print "
"; + print 'Ok '.$langs->trans("ConfFileIsWritable",'conf.php'); + print "
\n"; + + $allowinstall=1; + } + print "
\n"; + print "
\n"; + + // Si prerequis ok, on affiche le bouton pour passer à l'étape suivante if ($checksok) { - print $langs->trans("ChooseYourSetupMode"); - - print ''; - - print ''; - print ''; - print ''."\n"; + print $langs->trans("ChooseYourSetupMode"); - # Upgrade - $versionfrom='2.0.0'; - $versionto='2.1.0'; - print ''; - print ''; - print ''."\n"; - - # Upgrade - $versionfrom='2.1.0'; - $versionto='2.2.0'; - print ''; - print ''; - print ''."\n"; - - # Upgrade - $versionfrom='2.2.0'; - $versionto='2.4.0'; - print ''; - print ''; - print ''."\n"; - - print '
'.$langs->trans("FreshInstall").''; - print $langs->trans("FreshInstallDesc").''; - if ($allowinstall) - { - print ''.$langs->trans("Start").''; - } - else - { - print $langs->trans("InstallNotAllowed"); - } - print '
'.$langs->trans("Upgrade").' '.$versionfrom.' -> '.$versionto.''; - print $langs->trans("UpgradeDesc").''; - if ($allowupgrade) - { - print ''.$langs->trans("Start").''; - } - else - { - print $langs->trans("NotAvailable"); - } - print '
'.$langs->trans("Upgrade").' '.$versionfrom.' -> '.$versionto.''; - print $langs->trans("UpgradeDesc").''; - if ($allowupgrade) - { - print ''.$langs->trans("Start").''; - } - else - { - print $langs->trans("NotAvailable"); - } - print '
'.$langs->trans("Upgrade").' '.$versionfrom.' -> '.$versionto.''; - print $langs->trans("UpgradeDesc").''; - if ($allowupgrade) - { - print ''.$langs->trans("Start").''; - } - else - { - print $langs->trans("NotAvailable"); - } - print '
'; - print "\n"; + print ''; + + print ''; + print ''; + print ''."\n"; + + $migrationscript=array(array('from'=>'2.0.0', 'to'=>'2.1.0'), + array('from'=>'2.1.0', 'to'=>'2.2.0'), + array('from'=>'2.2.0', 'to'=>'2.4.0'), + array('from'=>'2.4.0', 'to'=>'2.5.0')); + # Upgrade lines + foreach ($migrationscript as $migarray) + { + $versionfrom=$migarray['from']; + $versionto=$migarray['to']; + print ''; + print ''; + print ''."\n"; + } + print '
'.$langs->trans("FreshInstall").''; + print $langs->trans("FreshInstallDesc").''; + if ($allowinstall) + { + print ''.$langs->trans("Start").''; + } + else + { + print $langs->trans("InstallNotAllowed"); + } + print '
'.$langs->trans("Upgrade").' '.$versionfrom.' -> '.$versionto.''; + print $langs->trans("UpgradeDesc").''; + if ($allowupgrade) + { + print ''.$langs->trans("Start").''; + } + else + { + print $langs->trans("NotAvailable"); + } + print '
'; + print "\n"; } }