dolibarr  13.0.2
update.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
25 require '../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
29 
30 // Load translation files required by the page
31 $langs->loadLangs(array("admin", "other"));
32 
33 $action = GETPOST('action', 'aZ09');
34 
35 if (!$user->admin) accessforbidden();
36 
37 if (GETPOST('msg', 'alpha')) {
38  setEventMessages(GETPOST('msg', 'alpha'), null, 'errors');
39 }
40 
41 
42 $urldolibarr = 'https://www.dolibarr.org/downloads/';
43 $dolibarrroot = preg_replace('/([\\/]+)$/i', '', DOL_DOCUMENT_ROOT);
44 $dolibarrroot = preg_replace('/([^\\/]+)$/i', '', $dolibarrroot);
45 $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
46 
47 $sfurl = '';
48 $version = '0.0';
49 
50 
51 /*
52  * Actions
53  */
54 
55 if ($action == 'getlastversion')
56 {
57  $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
58  //var_dump($result['content']);
59  $sfurl = simplexml_load_string($result['content']);
60 }
61 
62 
63 /*
64  * View
65  */
66 
67 $wikihelp = 'EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
68 llxHeader('', $langs->trans("Upgrade"), $wikihelp);
69 
70 print load_fiche_titre($langs->trans("Upgrade"), '', 'title_setup');
71 
72 print '<br>';
73 
74 print $langs->trans("CurrentVersion").' : <strong>'.DOL_VERSION.'</strong><br>';
75 
76 if (function_exists('curl_init'))
77 {
78  $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
79 
80  if ($action == 'getlastversion')
81  {
82  if ($sfurl)
83  {
84  $i = 0;
85  while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
86  {
87  $title = $sfurl->channel[0]->item[$i]->title;
88  if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
89  {
90  $newversion = $reg[1];
91  $newversionarray = explode('.', $newversion);
92  $versionarray = explode('.', $version);
93  //var_dump($newversionarray);var_dump($versionarray);
94  if (versioncompare($newversionarray, $versionarray) > 0) $version = $newversion;
95  }
96  $i++;
97  }
98 
99  // Show version
100  print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b><br>';
101  } else {
102  print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b><br>';
103  }
104  } else {
105  print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">'.$langs->trans("Check").'</a><br>';
106  }
107 }
108 
109 print '<br>';
110 print '<br>';
111 
112 // Upgrade
113 print $langs->trans("Upgrade").'<br>';
114 print '<hr>';
115 print $langs->trans("ThisIsProcessToFollow").'<br>';
116 print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
117 $fullurl = '<a href="'.$urldolibarr.'" target="_blank">'.$urldolibarr.'</a>';
118 print $langs->trans("DownloadPackageFromWebSite", $fullurl).'<br>';
119 print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
120 print $langs->trans("UnpackPackageInDolibarrRoot", $dolibarrroot).'<br>';
121 print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
122 print $langs->trans("RemoveLock", $dolibarrdataroot.'/install.lock').'<br>';
123 print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
124 $fullurl = '<a href="'.DOL_URL_ROOT.'/install/" target="_blank">'.DOL_URL_ROOT.'/install/</a>';
125 print $langs->trans("CallUpdatePage", $fullurl).'<br>';
126 print '<b>'.$langs->trans("StepNb", 5).'</b>: ';
127 print $langs->trans("RestoreLock", $dolibarrdataroot.'/install.lock').'<br>';
128 
129 print '<br>';
130 print '<br>';
131 
132 
133 
134 
135 
136 print $langs->trans("AddExtensionThemeModuleOrOther").'<br>';
137 print '<hr>';
138 
139 print $langs->trans("GoModuleSetupArea", DOL_URL_ROOT.'/admin/modules.php?mode=deploy', $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules"));
140 
141 // End of page
142 llxFooter();
143 $db->close();
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)
Function to get a content from an URL (use proxy if proxy defined).
Definition: geturl.lib.php:38
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $wikihelp
View.
Definition: agenda.php:120
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition: admin.lib.php:66
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
Definition: index.php:89
llxFooter()
Empty footer.
Definition: wrapper.php:59