[*] BO : optimization Upgrader and Admin Home

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9745 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-10-31 10:54:37 +00:00
parent 2ee2272d0e
commit 90f2d6c7c3
3 changed files with 155 additions and 37 deletions
+45 -19
View File
@@ -48,6 +48,15 @@ class UpgraderCore
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')
@@ -130,25 +139,7 @@ class UpgraderCore
}
}
else
{
$last_version_check = @unserialize(Configuration::get('PS_LAST_VERSION'));
if (isset($last_version_check['name']))
$this->version_name = $last_version_check['name'];
if (isset($last_version_check['num']))
$this->version_num = $last_version_check['num'];
if (isset($last_version_check['link']))
$this->link = $last_version_check['link'];
if (isset($last_version_check['autoupgrade']))
$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['md5']))
$this->md5 = $last_version_check['md5'];
if (isset($last_version_check['desc']))
$this->desc = $last_version_check['desc'];
if (isset($last_version_check['changelog']))
$this->changelog = $last_version_check['changelog'];
}
$this->loadFromConfig();
}
// retro-compatibility :
// return array(name,link) if you don't use the last version
@@ -162,6 +153,41 @@ class UpgraderCore
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']))
$this->version_num = $last_version_check['num'];
if (isset($last_version_check['link']))
$this->link = $last_version_check['link'];
if (isset($last_version_check['autoupgrade']))
$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['md5']))
$this->md5 = $last_version_check['md5'];
if (isset($last_version_check['desc']))
$this->desc = $last_version_check['desc'];
if (isset($last_version_check['changelog']))
$this->changelog = $last_version_check['changelog'];
}
return $this;
}
/**
* 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)