25if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
26 define(
'CSRFCHECK_WITH_TOKEN',
'1');
30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
36$langs->loadLangs(array(
"admin",
"other"));
38$action =
GETPOST(
'action',
'aZ09');
49$urldolibarr =
'https://www.dolibarr.org/downloads/';
50$dolibarrroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DOCUMENT_ROOT);
51$dolibarrroot = preg_replace(
'/([^\\/]+)$/i',
'', $dolibarrroot);
52$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
62if ($action ==
'getlastversion') {
63 $result =
getURLContent(
'https://sourceforge.net/projects/dolibarr/rss');
65 if (function_exists(
'simplexml_load_string')) {
66 if (LIBXML_VERSION < 20900) {
70 libxml_disable_entity_loader(
true);
73 $sfurl = simplexml_load_string($result[
'content'],
'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
75 $sfurl =
'xml_not_available';
84$wikihelp =
'EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
85llxHeader(
'', $langs->trans(
"Upgrade"), $wikihelp,
'', 0, 0,
'',
'',
'',
'mod-admin page-tools_update');
91print $langs->trans(
"CurrentVersion").
' : <strong>'.DOL_VERSION.
'</strong><br>';
93if (function_exists(
'curl_init')) {
94 $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
96 if ($action ==
'getlastversion') {
97 if ($sfurl ==
'xml_not_available') {
98 $langs->load(
"errors");
99 print $langs->trans(
"LastStableVersion").
' : <b class="error">'.$langs->trans(
"ErrorFunctionNotAvailableInPHP",
'simplexml_load_string').
'</b><br>';
102 while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) {
103 $title = $sfurl->channel[0]->item[$i]->title;
104 if (preg_match(
'/([0-9]+\.([0-9\.]+))/', $title, $reg)) {
105 $newversion = $reg[1];
106 $newversionarray = explode(
'.', $newversion);
107 $versionarray = explode(
'.', $version);
110 $version = $newversion;
117 print $langs->trans(
"LastStableVersion").
' : <b>'.(($version !=
'0.0') ? $version : $langs->trans(
"Unknown")).
'</b><br>';
119 print $langs->trans(
"LastStableVersion").
' : <b>'.$langs->trans(
"UpdateServerOffline").
'</b><br>';
122 print $langs->trans(
"LastStableVersion").
' : <a href="'.$_SERVER[
"PHP_SELF"].
'?action=getlastversion&token='.
newToken().
'" class="button smallpaddingimp">'.$langs->trans(
"Check").
'</a><br>';
130print $langs->trans(
"Upgrade").
'<br>';
132print $langs->trans(
"ThisIsProcessToFollow").
'<br>';
133print
'<b>'.$langs->trans(
"StepNb", 1).
'</b>: ';
134$fullurl =
'<a href="'.$urldolibarr.
'" target="_blank" rel="noopener noreferrer">'.$urldolibarr.
'</a>';
135print str_replace(
'{s}', $fullurl, $langs->trans(
"DownloadPackageFromWebSite",
'{s}')).
'<br>';
136print
'<b>'.$langs->trans(
"StepNb", 2).
'</b>: ';
137print str_replace(
'{s}', $dolibarrroot, $langs->trans(
"UnpackPackageInDolibarrRoot",
'{s}')).
'<br>';
138print
'<b>'.$langs->trans(
"StepNb", 3).
'</b>: ';
139print $langs->trans(
"RemoveLock", $dolibarrdataroot.
'/install.lock').
'<br>';
140print
'<b>'.$langs->trans(
"StepNb", 4).
'</b>: ';
141$fullurl =
'<a href="'.DOL_URL_ROOT.
'/install/" target="_blank" rel="noopener noreferrer">'.DOL_URL_ROOT.
'/install/</a>';
142print str_replace(
'{s}', $fullurl, $langs->trans(
"CallUpdatePage",
'{s}')).
'<br>';
143print
'<b>'.$langs->trans(
"StepNb", 5).
'</b>: ';
144print $langs->trans(
"RestoreLock", $dolibarrdataroot.
'/install.lock').
'<br>';
153print $langs->trans(
"AddExtensionThemeModuleOrOther").
'<br>';
155$texttoshow = $langs->trans(
"GoModuleSetupArea", DOL_URL_ROOT.
'/admin/modules.php?mode=deploy',
'{s2}');
156$texttoshow = str_replace(
'{s2}',
img_picto(
'',
'tools',
'class="pictofixedwidth"').$langs->transnoentities(
"Home").
' - '.$langs->transnoentities(
"Setup").
' - '.$langs->transnoentities(
"Modules"), $texttoshow);
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1)
Function to get a content from an URL (use proxy if proxy defined).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.