diff --git a/classes/Language.php b/classes/Language.php index d3edb9883..5cff87e0d 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -190,11 +190,14 @@ class LanguageCore extends ObjectModel return $themes; } - public function add($autodate = true, $nullValues = false) + public function add($autodate = true, $nullValues = false, $only_add = false) { if (!parent::add($autodate)) return false; + if ($only_add) + return true; + // create empty files if they not exists $this->_generateFiles(); @@ -681,7 +684,7 @@ class LanguageCore extends ObjectModel return Tools::generateHtaccess(); } - public static function checkAndAddLanguage($iso_code, $lang_pack = false) + public static function checkAndAddLanguage($iso_code, $lang_pack = false, $only_add = false) { if (Language::getIdByIso($iso_code)) return true; @@ -703,7 +706,7 @@ class LanguageCore extends ObjectModel else return false; - if (!$lang->add()) + if (!$lang->add(true, false, $only_add)) return false; $flag = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/flags/jpeg/'.$iso_code.'.jpg'); diff --git a/classes/Translate.php b/classes/Translate.php index cd4ae4214..c98be204f 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -53,7 +53,8 @@ class TranslateCore $iso = Context::getContext()->language->iso_code; if (empty($iso)) $iso = Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT'))); - include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); + if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php')) + include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); } if (isset($modules_tabs[strtolower($class)])) diff --git a/install-dev/models/install.php b/install-dev/models/install.php index 036fc3980..dd268f93f 100644 --- a/install-dev/models/install.php +++ b/install-dev/models/install.php @@ -307,7 +307,11 @@ class InstallModelInstall extends InstallAbstractModel 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)); - Language::downloadAndInstallLanguagePack($iso, _PS_INSTALL_VERSION_); + if (InstallSession::getInstance()->safe_mode) + Language::checkAndAddLanguage($iso, false, true); + else + Language::downloadAndInstallLanguagePack($iso, _PS_INSTALL_VERSION_); + if (!$id_lang = Language::getIdByIso($iso)) throw new PrestashopInstallerException($this->language->l('Cannot install language "%s"', ($xml->name) ? $xml->name : $iso)); $languages[$id_lang] = $iso; @@ -601,20 +605,19 @@ class InstallModelInstall extends InstallAbstractModel */ public function installModules($module = null) { - if (InstallSession::getInstance()->safe_mode) - return true; - $modules = $module ? array($module) : $this->getModulesList(); - $addons_modules = $this->getAddonsModulesList(); - - foreach($addons_modules as $addons_module) - if (file_put_contents(_PS_MODULE_DIR_.$addons_module['name'].'.zip', Tools::addonsRequest('module', array('id_module' => $addons_module['id_module'])))) - if (Tools::ZipExtract(_PS_MODULE_DIR_.$addons_module['name'].'.zip', _PS_MODULE_DIR_)) - { - $modules[] = (string)$addons_module['name'];//if the module has been unziped we add the name in the modules list to install - unlink(_PS_MODULE_DIR_.$addons_module['name'].'.zip'); - } - + if (!InstallSession::getInstance()->safe_mode) + { + $addons_modules = $this->getAddonsModulesList(); + + foreach($addons_modules as $addons_module) + if (file_put_contents(_PS_MODULE_DIR_.$addons_module['name'].'.zip', Tools::addonsRequest('module', array('id_module' => $addons_module['id_module'])))) + if (Tools::ZipExtract(_PS_MODULE_DIR_.$addons_module['name'].'.zip', _PS_MODULE_DIR_)) + { + $modules[] = (string)$addons_module['name'];//if the module has been unziped we add the name in the modules list to install + unlink(_PS_MODULE_DIR_.$addons_module['name'].'.zip'); + } + } $errors = array(); foreach ($modules as $module_name) {