Browse files

//fix install bug when no internet connection

  • Loading branch information...
1 parent 65ef8c7 commit 016cdc16851ce3efa06f00929ccec9ba25173f0b @vAugagneur vAugagneur committed Mar 26, 2013
Showing with 13 additions and 6 deletions.
  1. +9 −4 classes/Language.php
  2. +4 −2 install-dev/models/install.php
View
13 classes/Language.php
@@ -684,7 +684,7 @@ public function update($nullValues = false)
return Tools::generateHtaccess();
}
- public static function checkAndAddLanguage($iso_code, $lang_pack = false, $only_add = false)
+ public static function checkAndAddLanguage($iso_code, $lang_pack = false, $only_add = false, $params_lang = null)
{
if (Language::getIdByIso($iso_code))
return true;
@@ -703,6 +703,11 @@ public static function checkAndAddLanguage($iso_code, $lang_pack = false, $only_
&& isset($lang_pack->iso_code))
$lang->name = $lang_pack->name;
}
+ elseif ($params_lang !== null && is_array($params_lang))
+ {
+ foreach ($params_lang as $key => $value)
+ $lang->$key = $value;
+ }
else
return false;
@@ -770,7 +775,7 @@ public static function countActiveLanguages()
return self::$countActiveLanguages;
}
- public static function downloadAndInstallLanguagePack($iso, $version = null)
+ public static function downloadAndInstallLanguagePack($iso, $version = null, $params = null)
{
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
@@ -779,7 +784,7 @@ public static function downloadAndInstallLanguagePack($iso, $version = null)
if ($version == null)
$version = _PS_VERSION_;
-
+ $lang_pack = false;
$lang_pack_ok = false;
$errors = array();
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
@@ -801,7 +806,7 @@ public static function downloadAndInstallLanguagePack($iso, $version = null)
AdminTranslationsController::checkAndAddMailsFiles($iso, $files_list);
AdminTranslationsController::addNewTabs($iso, $files_list);
}
- if (!Language::checkAndAddLanguage((string)$iso, $lang_pack))
+ if (!Language::checkAndAddLanguage((string)$iso, $lang_pack, false, $params))
$errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$iso;
@unlink($file);
}
View
6 install-dev/models/install.php
@@ -306,11 +306,13 @@ public function installLanguages($languages_list = null)
if (!$xml = @simplexml_load_file(_PS_INSTALL_LANGS_PATH_.$iso.'/language.xml'))
throw new PrestashopInstallerException($this->language->l('File "language.xml" not valid for language iso "%s"', $iso));
+
+ $params_lang = array('name' => (string)$xml->name, 'iso_code' => (string)$xml->language_code);
if (InstallSession::getInstance()->safe_mode)
- Language::checkAndAddLanguage($iso, false, true);
+ Language::checkAndAddLanguage($iso, false, true, $params_lang);
else
- Language::downloadAndInstallLanguagePack($iso, _PS_INSTALL_VERSION_);
+ Language::downloadAndInstallLanguagePack($iso, _PS_INSTALL_VERSION_, $params_lang);
if (!$id_lang = Language::getIdByIso($iso))
throw new PrestashopInstallerException($this->language->l('Cannot install language "%s"', ($xml->name) ? $xml->name : $iso));

0 comments on commit 016cdc1

Please sign in to comment.