Permalink
Browse files

[*] MO : New version for autoupgrade, update languages after 1.5.4.0 …

…upgrade and del class_index.php
  • Loading branch information...
1 parent 5b57d46 commit b0b8ad7b09bf31726d1a4ef038faa0f8e38892bc @gRoussac gRoussac committed Mar 27, 2013
Showing with 38 additions and 3 deletions.
  1. +36 −1 autoupgrade/AdminSelfUpgrade.php
  2. +1 −1 autoupgrade/autoupgrade.php
  3. +1 −1 autoupgrade/config.xml
@@ -901,6 +901,40 @@ public function ajaxProcessRollbackComplete()
*/
public function ajaxProcessUpgradeComplete()
{
+ if (version_compare($this->install_version, '1.5.4.0', '>='))
+ {
+ // Upgrade languages
+ if (!defined('_PS_TOOL_DIR_'))
+ define('_PS_TOOL_DIR_', _PS_ROOT_DIR_.'/tools/');
+ if (!defined('_PS_TRANSLATIONS_DIR_'))
+ define('_PS_TRANSLATIONS_DIR_', _PS_ROOT_DIR_.'/translations/');
+ if (!defined('_PS_MODULES_DIR_'))
+ define('_PS_MODULES_DIR_', _PS_ROOT_DIR_.'/modules/');
+ if (!defined('_PS_MAILS_DIR_'))
+ define('_PS_MAILS_DIR_', _PS_ROOT_DIR_.'/mails/');
+ $langs = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'lang WHERE active=1');
+ require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
+ foreach ($langs as $lang)
+ {
+ $lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$this->install_version.'&iso_lang='.$lang['iso_code']));
+ if (!$lang_pack)
+ continue;
+ elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$lang['iso_code'].'.gzip'))
+ {
+ $file = _PS_TRANSLATIONS_DIR_.$lang['iso_code'].'.gzip';
+ if ((bool)@file_put_contents($file, $content))
+ {
+ $gz = new Archive_Tar($file, true);
+ $files_list = $gz->listContent();
+ if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
+ continue;
+ }
+ }
+ }
+ // Remove class_index Autoload cache
+ @unlink(_PS_ROOT_DIR_.'/cache/class_index.php');
+ }
+
if (!$this->warning_exists)
$this->next_desc = $this->l('Upgrade process done. Congratulations ! You can now reactive your shop.');
else
@@ -1690,7 +1724,8 @@ public function _listModulesToUpgrade()
if(is_array($this->modules_addons))
$id_addons = array_search($module_name, $this->modules_addons);
if (isset($id_addons) && $id_addons)
- $list[] = array('id' => $id_addons, 'name' => $module_name);
+ if ($module_name != 'autoupgrade')
+ $list[] = array('id' => $id_addons, 'name' => $module_name);
}
}
file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->toUpgradeModuleList,serialize($list));
@@ -30,7 +30,7 @@ public function __construct()
{
$this->name = 'autoupgrade';
$this->tab = 'administration';
- $this->version = '1.0.12';
+ $this->version = '1.0.13';
if (version_compare(_PS_VERSION_, '1.5.0.0 ', '>='))
$this->multishop_context = Shop::CONTEXT_ALL;
View
@@ -2,7 +2,7 @@
<module>
<name>autoupgrade</name>
<displayName><![CDATA[1-click Upgrade]]></displayName>
- <version><![CDATA[1.0.12]]></version>
+ <version><![CDATA[1.0.13]]></version>
<description><![CDATA[Provides an automated method to upgrade your shop to the last PrestaShop version. Caution : This module requires right of writing in your prestashop directory. Custom theme are not updated.]]></description>
<author><![CDATA[]]></author>
<tab><![CDATA[administration]]></tab>

0 comments on commit b0b8ad7

Please sign in to comment.