dolibarr  13.0.2
check.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
5  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
8  * Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
29 include_once 'inc.php';
30 
31 global $langs;
32 
33 $err = 0;
34 $allowinstall = 0;
35 $allowupgrade = false;
36 $checksok = 1;
37 
38 $setuplang = GETPOST("selectlang", 'aZ09', 3) ?GETPOST("selectlang", 'aZ09', 3) : $langs->getDefaultLang();
39 $langs->setDefaultLang($setuplang);
40 
41 $langs->load("install");
42 
43 // Now we load forced/pre-set values from install.forced.php file.
44 $useforcedwizard = false;
45 $forcedfile = "./install.forced.php";
46 if ($conffile == "/etc/dolibarr/conf.php") $forcedfile = "/etc/dolibarr/install.forced.php";
47 if (@file_exists($forcedfile)) {
48  $useforcedwizard = true;
49  include_once $forcedfile;
50 }
51 
52 dolibarr_install_syslog("- check: Dolibarr install/upgrade process started");
53 
54 
55 /*
56  * View
57  */
58 
59 pHeader('', ''); // No next step for navigation buttons. Next step is defined by click on links.
60 
61 
62 //print "<br>\n";
63 //print $langs->trans("InstallEasy")."<br><br>\n";
64 
65 print '<h3><img class="valigntextbottom" src="../theme/common/octicons/build/svg/gear.svg" width="20" alt="Database"> '.$langs->trans("MiscellaneousChecks").":</h3>\n";
66 
67 // Check browser
68 $useragent = $_SERVER['HTTP_USER_AGENT'];
69 if (!empty($useragent))
70 {
71  $tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
72  $browserversion = $tmp['browserversion'];
73  $browsername = $tmp['browsername'];
74  if ($browsername == 'ie' && $browserversion < 7) print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("WarningBrowserTooOld")."<br>\n";
75 }
76 
77 
78 // Check PHP version
79 $arrayphpminversionerror = array(5, 5, 0);
80 $arrayphpminversionwarning = array(5, 6, 0);
81 if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower)
82 {
83  print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
84  $checksok = 0; // 0=error, 1=warning
85 } elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) // Minimum supported (warning if lower)
86 {
87  print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
88  $checksok = 0; // 0=error, 1=warning
89 } else {
90  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray());
91 }
92 if (empty($force_install_nophpinfo)) print ' (<a href="phpinfo.php" target="_blank">'.$langs->trans("MoreInformation").'</a>)';
93 print "<br>\n";
94 
95 
96 // Check PHP support for $_GET and $_POST
97 if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) // We must keep $_GET and $_POST here
98 {
99  print '<img src="../theme/eldy/img/warning.png" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo");
100  print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)';
101  print "<br>\n";
102  $checksok = 0;
103 } else {
104  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportPOSTGETOk")."<br>\n";
105 }
106 
107 
108 // Check if session_id is enabled
109 if (!function_exists("session_id"))
110 {
111  print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions")."<br>\n";
112  $checksok = 0;
113 } else {
114  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportSessions")."<br>\n";
115 }
116 
117 
118 // Check if GD is supported (we need GD for image conversion)
119 if (!function_exists("imagecreate"))
120 {
121  $langs->load("errors");
122  print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportGD")."<br>\n";
123  // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
124 } else {
125  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "GD")."<br>\n";
126 }
127 
128 
129 // Check if Curl is supported
130 if (!function_exists("curl_init"))
131 {
132  $langs->load("errors");
133  print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCurl")."<br>\n";
134  // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
135 } else {
136  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "Curl")."<br>\n";
137 }
138 
139 // Check if PHP calendar extension is available
140 if (!function_exists("easter_date"))
141 {
142  print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."<br>\n";
143 } else {
144  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "Calendar")."<br>\n";
145 }
146 
147 
148 // Check if UTF8 is supported
149 if (!function_exists("utf8_encode"))
150 {
151  $langs->load("errors");
152  print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."<br>\n";
153  // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
154 } else {
155  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "UTF8")."<br>\n";
156 }
157 
158 
159 // Check if intl methods are supported
160 if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
161 {
162  if (!function_exists("locale_get_primary_language") || !function_exists("locale_get_region"))
163  {
164  $langs->load("errors");
165  print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportIntl")."<br>\n";
166  // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
167  } else {
168  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "Intl")."<br>\n";
169  }
170 }
171 
172 if (!class_exists('ZipArchive'))
173 {
174  $langs->load("errors");
175  print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupport", "ZIP")."<br>\n";
176  // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
177 } else {
178  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "ZIP")."<br>\n";
179 }
180 
181 // Check memory
182 $memrequiredorig = '64M';
183 $memrequired = 64 * 1024 * 1024;
184 $memmaxorig = @ini_get("memory_limit");
185 $memmax = @ini_get("memory_limit");
186 if ($memmaxorig != '')
187 {
188  preg_match('/([0-9]+)([a-zA-Z]*)/i', $memmax, $reg);
189  if ($reg[2])
190  {
191  if (strtoupper($reg[2]) == 'G') $memmax = $reg[1] * 1024 * 1024 * 1024;
192  if (strtoupper($reg[2]) == 'M') $memmax = $reg[1] * 1024 * 1024;
193  if (strtoupper($reg[2]) == 'K') $memmax = $reg[1] * 1024;
194  }
195  if ($memmax >= $memrequired || $memmax == -1)
196  {
197  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPMemoryOK", $memmaxorig, $memrequiredorig)."<br>\n";
198  } else {
199  print '<img src="../theme/eldy/img/warning.png" alt="Warning"> '.$langs->trans("PHPMemoryTooLow", $memmaxorig, $memrequiredorig)."<br>\n";
200  }
201 }
202 
203 
204 // If that config file is present and filled
205 clearstatcache();
206 if (is_readable($conffile) && filesize($conffile) > 8)
207 {
208  dolibarr_install_syslog("check: conf file '".$conffile."' already defined");
209  $confexists = 1;
210  include_once $conffile;
211 
212  $databaseok = 1;
213  if ($databaseok)
214  {
215  // Already installed for all parts (config and database). We can propose upgrade.
216  $allowupgrade = true;
217  } else {
218  $allowupgrade = false;
219  }
220 } else {
221  // If not, we create it
222  dolibarr_install_syslog("check: we try to create conf file '".$conffile."'");
223  $confexists = 0;
224 
225  // First we try by copying example
226  if (@copy($conffile.".example", $conffile))
227  {
228  // Success
229  dolibarr_install_syslog("check: successfully copied file ".$conffile.".example into ".$conffile);
230  } else {
231  // If failed, we try to create an empty file
232  dolibarr_install_syslog("check: failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING);
233 
234  $fp = @fopen($conffile, "w");
235  if ($fp)
236  {
237  @fwrite($fp, '<?php');
238  @fputs($fp, "\n");
239  fclose($fp);
240  } else dolibarr_install_syslog("check: failed to create a new file ".$conffile." into current dir ".getcwd().". Please check permissions.", LOG_ERR);
241  }
242 
243  // First install: no upgrade necessary/required
244  $allowupgrade = false;
245 }
246 
247 
248 
249 // File is missing and cannot be created
250 if (!file_exists($conffile))
251 {
252  print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated", $conffiletoshow);
253  print "<br><br>";
254  print $langs->trans("YouMustCreateWithPermission", $conffiletoshow);
255  print "<br><br>";
256 
257  print $langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok');
258  $err++;
259 } else {
260  if (dol_is_dir($conffile))
261  {
262  print '<img src="../theme/eldy/img/error.png" alt="Warning"> '.$langs->trans("ConfFileMustBeAFileNotADir", $conffiletoshow);
263 
264  $allowinstall = 0;
265  }
266  // File exists but cannot be modified
267  elseif (!is_writable($conffile))
268  {
269  if ($confexists)
270  {
271  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileExists", $conffiletoshow);
272  } else {
273  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileCouldBeCreated", $conffiletoshow);
274  }
275  print "<br>";
276  print '<img src="../theme/eldy/img/tick.png" alt="Warning"> '.$langs->trans("ConfFileIsNotWritable", $conffiletoshow);
277  print "<br>\n";
278 
279  $allowinstall = 0;
280  }
281  // File exists and can be modified
282  else {
283  if ($confexists)
284  {
285  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileExists", $conffiletoshow);
286  } else {
287  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileCouldBeCreated", $conffiletoshow);
288  }
289  print "<br>";
290  print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileIsWritable", $conffiletoshow);
291  print "<br>\n";
292 
293  $allowinstall = 1;
294  }
295  print "<br>\n";
296 
297  // Requirements met/all ok: display the next step button
298  if ($checksok)
299  {
300  $ok = 0;
301 
302  // Try to create db connection
303  if (file_exists($conffile))
304  {
305  include_once $conffile;
306  if (!empty($dolibarr_main_db_type) && !empty($dolibarr_main_document_root))
307  {
308  if (!file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php"))
309  {
310  print '<span 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.</span><br>'."\n";
311  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);
312  } else {
313  require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
314 
315  // If password is encoded, we decode it
316  if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass))
317  {
318  require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
319  if (preg_match('/crypted:/i', $dolibarr_main_db_pass))
320  {
321  $dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted
322  $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
323  } else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
324  }
325 
326  // $conf already created in inc.php
327  $conf->db->type = $dolibarr_main_db_type;
328  $conf->db->host = $dolibarr_main_db_host;
329  $conf->db->port = $dolibarr_main_db_port;
330  $conf->db->name = $dolibarr_main_db_name;
331  $conf->db->user = $dolibarr_main_db_user;
332  $conf->db->pass = $dolibarr_main_db_pass;
333  $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
334  if ($db->connected && $db->database_selected)
335  {
336  $ok = true;
337  }
338  }
339  }
340  }
341 
342  // If database access is available, we set more variables
343  if ($ok)
344  {
345  if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0;
346  $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
347  if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = '';
348  $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
349 
350  $conf->setValues($db);
351  // Reset forced setup after the setValues
352  if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
353  $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
354 
355  // Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE
356  // Version to install is DOL_VERSION
357  $dolibarrlastupgradeversionarray = preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_UPGRADE : (isset($conf->global->MAIN_VERSION_LAST_INSTALL) ? $conf->global->MAIN_VERSION_LAST_INSTALL : ''));
358  $dolibarrversiontoinstallarray = versiondolibarrarray();
359  }
360 
361  // Show title
362  if (!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || !empty($conf->global->MAIN_VERSION_LAST_INSTALL))
363  {
364  print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.(empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE).'</span></b> - ';
365  print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
366  //print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired"));
367  print '<br>';
368  print '<br>';
369  } else print "<br>\n";
370 
371  //print $langs->trans("InstallEasy")." ";
372  print '<h3><span class="soustitre">'.$langs->trans("ChooseYourSetupMode").'</span></h3>';
373 
374  $foundrecommandedchoice = 0;
375 
376  $available_choices = array();
377  $notavailable_choices = array();
378 
379  if (empty($dolibarr_main_db_host)) // This means install process was not run
380  {
381  $foundrecommandedchoice = 1; // To show only once
382  }
383 
384  // Show line of first install choice
385  $choice = '<tr class="trlineforchoice'.($foundrecommandedchoice ? ' choiceselected' : '').'">'."\n";
386  $choice .= '<td class="nowrap center"><b>'.$langs->trans("FreshInstall").'</b>';
387  $choice .= '</td>';
388  $choice .= '<td class="listofchoicesdesc">';
389  $choice .= $langs->trans("FreshInstallDesc");
390  if (empty($dolibarr_main_db_host)) // This means install process was not run
391  {
392  $choice .= '<br>';
393  //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
394  $choice .= '<div class="center"><div class="ok suggestedchoice">'.$langs->trans("InstallChoiceSuggested").'</div></div>';
395  // <img src="../theme/eldy/img/tick.png" alt="Ok"> ';
396  }
397 
398  $choice .= '</td>';
399  $choice .= '<td class="center">';
400  if ($allowinstall)
401  {
402  $choice .= '<a class="button" href="fileconf.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
403  } else {
404  $choice .= ($foundrecommandedchoice ? '<span class="warning">' : '').$langs->trans("InstallNotAllowed").($foundrecommandedchoice ? '</span>' : '');
405  }
406  $choice .= '</td>'."\n";
407  $choice .= '</tr>'."\n";
408 
409  $positionkey = ($foundrecommandedchoice ? 999 : 0);
410  if ($allowinstall) {
411  $available_choices[$positionkey] = $choice;
412  } else {
413  $notavailable_choices[$positionkey] = $choice;
414  }
415 
416  // Show upgrade lines
417  $allowupgrade = true;
418  if (empty($dolibarr_main_db_host)) // This means install process was not run
419  {
420  $allowupgrade = false;
421  }
422  if (defined("MAIN_NOT_INSTALLED")) $allowupgrade = false;
423  if (GETPOST('allowupgrade')) $allowupgrade = true;
424  $migrationscript = array(array('from'=>'3.0.0', 'to'=>'3.1.0'),
425  array('from'=>'3.1.0', 'to'=>'3.2.0'),
426  array('from'=>'3.2.0', 'to'=>'3.3.0'),
427  array('from'=>'3.3.0', 'to'=>'3.4.0'),
428  array('from'=>'3.4.0', 'to'=>'3.5.0'),
429  array('from'=>'3.5.0', 'to'=>'3.6.0'),
430  array('from'=>'3.6.0', 'to'=>'3.7.0'),
431  array('from'=>'3.7.0', 'to'=>'3.8.0'),
432  array('from'=>'3.8.0', 'to'=>'3.9.0'),
433  array('from'=>'3.9.0', 'to'=>'4.0.0'),
434  array('from'=>'4.0.0', 'to'=>'5.0.0'),
435  array('from'=>'5.0.0', 'to'=>'6.0.0'),
436  array('from'=>'6.0.0', 'to'=>'7.0.0'),
437  array('from'=>'7.0.0', 'to'=>'8.0.0'),
438  array('from'=>'8.0.0', 'to'=>'9.0.0'),
439  array('from'=>'9.0.0', 'to'=>'10.0.0'),
440  array('from'=>'10.0.0', 'to'=>'11.0.0'),
441  array('from'=>'11.0.0', 'to'=>'12.0.0'),
442  array('from'=>'12.0.0', 'to'=>'13.0.0')
443  );
444 
445  $count = 0;
446  foreach ($migrationscript as $migarray)
447  {
448  $choice = '';
449 
450  $count++;
451  $recommended_choice = false;
452  $version = DOL_VERSION;
453  $versionfrom = $migarray['from'];
454  $versionto = $migarray['to'];
455  $versionarray = preg_split('/[\.-]/', $version);
456  $dolibarrversionfromarray = preg_split('/[\.-]/', $versionfrom);
457  $dolibarrversiontoarray = preg_split('/[\.-]/', $versionto);
458  // Define string newversionxxx that are used for text to show
459  $newversionfrom = preg_replace('/(\.[0-9]+)$/i', '.*', $versionfrom);
460  $newversionto = preg_replace('/(\.[0-9]+)$/i', '.*', $versionto);
461  $newversionfrombis = '';
462  if (versioncompare($dolibarrversiontoarray, $versionarray) < -2) // From x.y.z -> x.y.z+1
463  {
464  $newversionfrombis = ' '.$langs->trans("or").' '.$versionto;
465  }
466 
467  if ($ok)
468  {
469  if (count($dolibarrlastupgradeversionarray) >= 2) // If database access is available and last upgrade version is known
470  {
471  // Now we check if this is the first qualified choice
472  if ($allowupgrade && empty($foundrecommandedchoice) &&
473  (versioncompare($dolibarrversiontoarray, $dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray, $versionarray) < -2)
474  )
475  {
476  $foundrecommandedchoice = 1; // To show only once
477  $recommended_choice = true;
478  }
479  } else {
480  // We cannot recommend a choice.
481  // A version of install may be known, but we need last upgrade.
482  }
483  }
484 
485  $choice .= "\n".'<!-- choice '.$count.' -->'."\n";
486  $choice .= '<tr'.($recommended_choice ? ' class="choiceselected"' : '').'>';
487  $choice .= '<td class="nowrap center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
488  $choice .= '<td class="listofchoicesdesc">';
489  $choice .= $langs->trans("UpgradeDesc");
490 
491  if ($recommended_choice)
492  {
493  $choice .= '<br>';
494  //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
495  $choice .= '<div class="center">';
496  $choice .= '<div class="ok suggestedchoice">'.$langs->trans("InstallChoiceSuggested").'</div>';
497  if ($count < count($migarray)) // There are other choices after
498  {
499  print $langs->trans("MigrateIsDoneStepByStep", DOL_VERSION);
500  }
501  $choice .= '</div>';
502  }
503 
504  $choice .= '</td>';
505  $choice .= '<td class="center">';
506  if ($allowupgrade)
507  {
508  $disabled = false;
509  if ($foundrecommandedchoice == 2)
510  {
511  $disabled = true;
512  }
513  if ($foundrecommandedchoice == 1)
514  {
515  $foundrecommandedchoice = 2;
516  }
517  if ($disabled)
518  {
519  $choice .= '<span class="opacitymedium">'.$langs->trans("NotYetAvailable").'</span>';
520  } else {
521  $choice .= '<a class="button runupgrade" href="upgrade.php?action=upgrade'.($count < count($migrationscript) ? '_'.$versionto : '').'&amp;selectlang='.$setuplang.'&amp;versionfrom='.$versionfrom.'&amp;versionto='.$versionto.'">'.$langs->trans("Start").'</a>';
522  }
523  } else {
524  $choice .= $langs->trans("NotAvailable");
525  }
526  $choice .= '</td>';
527  $choice .= '</tr>'."\n";
528 
529  if ($allowupgrade) {
530  $available_choices[$count] = $choice;
531  } else {
532  $notavailable_choices[$count] = $choice;
533  }
534  }
535 
536  // If there is no choice at all, we show all of them.
537  if (empty($available_choices))
538  {
539  $available_choices = $notavailable_choices;
540  $notavailable_choices = array();
541  }
542 
543  // Array of install choices
544  krsort($available_choices, SORT_NATURAL);
545  print"\n";
546  print '<table width="100%" class="listofchoices">';
547  foreach ($available_choices as $choice) {
548  print $choice;
549  }
550 
551  print '</table>'."\n";
552 
553  if (count($notavailable_choices)) {
554  print '<br><div id="AShowChoices" style="opacity: 0.5">';
555  print '> '.$langs->trans('ShowNotAvailableOptions').'...';
556  print '</div>';
557 
558  print '<div id="navail_choices" style="display:none">';
559  print "<br>\n";
560  print '<table width="100%" class="listofchoices">';
561  foreach ($notavailable_choices as $choice) {
562  print $choice;
563  }
564 
565  print '</table>'."\n";
566  print '</div>';
567  }
568  }
569 }
570 
571 print '<script type="text/javascript">
572 
573 $("div#AShowChoices").click(function() {
574 
575  $("div#navail_choices").toggle();
576 
577  if ($("div#navail_choices").css("display") == "none") {
578  $(this).text("> '.$langs->trans('ShowNotAvailableOptions').'...");
579  } else {
580  $(this).text("'.$langs->trans('HideNotAvailableOptions').'...");
581  }
582 
583 });
584 
585 /*
586 $(".runupgrade").click(function() {
587  return confirm("'.dol_escape_js($langs->transnoentitiesnoconv("WarningUpgrade"), 0, 1).'");
588 });
589 */
590 
591 </script>';
592 
593 dolibarr_install_syslog("- check: end");
594 pFooter(1); // Never display next button
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
pHeader($subtitle, $next, $action= 'set', $param= '', $forcejqueryurl= '', $csstable= 'main-inside')
Show HTML header of install pages.
Definition: inc.php:347
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
dol_decode($chain, $key= '1')
Decode a base 64 encoded + specific delta change.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
versiondolibarrarray()
Return version Dolibarr.
Definition: admin.lib.php:135
dol_is_dir($folder)
Test if filename is a directory.
Definition: files.lib.php:432
versiontostring($versionarray)
Renvoi une version en chaine depuis une version en tableau.
Definition: admin.lib.php:36
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition: inc.php:482
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition: admin.lib.php:66
getBrowserInfo($user_agent)
Return information about user browser.
print $_SERVER["PHP_SELF"]
Edit parameters.
pFooter($nonext=0, $setuplang= '', $jscheckfunction= '', $withpleasewait=0)
Print HTML footer of install pages.
Definition: inc.php:424
print
Draft customers invoices.
Definition: index.php:89
versionphparray()
Return version PHP.
Definition: admin.lib.php:125