dolibarr  7.0.0-beta
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@capnetworks.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 <http://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 $langs->load("admin");
31 $langs->load("other");
32 
33 $action=GETPOST('action','alpha');
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('http://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  }
102  else
103  {
104  print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
105  }
106  }
107  else
108  {
109  print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a><br>';
110  }
111 }
112 
113 print '<br>';
114 print '<br>';
115 
116 // Upgrade
117 print $langs->trans("Upgrade").'<br>';
118 print '<hr>';
119 print $langs->trans("ThisIsProcessToFollow").'<br>';
120 print '<b>'.$langs->trans("StepNb",1).'</b>: ';
121 $fullurl='<a href="'.$urldolibarr.'" target="_blank">'.$urldolibarr.'</a>';
122 print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
123 print '<b>'.$langs->trans("StepNb",2).'</b>: ';
124 print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
125 print '<b>'.$langs->trans("StepNb",3).'</b>: ';
126 print $langs->trans("RemoveLock",$dolibarrdataroot.'/install.lock').'<br>';
127 print '<b>'.$langs->trans("StepNb",4).'</b>: ';
128 $fullurl='<a href="'.DOL_URL_ROOT.'/install/" target="_blank">'.DOL_URL_ROOT.'/install/</a>';
129 print $langs->trans("CallUpdatePage",$fullurl).'<br>';
130 print '<b>'.$langs->trans("StepNb",5).'</b>: ';
131 print $langs->trans("RestoreLock",$dolibarrdataroot.'/install.lock').'<br>';
132 
133 print '<br>';
134 print '<br>';
135 
136 
137 
138 
139 
140 print $langs->trans("AddExtensionThemeModuleOrOther").'<br>';
141 print '<hr>';
142 
143 print $langs->trans("GoModuleSetupArea", DOL_URL_ROOT.'/admin/modules.php?mode=deploy', $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules"));
144 
145 
146 llxFooter();
147 
148 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array())
Function get content from an URL (use proxy if proxy defined)
Definition: geturl.lib.php:34
if(GETPOST('button_removefilter_x','alpha')||GETPOST('button_removefilter.x','alpha')||GETPOST('button_removefilter','alpha')) if($action=="save"&&empty($cancel)) if(preg_match('/set_(.*)/', $action, $reg)) if(preg_match('/del_(.*)/', $action, $reg) $wikihelp)
View.
Definition: agenda.php:143
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition: admin.lib.php:58
print
Draft customers invoices.
Definition: index.php:91