2007-03-24 18:05:16 +01:00
|
|
|
<?php
|
2017-02-11 15:41:01 +01:00
|
|
|
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
2012-04-25 12:41:00 +02:00
|
|
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
2007-03-24 18:05:16 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2007-03-24 18:05:16 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2007-03-24 18:05:16 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2009-05-18 01:54:07 +02:00
|
|
|
* \file htdocs/admin/tools/update.php
|
|
|
|
|
* \brief Page to make a Dolibarr online upgrade
|
|
|
|
|
*/
|
2007-04-27 11:19:42 +02:00
|
|
|
|
2021-08-04 12:26:38 +02:00
|
|
|
if (! defined('CSRFCHECK_WITH_TOKEN')) {
|
|
|
|
|
define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../../main.inc.php';
|
2020-04-10 10:59:32 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
2007-03-24 18:05:16 +01:00
|
|
|
|
2018-09-08 10:30:10 +02:00
|
|
|
// Load translation files required by the page
|
2020-04-10 10:59:32 +02:00
|
|
|
$langs->loadLangs(array("admin", "other"));
|
2007-03-24 18:05:16 +01:00
|
|
|
|
2020-09-16 19:39:50 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2015-04-04 00:19:03 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if (!$user->admin) {
|
|
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2007-04-27 11:19:42 +02:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
if (GETPOST('msg', 'alpha')) {
|
|
|
|
|
setEventMessages(GETPOST('msg', 'alpha'), null, 'errors');
|
2014-07-20 01:09:43 +02:00
|
|
|
}
|
2007-04-27 11:19:42 +02:00
|
|
|
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$urldolibarr = 'https://www.dolibarr.org/downloads/';
|
|
|
|
|
$dolibarrroot = preg_replace('/([\\/]+)$/i', '', DOL_DOCUMENT_ROOT);
|
|
|
|
|
$dolibarrroot = preg_replace('/([^\\/]+)$/i', '', $dolibarrroot);
|
|
|
|
|
$dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
|
2007-04-27 11:19:42 +02:00
|
|
|
|
2017-02-11 15:41:01 +01:00
|
|
|
$sfurl = '';
|
2020-04-10 10:59:32 +02:00
|
|
|
$version = '0.0';
|
2015-04-04 00:19:03 +02:00
|
|
|
|
|
|
|
|
|
2007-04-27 11:19:42 +02:00
|
|
|
/*
|
2010-06-06 19:36:35 +02:00
|
|
|
* Actions
|
|
|
|
|
*/
|
2007-04-27 11:19:42 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($action == 'getlastversion') {
|
2020-10-27 18:02:05 +01:00
|
|
|
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
2020-03-23 15:54:02 +01:00
|
|
|
//var_dump($result['content']);
|
2021-09-30 20:00:48 +02:00
|
|
|
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
2007-04-27 11:19:42 +02:00
|
|
|
}
|
|
|
|
|
|
2015-04-04 00:19:03 +02:00
|
|
|
|
2007-04-27 11:19:42 +02:00
|
|
|
/*
|
2010-06-06 19:36:35 +02:00
|
|
|
* View
|
|
|
|
|
*/
|
2007-03-24 18:05:16 +01:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$wikihelp = 'EN:Installation_-_Upgrade|FR:Installation_-_Mise_à _jour|ES:Instalación_-_Actualización';
|
2019-01-27 11:55:16 +01:00
|
|
|
llxHeader('', $langs->trans("Upgrade"), $wikihelp);
|
2007-03-24 18:05:16 +01:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
print load_fiche_titre($langs->trans("Upgrade"), '', 'title_setup');
|
2007-03-24 18:05:16 +01:00
|
|
|
|
2017-02-16 02:27:07 +01:00
|
|
|
print '<br>';
|
|
|
|
|
|
|
|
|
|
print $langs->trans("CurrentVersion").' : <strong>'.DOL_VERSION.'</strong><br>';
|
2015-03-14 13:23:36 +01:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if (function_exists('curl_init')) {
|
2020-03-23 15:54:02 +01:00
|
|
|
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
|
|
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($action == 'getlastversion') {
|
|
|
|
|
if ($sfurl) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$i = 0;
|
2021-02-26 22:04:03 +01:00
|
|
|
while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$title = $sfurl->channel[0]->item[$i]->title;
|
2021-02-26 22:04:03 +01:00
|
|
|
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$newversion = $reg[1];
|
|
|
|
|
$newversionarray = explode('.', $newversion);
|
|
|
|
|
$versionarray = explode('.', $version);
|
2020-03-23 15:54:02 +01:00
|
|
|
//var_dump($newversionarray);var_dump($versionarray);
|
2021-02-26 22:04:03 +01:00
|
|
|
if (versioncompare($newversionarray, $versionarray) > 0) {
|
|
|
|
|
$version = $newversion;
|
|
|
|
|
}
|
2020-03-23 15:54:02 +01:00
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Show version
|
2020-04-10 10:59:32 +02:00
|
|
|
print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b><br>';
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2020-04-10 10:59:32 +02:00
|
|
|
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b><br>';
|
2020-03-23 15:54:02 +01:00
|
|
|
}
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2021-08-04 12:26:38 +02:00
|
|
|
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion&token='.newToken().'" class="button smallpaddingimp">'.$langs->trans("Check").'</a><br>';
|
2020-03-23 15:54:02 +01:00
|
|
|
}
|
2015-01-26 16:05:47 +01:00
|
|
|
}
|
2007-03-24 18:05:16 +01:00
|
|
|
|
2017-02-11 15:41:01 +01:00
|
|
|
print '<br>';
|
2016-07-27 16:45:13 +02:00
|
|
|
print '<br>';
|
2015-04-04 00:19:03 +02:00
|
|
|
|
|
|
|
|
// Upgrade
|
2007-03-24 18:05:16 +01:00
|
|
|
print $langs->trans("Upgrade").'<br>';
|
2008-02-11 17:34:55 +01:00
|
|
|
print '<hr>';
|
|
|
|
|
print $langs->trans("ThisIsProcessToFollow").'<br>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
|
2021-11-22 02:35:55 +01:00
|
|
|
$fullurl = '<a href="'.$urldolibarr.'" target="_blank" rel="noopener noreferrer">'.$urldolibarr.'</a>';
|
2021-08-04 12:26:38 +02:00
|
|
|
print str_replace('{s}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s}')).'<br>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
|
2021-08-04 12:26:38 +02:00
|
|
|
print str_replace('{s}', $dolibarrroot, $langs->trans("UnpackPackageInDolibarrRoot", '{s}')).'<br>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
|
|
|
|
|
print $langs->trans("RemoveLock", $dolibarrdataroot.'/install.lock').'<br>';
|
|
|
|
|
print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
|
2021-11-22 02:35:55 +01:00
|
|
|
$fullurl = '<a href="'.DOL_URL_ROOT.'/install/" target="_blank" rel="noopener noreferrer">'.DOL_URL_ROOT.'/install/</a>';
|
2021-08-04 12:26:38 +02:00
|
|
|
print str_replace('{s}', $fullurl, $langs->trans("CallUpdatePage", '{s}')).'<br>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<b>'.$langs->trans("StepNb", 5).'</b>: ';
|
|
|
|
|
print $langs->trans("RestoreLock", $dolibarrdataroot.'/install.lock').'<br>';
|
2007-03-24 18:05:16 +01:00
|
|
|
|
|
|
|
|
print '<br>';
|
|
|
|
|
print '<br>';
|
|
|
|
|
|
2015-04-04 00:19:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-03-24 18:05:16 +01:00
|
|
|
print $langs->trans("AddExtensionThemeModuleOrOther").'<br>';
|
2008-02-11 17:34:55 +01:00
|
|
|
print '<hr>';
|
2021-08-04 12:26:38 +02:00
|
|
|
$texttoshow = $langs->trans("GoModuleSetupArea", DOL_URL_ROOT.'/admin/modules.php?mode=deploy', '{s2}');
|
|
|
|
|
$texttoshow = str_replace('{s2}', img_picto('', 'tools', 'class="pictofixedwidth"').$langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules"), $texttoshow);
|
|
|
|
|
print $texttoshow;
|
2007-04-27 11:19:42 +02:00
|
|
|
|
2018-07-28 14:29:28 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-04-16 11:07:09 +02:00
|
|
|
$db->close();
|