fix(prestashop): image edubox-prestashop fonctionne en local et derrière proxy
- edubox-tools.patch : getShopDomain/Ssl conservent les ports non standards - edubox-configuration.patch : PS_SHOP_DOMAIN, _PS_BASE_URL_, PS_SSL_ENABLED… résolus dynamiquement - edubox-shop-getbaseurl.patch : Shop::getBaseURL() utilise le host de la requête - edubox-shopurl.patch : getMainShopDomain conserve les ports non standards - edubox-clear-cache-init.sh : vidage des caches à chaque démarrage - seed.ts : passage au tag 9-edubox-9 - README mis à jour avec les nouveaux patches
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
--- a/classes/Language.php
|
||||
+++ b/classes/Language.php
|
||||
@@ -1235,6 +1235,12 @@
|
||||
*/
|
||||
public static function downloadXLFLanguagePack($locale, &$errors = [], $type = self::PACK_TYPE_SYMFONY)
|
||||
{
|
||||
+ // EduBox: if the translation pack is already present in the image,
|
||||
+ // do not try to download it (agents may be offline).
|
||||
+ if (static::translationPackIsInCache($locale, $type)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
$file = self::getPathToCachedTranslationPack($locale, $type);
|
||||
$url = (self::PACK_TYPE_EMAILS === $type) ? self::EMAILS_LANGUAGE_PACK_URL : self::SF_LANGUAGE_PACK_URL;
|
||||
$url = str_replace(
|
||||
@@ -1697,7 +1703,9 @@
|
||||
*/
|
||||
public static function translationPackIsInCache(string $locale, string $type = self::PACK_TYPE_SYMFONY): bool
|
||||
{
|
||||
- return file_exists(self::getPathToCachedTranslationPack($locale, $type));
|
||||
+ // EduBox: use runtime constant instead of class constant, because
|
||||
+ // _PS_TRANSLATIONS_DIR_ may not be defined when this file is compiled.
|
||||
+ return file_exists(_PS_TRANSLATIONS_DIR_ . $type . '-' . $locale . '.zip');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1710,7 +1718,8 @@
|
||||
*/
|
||||
private static function getPathToCachedTranslationPack(string $locale, string $type = self::PACK_TYPE_SYMFONY): string
|
||||
{
|
||||
- return self::TRANSLATION_PACK_CACHE_DIR . $type . '-' . $locale . '.zip';
|
||||
+ // EduBox: use runtime constant instead of class constant.
|
||||
+ return _PS_TRANSLATIONS_DIR_ . $type . '-' . $locale . '.zip';
|
||||
}
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user