* Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent * * 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 * the Free Software Foundation; either version 3 of the License, or * (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 * along with this program. If not, see . */ /** * \file htdocs/admin/tools/update.php * \brief Page to make a Dolibarr online upgrade */ require '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $langs->load("admin"); $langs->load("other"); if (! $user->admin) accessforbidden(); if (GETPOST('msg','alpha')) { setEventMessage(GETPOST('msg','alpha'), 'errors'); } $urldolibarr='http://www.dolibarr.org/downloads/'; $urldolibarrmodules='http://www.dolistore.com/'; $urldolibarrthemes='http://www.dolistore.com/'; $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT); $dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot); $dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT); /* * Actions */ if (GETPOST('action','alpha')=='install') { $error=0; $original_file=basename($_FILES["fileinstall"]["name"]); $newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file; if (! $original_file) { $langs->load("Error"); setEventMessage($langs->trans("ErrorFileRequired"), 'warnings'); $error++; } else { if (! preg_match('/\.zip/i',$original_file)) { $langs->load("errors"); setEventMessage($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), 'errors'); $error++; } } if (! $error) { @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file); dol_mkdir($conf->admin->dir_temp.'/'.$original_file); $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']); if ($result > 0) { $documentrootalt=DOL_DOCUMENT_ROOT.'/extensions'; $result=dol_uncompress($newfile,$documentrootalt); if (! empty($result['error'])) { $langs->load("errors"); setEventMessage($langs->trans($result['error'],$original_file), 'errors'); } else { setEventMessage($langs->trans("SetupIsReadyForUse")); } } } } /* * View */ $dirins=DOL_DOCUMENT_ROOT.'/extensions'; $dirins_ok=(is_dir($dirins)); $wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización'; llxHeader('',$langs->trans("Upgrade"),$wikihelp); print_fiche_titre($langs->trans("Upgrade"),'','setup'); print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
'; print $langs->trans("LastStableVersion").' : '.$langs->trans("FeatureNotYetAvailable").'
'; print '
'; print $langs->trans("Upgrade").'
'; print '
'; print $langs->trans("ThisIsProcessToFollow").'
'; print ''.$langs->trans("StepNb",1).': '; $fullurl=''.$urldolibarr.''; print $langs->trans("DownloadPackageFromWebSite",$fullurl).'
'; print ''.$langs->trans("StepNb",2).': '; print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'
'; print ''.$langs->trans("StepNb",3).': '; print $langs->trans("RemoveLock",$dolibarrdataroot.'/install.lock').'
'; print ''.$langs->trans("StepNb",4).': '; $fullurl=''.DOL_URL_ROOT.'/install/'; print $langs->trans("CallUpdatePage",$fullurl).'
'; print ''.$langs->trans("StepNb",5).': '; print $langs->trans("RestoreLock",$dolibarrdataroot.'/install.lock').'
'; print '
'; print '
'; $fullurl=''.$urldolibarrmodules.''; print $langs->trans("AddExtensionThemeModuleOrOther").'
'; print '
'; print $langs->trans("ThisIsProcessToFollow").'
'; print ''.$langs->trans("StepNb",1).': '; print $langs->trans("FindPackageFromWebSite",$fullurl).'
'; print ''.$langs->trans("StepNb",2).': '; print $langs->trans("DownloadPackageFromWebSite",$fullurl).'
'; print ''.$langs->trans("StepNb",3).': '; print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'
'; if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE)) { if ($dirins_ok) { print '
'; print ''; print $langs->trans("YouCanSubmitFile").' '; print ''; print '
'; } else { $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); setEventMessage($message, 'warnings'); } } else { print ''.$langs->trans("StepNb",4).': '; print $langs->trans("SetupIsReadyForUse").'
'; } print ''; if (! empty($result['return'])) { print '
'; foreach($result['return'] as $value) { echo $value.'
'; } } llxFooter(); $db->close();