// Another fix for installation with safe_mode

This commit is contained in:
Rémi Gaillard committed 2013-03-22 15:20:40 +01:00
1 parent 36d2e58a90
commit ecf433b9b8
3 files changed
+14 -7

No files matched your search

+6 -3
View File
@@ -190,11 +190,14 @@ class LanguageCore extends ObjectModel
return $themes; return $themes;
} }
public function add($autodate = true, $nullValues = false) public function add($autodate = true, $nullValues = false, $only_add = false)
{ {
if (!parent::add($autodate)) if (!parent::add($autodate))
return false; return false;
if ($only_add)
return true;
// create empty files if they not exists // create empty files if they not exists
$this->_generateFiles(); $this->_generateFiles();
@@ -681,7 +684,7 @@ class LanguageCore extends ObjectModel
return Tools::generateHtaccess(); 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)) if (Language::getIdByIso($iso_code))
return true; return true;
@@ -703,7 +706,7 @@ class LanguageCore extends ObjectModel
else else
return false; return false;
if (!$lang->add()) if (!$lang->add(true, false, $only_add))
return false; return false;
$flag = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/flags/jpeg/'.$iso_code.'.jpg'); $flag = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/flags/jpeg/'.$iso_code.'.jpg');
+1
View File
@@ -53,6 +53,7 @@ class TranslateCore
$iso = Context::getContext()->language->iso_code; $iso = Context::getContext()->language->iso_code;
if (empty($iso)) if (empty($iso))
$iso = Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT'))); $iso = Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT')));
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'))
include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
} }
+7 -4
View File
@@ -307,7 +307,11 @@ class InstallModelInstall extends InstallAbstractModel
if (!$xml = @simplexml_load_file(_PS_INSTALL_LANGS_PATH_.$iso.'/language.xml')) 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)); throw new PrestashopInstallerException($this->language->l('File "language.xml" not valid for language iso "%s"', $iso));
if (InstallSession::getInstance()->safe_mode)
Language::checkAndAddLanguage($iso, false, true);
else
Language::downloadAndInstallLanguagePack($iso, _PS_INSTALL_VERSION_); Language::downloadAndInstallLanguagePack($iso, _PS_INSTALL_VERSION_);
if (!$id_lang = Language::getIdByIso($iso)) if (!$id_lang = Language::getIdByIso($iso))
throw new PrestashopInstallerException($this->language->l('Cannot install language "%s"', ($xml->name) ? $xml->name : $iso)); throw new PrestashopInstallerException($this->language->l('Cannot install language "%s"', ($xml->name) ? $xml->name : $iso));
$languages[$id_lang] = $iso; $languages[$id_lang] = $iso;
@@ -601,10 +605,9 @@ class InstallModelInstall extends InstallAbstractModel
*/ */
public function installModules($module = null) public function installModules($module = null)
{ {
if (InstallSession::getInstance()->safe_mode)
return true;
$modules = $module ? array($module) : $this->getModulesList(); $modules = $module ? array($module) : $this->getModulesList();
if (!InstallSession::getInstance()->safe_mode)
{
$addons_modules = $this->getAddonsModulesList(); $addons_modules = $this->getAddonsModulesList();
foreach($addons_modules as $addons_module) foreach($addons_modules as $addons_module)
@@ -614,7 +617,7 @@ class InstallModelInstall extends InstallAbstractModel
$modules[] = (string)$addons_module['name'];//if the module has been unziped we add the name in the modules list to install $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'); unlink(_PS_MODULE_DIR_.$addons_module['name'].'.zip');
} }
}
$errors = array(); $errors = array();
foreach ($modules as $module_name) foreach ($modules as $module_name)
{ {