// Merge -> 10309
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10333 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -49,7 +49,7 @@ if(empty($_POST['action']) OR !in_array($_POST['action'],array('upgradeDb')))
|
||||
// Add Upgrader class : if > 1.4.5.0 , uses core class
|
||||
// otherwise, use Upgrader.php in modules.
|
||||
// in both cases, use override if files exists
|
||||
if (!version_compare(_PS_VERSION_,'1.4.5.0','<') && file_exists(_PS_ROOT_DIR_.'/classes/Upgrader.php'))
|
||||
if (!version_compare(_PS_VERSION_,'1.4.6.0','<') && file_exists(_PS_ROOT_DIR_.'/classes/Upgrader.php'))
|
||||
require_once(_PS_ROOT_DIR_.'/classes/Upgrader.php');
|
||||
else
|
||||
require_once(dirname(__FILE__).'/Upgrader.php');
|
||||
@@ -118,6 +118,8 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
public $prodRootDir = '';
|
||||
public $adminDir = '';
|
||||
public $rootWritable = false;
|
||||
|
||||
public $lastAutoupgradeVersion = '';
|
||||
public $svnDir = 'svn';
|
||||
public $destDownloadFilename = 'prestashop.zip';
|
||||
public $toUpgradeFileList = 'filesToUpgrade.list';
|
||||
@@ -156,7 +158,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
* value = the next step you want instead
|
||||
* example : public static $skipAction = array('download' => 'upgradeFiles');
|
||||
*/
|
||||
public static $skipAction;
|
||||
public static $skipAction = array();
|
||||
public $useSvn;
|
||||
|
||||
protected $_includeContainer = false;
|
||||
@@ -276,14 +278,42 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
|
||||
public function configOk()
|
||||
{
|
||||
$allowed = (ConfigurationTest::test_fopen() && $this->rootWritable);
|
||||
$allowed &= !Configuration::get('PS_SHOP_ENABLE');
|
||||
$allowed &= $this->upgrader->autoupgrade;
|
||||
$allowed &= (Configuration::get('PS_AUTOUP_KEEP_TRAD') !== false);
|
||||
|
||||
$allowed_array = $this->getCheckCurrentConfig();
|
||||
$allowed = array_product($allowed_array);
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
public function getcheckCurrentConfig()
|
||||
{
|
||||
static $allowed_array;
|
||||
|
||||
if(empty($allowed_array))
|
||||
{
|
||||
$allowed_array = array();
|
||||
$allowed_array['fopen'] = ConfigurationTest::test_fopen();
|
||||
$allowed_array['root_writable'] = $this->rootWritable;
|
||||
$allowed_array['shop_enabled'] = !Configuration::get('PS_SHOP_ENABLE');
|
||||
$allowed_array['autoupgrade_allowed'] = $this->upgrader->autoupgrade;
|
||||
$module_version = '0.1';
|
||||
if ($module_version = simplexml_load_file(dirname(__FILE__).'/config.xml'))
|
||||
$module_version = (string)$module_version->version;
|
||||
$allowed_array['module_version_ok'] = version_compare($module_version, $this->upgrader->autoupgrade_last_version, '>=');
|
||||
// if one option has been defined, all options are.
|
||||
$allowed_array['module_configured'] = (Configuration::get('PS_AUTOUP_KEEP_TRAD') !== false);
|
||||
}
|
||||
return $allowed_array;
|
||||
}
|
||||
|
||||
|
||||
public function checkAutoupgradeLastVersion(){
|
||||
if ($module_version = simplexml_load_file(_PS_MODULE_DIR_.'autoupgrade'.'/config.xml'))
|
||||
$module_version = (string)$module_version['version'];
|
||||
else
|
||||
$module_version = '';
|
||||
|
||||
return version_compare($this->upgrader->autoupgrade_last_version, $module_version, '==');
|
||||
}
|
||||
|
||||
/**
|
||||
* isUpgradeAllowed checks if all server configuration is valid for upgrade
|
||||
*
|
||||
@@ -315,7 +345,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
$this->action = empty($_REQUEST['action'])?null:$_REQUEST['action'];
|
||||
$this->currentParams = empty($_REQUEST['params'])?null:$_REQUEST['params'];
|
||||
// test writable recursively
|
||||
if(version_compare(_PS_VERSION_,'1.4.5.0','<'))
|
||||
if(version_compare(_PS_VERSION_,'1.4.6.0','<') || !class_exists('ConfigurationTest', false))
|
||||
{
|
||||
require_once('ConfigurationTest.php');
|
||||
if(!class_exists('ConfigurationTest', false) AND class_exists('ConfigurationTestCore'))
|
||||
@@ -324,8 +354,9 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
if (ConfigurationTest::test_dir($this->prodRootDir,true))
|
||||
$this->rootWritable = true;
|
||||
|
||||
if (!in_array($this->action,array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb')))
|
||||
if (!in_array($this->action, array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb', 'checkFilesVersion')))
|
||||
{
|
||||
|
||||
$this->upgrader = new Upgrader();
|
||||
$this->upgrader->checkPSVersion();
|
||||
$this->nextParams['install_version'] = $this->upgrader->version_num;
|
||||
@@ -464,8 +495,21 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
}
|
||||
public function ajaxProcessCheckFilesVersion()
|
||||
{
|
||||
if ($this->upgrader->isAuthenticPrestashopVersion() !== false)
|
||||
$this->_loadDbRelatedClasses();
|
||||
$this->upgrader = new Upgrader();
|
||||
|
||||
$changedFileList = $this->upgrader->getChangedFilesList();
|
||||
if ($this->upgrader->isAuthenticPrestashopVersion() == true
|
||||
&& !is_array($changedFileList) )
|
||||
{
|
||||
$this->nextParams['status'] = 'error';
|
||||
$this->nextParams['msg'] = '[TECHNICAL ERROR] Unable to check files';
|
||||
$testOrigCore = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->upgrader->isAuthenticPrestashopVersion() != false)
|
||||
{
|
||||
$this->nextParams['status'] = 'ok';
|
||||
$testOrigCore = true;
|
||||
}
|
||||
@@ -475,7 +519,6 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
$this->nextParams['status'] = 'warn';
|
||||
}
|
||||
|
||||
$changedFileList = $this->upgrader->getChangedFilesList();
|
||||
if (!isset($changedFileList['core']))
|
||||
$changedFileList['core'] = array();
|
||||
if (!isset($changedFileList['translation']))
|
||||
@@ -495,6 +538,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
}
|
||||
$this->nextParams['result'] = $changedFileList;
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessUpgradeNow()
|
||||
{
|
||||
@@ -551,7 +595,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
|
||||
/**
|
||||
* extract last version into admin/autoupgrade/latest directory
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxProcessUnzip(){
|
||||
@@ -938,7 +982,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
}
|
||||
|
||||
/**
|
||||
* ajaxProcessRestoreFiles restore the previously saved files,
|
||||
* ajaxProcessRestoreFiles restore the previously saved files,
|
||||
* and delete files that weren't archived
|
||||
*
|
||||
* @return boolean true if succeed
|
||||
@@ -947,13 +991,13 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
{
|
||||
$this->next = 'restoreFiles';
|
||||
// @TODO : workaround max_execution_time / ajax batch unzip
|
||||
// very first restoreFiles step : extract backup
|
||||
// very first restoreFiles step : extract backup
|
||||
if (!empty($this->backupFilesFilename) AND file_exists($this->backupFilesFilename))
|
||||
{
|
||||
// cleanup current PS tree
|
||||
$fromArchive = $this->_listArchivedFiles();
|
||||
file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->fromArchiveFileList, serialize($fromArchive));
|
||||
|
||||
|
||||
//$this->_cleanUp($this->prodRootDir.'/');
|
||||
$this->nextQuickInfo[] = $this->l('root directory cleaned.');
|
||||
|
||||
@@ -963,7 +1007,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
if (self::ZipExtract($filepath, $destExtract))
|
||||
{
|
||||
$this->next = 'restoreFiles';
|
||||
// get new file list
|
||||
// get new file list
|
||||
$this->nextDesc = $this->l('Files restored. Removing files added by upgrade ...');
|
||||
// once it's restored, do not delete the archive file. This has to be done manually
|
||||
// but we can empty the var, to avoid loop.
|
||||
@@ -977,9 +1021,9 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// very second restoreFiles step : remove new files that shouldn't be there
|
||||
// for that, we will make a diff between the current filelist in root dir
|
||||
// for that, we will make a diff between the current filelist in root dir
|
||||
// and the archive file list we previously saved
|
||||
// files to remove : differences between complete list and archive list
|
||||
if (!file_exists($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->toRemoveFileList))
|
||||
@@ -989,7 +1033,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
$toRemove = array_diff($this->_listFilesInDir($this->prodRootDir), $fromArchive);
|
||||
file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->toRemoveFileList,serialize($toRemove));
|
||||
}
|
||||
|
||||
|
||||
if (!isset($toRemove))
|
||||
$toRemove = unserialize(file_get_contents($this->toRemoveFileList));
|
||||
|
||||
@@ -1007,8 +1051,8 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
else
|
||||
{
|
||||
$checkFile = array_shift($toRemove);
|
||||
//
|
||||
if (in_array($checkFile, $toRemove)
|
||||
//
|
||||
if (in_array($checkFile, $toRemove)
|
||||
&& !$this->_skipFile('', $path.$file, 'backup')
|
||||
&& !$this->_skipFile('', $path.$file, 'upgrade')
|
||||
)
|
||||
@@ -1461,8 +1505,7 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
*/
|
||||
public function displayConf()
|
||||
{
|
||||
|
||||
if (version_compare(_PS_VERSION_,'1.4.6.0','<') AND false)
|
||||
if (version_compare(_PS_VERSION_,'1.4.5.0','<') AND false)
|
||||
$this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.5.0 version and should not be used in an older version');
|
||||
parent::displayConf();
|
||||
}
|
||||
@@ -1470,10 +1513,10 @@ class AdminSelfUpgrade extends AdminSelfTab
|
||||
public function ajaxPreProcess()
|
||||
{
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_)
|
||||
return;
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
|
||||
if (!empty($_POST['responseType']) AND $_POST['responseType'] == 'json')
|
||||
header('Content-Type: application/json');
|
||||
|
||||
@@ -1587,7 +1630,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
}
|
||||
|
||||
/** this returns fieldset containing the configuration points you need to use autoupgrade
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
private function getCurrentConfiguration()
|
||||
{
|
||||
@@ -1597,6 +1640,19 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
<p>'.$this->l('All the following points must be ok in order to allow the upgrade.').'</p>
|
||||
<b>'.$this->l('Root directory').' : </b>'.$this->prodRootDir.'<br/><br/>';
|
||||
|
||||
if ($this->checkAutoupgradeLastVersion())
|
||||
$srcModuleVersion = '../img/admin/enabled.gif';
|
||||
else
|
||||
$srcModuleVersion = '../img/admin/disabled.gif';
|
||||
|
||||
if ($module_version = simplexml_load_file(dirname(__FILE__).'/config.xml'))
|
||||
$module_version = (string)$module_version->version;
|
||||
|
||||
$content .= '<b>'.$this->l('Module version').' : </b>'
|
||||
.'<img src="'.$srcModuleVersion.'" /> '
|
||||
.sprintf($this->lastAutoupgradeVersion?
|
||||
$this->l('You have the last version (%s)'):$this->l('You currently use the version %1$s of the autoupgrade module. Please install the last version (%2$s)'), $module_version, $this->upgrader->autoupgrade_last_version).'<br/><br/>';
|
||||
|
||||
if ($this->rootWritable)
|
||||
$srcRootWritable = '../img/admin/enabled.gif';
|
||||
else
|
||||
@@ -1645,7 +1701,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
$configurationDone = '../img/admin/enabled.gif';
|
||||
else
|
||||
$configurationDone = '../img/admin/disabled.gif';
|
||||
$content .= '<b>'.$this->l('Options chosen').' : </b>'.'<img src="'.$configurationDone.'" />
|
||||
$content .= '<b>'.$this->l('Options chosen').' : </b>'.'<img src="'.$configurationDone.'" />
|
||||
<a class="button" id="scrollToOptions" href="#options">'
|
||||
.($testConfigDone
|
||||
?$this->l('autoupgrade configuration ok').' - '.$this->l('Modify your options')
|
||||
@@ -1673,7 +1729,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
$content .= '<script type="text/javascript">
|
||||
$("#currentConfigurationToggle").click(function(e){e.preventDefault();$("#currentConfiguration").toggle()});'
|
||||
.($this->configOk()?'$("#currentConfiguration").hide();$("#currentConfigurationToggle").after("<img src=\"../img/admin/enabled.gif\" />");':'').'</script>';
|
||||
$content .= '<div style="float:left">
|
||||
$content .= '<div style="clear:left"> </div><div style="float:left">
|
||||
<h1>'.sprintf($this->l('Your current prestashop version : %s '),_PS_VERSION_).'</h1>';
|
||||
$content .= '<p>'.sprintf($this->l('Last version is %1$s (%2$s) '), $this->upgrader->version_name, $this->upgrader->version_num).'</p>';
|
||||
|
||||
@@ -1700,10 +1756,10 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
{
|
||||
$content .= '<span class="button-autoupgrade upgradestep" >'.$this->l('Your shop is already up to date.').'</span> ';
|
||||
}
|
||||
$content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
|
||||
$content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
|
||||
<a class="button" href="index.php?tab=AdminSelfUpgrade&token='.Tools::getAdminToken('AdminSelfUpgrade'.(int)(Tab::getIdFromClassName(get_class($this))).(int)$cookie->id_employee).'&refreshCurrentVersion=1">'.$this->l('Please click to refresh').'</a>
|
||||
</small>';
|
||||
|
||||
|
||||
$content .= '</div>
|
||||
<div id="currentlyProcessing" style="display:none;float:right"><h4>Currently processing <img id="pleaseWait" src="'.__PS_BASE_URI__.'img/loader.gif"/></h4>
|
||||
|
||||
@@ -1747,7 +1803,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
else
|
||||
$content .= '<p>'.$this->l('Your current configuration does not allow upgrade.').'</p>';
|
||||
|
||||
$content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
|
||||
$content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
|
||||
<a class="button" href="index.php?tab=AdminSelfUpgrade&token='.Tools::getAdminToken('AdminSelfUpgrade'.(int)(Tab::getIdFromClassName(get_class($this))).(int)$cookie->id_employee).'&refreshCurrentVersion=1">'.$this->l('Please click to refresh').'</a>
|
||||
</small>';
|
||||
|
||||
@@ -1773,14 +1829,13 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
public function display()
|
||||
{
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_)
|
||||
{
|
||||
echo '<div class="error">'.Tools::displayError('This functionnality has been disabled.').'</div>';
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
|
||||
if(isset($_GET['refreshCurrentVersion']))
|
||||
{
|
||||
$upgrader = new Upgrader();
|
||||
@@ -1823,7 +1878,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
$this->_displayForm('autoUpgradeOptions',$this->_fieldsAutoUpgrade,'<a href="" name="options" id="options">'.$this->l('Options').'</a>', '','prefs');
|
||||
// @todo manual upload with a form
|
||||
|
||||
// We need jquery 1.6 for json
|
||||
// We need jquery 1.6 for json
|
||||
echo '<script type="text/javascript">
|
||||
jq13 = jQuery.noConflict(true);
|
||||
</script>
|
||||
@@ -2225,7 +2280,7 @@ function handleError(res)
|
||||
$("#cchangedList").append("<br/>");
|
||||
|
||||
}';
|
||||
|
||||
|
||||
$js.= '$(document).ready(function(){
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
@@ -2264,6 +2319,7 @@ function handleError(res)
|
||||
,
|
||||
error: function(res,textStatus,jqXHR)
|
||||
{
|
||||
//$("#checkPrestaShopFilesVersion").html("<img src=\"../img/admin/warning.gif\" /> "+textStatus);
|
||||
if (textStatus == "timeout" && action == "download")
|
||||
{
|
||||
updateInfoStep("'.$this->l('Your server can\'t download the file. Please upload it first by ftp in your admin/autoupgrade directory').'");
|
||||
@@ -2299,7 +2355,7 @@ function handleError(res)
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($fromFile) === true)
|
||||
{
|
||||
if (@$zip->extractTo($toDir.'/')
|
||||
if (@$zip->extractTo($toDir.'/')
|
||||
&& $zip->close()
|
||||
)
|
||||
{
|
||||
|
||||
@@ -39,15 +39,26 @@ class UpgraderCore
|
||||
|
||||
public $version_name;
|
||||
public $version_num;
|
||||
public $version_is_modified = null;
|
||||
/**
|
||||
* @var string contains hte url where to download the file
|
||||
*/
|
||||
public $link;
|
||||
public $autoupgrade;
|
||||
public $autoupgrade_module;
|
||||
public $autoupgrade_last_version;
|
||||
public $changelog;
|
||||
public $md5;
|
||||
|
||||
public function __construct($autoload = false)
|
||||
{
|
||||
if ($autoload)
|
||||
{
|
||||
$this->loadFromConfig();
|
||||
// checkPSVersion to get need_upgrade
|
||||
$this->checkPSVersion();
|
||||
}
|
||||
}
|
||||
public function __get($var)
|
||||
{
|
||||
if ($var == 'need_upgrade')
|
||||
@@ -90,8 +101,7 @@ class UpgraderCore
|
||||
*/
|
||||
public function checkPSVersion($force = false)
|
||||
{
|
||||
if (empty($this->link))
|
||||
{
|
||||
|
||||
if (class_exists('Configuration'))
|
||||
$last_check = Configuration::get('PS_LAST_VERSION_CHECK');
|
||||
else
|
||||
@@ -103,7 +113,6 @@ class UpgraderCore
|
||||
libxml_set_streams_context(@stream_context_create(array('http' => array('timeout' => 3))));
|
||||
if ($feed = @simplexml_load_file($this->rss_version_link))
|
||||
{
|
||||
|
||||
$this->version_name = (string)$feed->version->name;
|
||||
$this->version_num = (string)$feed->version->num;
|
||||
$this->link = (string)$feed->download->link;
|
||||
@@ -111,6 +120,7 @@ class UpgraderCore
|
||||
$this->changelog = (string)$feed->download->changelog;
|
||||
$this->autoupgrade = (int)$feed->autoupgrade;
|
||||
$this->autoupgrade_module = (int)$feed->autoupgrade_module;
|
||||
$this->autoupgrade_last_version = (string)$feed->autoupgrade_last_version;
|
||||
$this->desc = (string)$feed->desc ;
|
||||
$config_last_version = array(
|
||||
'name' => $this->version_name,
|
||||
@@ -119,6 +129,7 @@ class UpgraderCore
|
||||
'md5' => $this->md5,
|
||||
'autoupgrade' => $this->autoupgrade,
|
||||
'autoupgrade_module' => $this->autoupgrade_module,
|
||||
'autoupgrade_last_version' => $this->autoupgrade_last_version,
|
||||
'changelog' => $this->changelog,
|
||||
'desc' => $this->desc
|
||||
);
|
||||
@@ -130,8 +141,29 @@ class UpgraderCore
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->loadFromConfig();
|
||||
// retro-compatibility :
|
||||
// return array(name,link) if you don't use the last version
|
||||
// false otherwise
|
||||
if (version_compare(_PS_VERSION_, $this->version_num, '<'))
|
||||
{
|
||||
$this->need_upgrade = true;
|
||||
return array('name' => $this->version_name, 'link' => $this->link);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* load the last version informations stocked in base
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function loadFromConfig()
|
||||
{
|
||||
$last_version_check = @unserialize(Configuration::get('PS_LAST_VERSION'));
|
||||
if($last_version_check)
|
||||
{
|
||||
if (isset($last_version_check['name']))
|
||||
$this->version_name = $last_version_check['name'];
|
||||
if (isset($last_version_check['num']))
|
||||
@@ -142,6 +174,8 @@ class UpgraderCore
|
||||
$this->autoupgrade = $last_version_check['autoupgrade'];
|
||||
if (isset($last_version_check['autoupgrade_module']))
|
||||
$this->autoupgrade_module = $last_version_check['autoupgrade_module'];
|
||||
if (isset($last_version_check['autoupgrade_last_version']))
|
||||
$this->autoupgrade_last_version = $last_version_check['autoupgrade_last_version'];
|
||||
if (isset($last_version_check['md5']))
|
||||
$this->md5 = $last_version_check['md5'];
|
||||
if (isset($last_version_check['desc']))
|
||||
@@ -149,26 +183,23 @@ class UpgraderCore
|
||||
if (isset($last_version_check['changelog']))
|
||||
$this->changelog = $last_version_check['changelog'];
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
// retro-compatibility :
|
||||
// return array(name,link) if you don't use the last version
|
||||
// false otherwise
|
||||
if (version_compare(_PS_VERSION_, $this->version_num, '<'))
|
||||
{
|
||||
$this->need_upgrade = true;
|
||||
return array('name' => $this->version_name, 'link' => $this->link);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* return an array of files
|
||||
* that the md5file does not match to the original md5file (provided by $rss_md5file_link_dir )
|
||||
* @return void
|
||||
*/
|
||||
public function getChangedFilesList()
|
||||
{
|
||||
if (count($this->changed_files) == 0)
|
||||
if (is_array($this->changed_files) && count($this->changed_files) == 0)
|
||||
{
|
||||
$checksum = @simplexml_load_file($this->rss_md5file_link_dir._PS_VERSION_.'.xml');
|
||||
if ($checksum === false)
|
||||
return false;
|
||||
if ($checksum == false)
|
||||
{
|
||||
$this->changed_files = false;
|
||||
}
|
||||
else
|
||||
$this->browseXmlAndCompare($checksum->ps_root_dir[0]);
|
||||
}
|
||||
@@ -248,6 +279,7 @@ class UpgraderCore
|
||||
|
||||
public function isAuthenticPrestashopVersion()
|
||||
{
|
||||
|
||||
$this->getChangedFilesList();
|
||||
return !$this->version_is_modified;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,10 @@ class Autoupgrade extends Module
|
||||
{
|
||||
$this->name = 'autoupgrade';
|
||||
$this->tab = 'administration';
|
||||
$this->version = 0.1;
|
||||
// version number x.y.z
|
||||
// y+1 means a major bugfix or improvement
|
||||
// z+1 means a bugfix
|
||||
$this->version = '0.2.1';
|
||||
|
||||
if (!defined('_PS_ADMIN_DIR_'))
|
||||
{
|
||||
@@ -53,7 +56,6 @@ class Autoupgrade extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
|
||||
$res = true;
|
||||
// before adding AdminSelfUpgrade, we should remove AdminUpgrade
|
||||
$idTab = Tab::getIdFromClassName('AdminUpgrade');
|
||||
@@ -72,7 +74,9 @@ class Autoupgrade extends Module
|
||||
$tab->class_name = 'AdminSelfUpgrade';
|
||||
$tab->module = 'autoupgrade';
|
||||
$tab->id_parent = 9;
|
||||
$tab->name = array_fill(1, sizeof(Language::getLanguages(false)), 'Upgrade');
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $lang)
|
||||
$tab->name[$lang['id_lang']] = 'Upgrade';
|
||||
$res &= $tab->save();
|
||||
}
|
||||
else
|
||||
@@ -103,12 +107,18 @@ class Autoupgrade extends Module
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$idtab = Configuration::get('PS_AUTOUPDATE_MODULE_IDTAB');
|
||||
$tab = new Tab($idtab,1);
|
||||
$id_tab = Configuration::get('PS_AUTOUPDATE_MODULE_IDTAB');
|
||||
if ($id_tab)
|
||||
{
|
||||
$tab = new Tab($id_tab,1);
|
||||
$res = $tab->delete();
|
||||
}
|
||||
else
|
||||
$res = true;
|
||||
// for people in 1.4.4.0 or 1.4.4.1, we have to remove that file
|
||||
// and of course delete it in the database.
|
||||
if (file_exists(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'tabs'.'AdminUpgrade.php'))
|
||||
{
|
||||
// Should we create the correct AdminUpgrade tab (not the module)
|
||||
if($idOldTab = Tab::getIdFromClassName('AdminUpgrade'))
|
||||
{
|
||||
$tab = new Tab($idOldTab);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>autoupgrade</name>
|
||||
<displayName><![CDATA[Autoupgrade module]]></displayName>
|
||||
<version><![CDATA[0.1]]></version>
|
||||
<version><![CDATA[0.2.1]]></version>
|
||||
<description><![CDATA[Provides an automated method to upgrade your shop to the last PrestaShop version. Caution : custom theme are not updated.]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[administration]]></tab>
|
||||
|
||||
@@ -21,7 +21,7 @@ $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8d8e0207549d32c6f86424640303
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c62f82b25de72c3b0bb07225c49fe9d0'] = '%1$s fichier(s) du coeur a été modifié (sur %2$s au total)';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7b2f224649ef2ad10a2d73595d67a876'] = 'Démarrage mise à niveau ...';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6b2d0404b7faba0e791e15a52586a149'] = 'Basculer vers svn checkout (useSvn activé)';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f0e38ac0c558a7f216ae98382b9e58f5'] = 'Site désactivé. Téléchargement en cours (peut prendre ';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_13b35313a987313838f0105902bb6742'] = 'Boutique désactivée. Téléchargement en cours... (ce qui peut prendre un certain temps) ...';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6824d57b7af37f605bd97d34defc3761'] = 'Exportation svn terminée. Suppression des fichiers exemples...';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f70307d8297e48a8783d41e6f3313d51'] = 'Erreur lors de l\'export SVN';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4eecd9c195e46c054ef7da6d9d1a738b'] = 'Extraction terminée. Suppression des fichiers exemples...';
|
||||
@@ -144,7 +144,7 @@ $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_af566be1636d11ecc8ddb728a155
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ea4d3af79ad2392b7c0cca4b8ddd7028'] = 'Vous avez déjà la dernière version disponible.';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_93cba07454f06a4a960172bbd6e2a435'] = 'Oui';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3d9f7f5927158b5a7dac0d65b4537265'] = 'Boutique désactivée';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_69af703e1b0af65d0eb16b85e3ebd738'] = 'Boutique désactivée';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_94af5df6182efd3591d0ccccaa04bd5c'] = 'Limite de temps PHP';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_075ae3d2fc31640504f814f60e5ef713'] = 'désactivée';
|
||||
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_783e8e29e6a8c3e22baa58a19420eb4f'] = 'secondes';
|
||||
|
||||
Reference in New Issue
Block a user