Prestashop:调用未定义的方法 Language::updateModulesTranslations()
Prestashop: Call to undefined method Language::updateModulesTranslations()
在我的自定义模块(例如示例模块名称)中安装时出现了这个致命错误。如何解决此错误任何人都可以帮助我。
Fatal error: Call to undefined method
Language::updateModulesTranslations() in /var/www/html/sf_prestashop/shop/classes/module/Module.php on line 292
请检查/classes/Language.php中的Language class,必须有一个名为'updateModulesTranslations'的函数,如果没有请在里面添加以下函数语言 class:
public static function updateModulesTranslations(Array $modules_list)
{
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
$languages = Language::getLanguages(false);
foreach ($languages as $lang) {
$gz = false;
$files_listing = array();
foreach ($modules_list as $module_name) {
$filegz = _PS_TRANSLATIONS_DIR_.$lang['iso_code'].'.gzip';
clearstatcache();
if (@filemtime($filegz) < (time() - (24 * 3600))) {
if (Language::downloadAndInstallLanguagePack($lang['iso_code'], null, null, false) !== true) {
break;
}
}
$gz = new Archive_Tar($filegz, true);
$files_list = Language::getLanguagePackListContent($lang['iso_code'], $gz);
foreach ($files_list as $i => $file) {
if (strpos($file['filename'], 'modules/'.$module_name.'/') !== 0) {
unset($files_list[$i]);
}
}
foreach ($files_list as $file) {
if (isset($file['filename']) && is_string($file['filename'])) {
$files_listing[] = $file['filename'];
}
}
}
if ($gz) {
$gz->extractList($files_listing, _PS_TRANSLATIONS_DIR_.'../', '');
}
}
}
在我的自定义模块(例如示例模块名称)中安装时出现了这个致命错误。如何解决此错误任何人都可以帮助我。
Fatal error: Call to undefined method Language::updateModulesTranslations() in /var/www/html/sf_prestashop/shop/classes/module/Module.php on line 292
请检查/classes/Language.php中的Language class,必须有一个名为'updateModulesTranslations'的函数,如果没有请在里面添加以下函数语言 class:
public static function updateModulesTranslations(Array $modules_list)
{
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
$languages = Language::getLanguages(false);
foreach ($languages as $lang) {
$gz = false;
$files_listing = array();
foreach ($modules_list as $module_name) {
$filegz = _PS_TRANSLATIONS_DIR_.$lang['iso_code'].'.gzip';
clearstatcache();
if (@filemtime($filegz) < (time() - (24 * 3600))) {
if (Language::downloadAndInstallLanguagePack($lang['iso_code'], null, null, false) !== true) {
break;
}
}
$gz = new Archive_Tar($filegz, true);
$files_list = Language::getLanguagePackListContent($lang['iso_code'], $gz);
foreach ($files_list as $i => $file) {
if (strpos($file['filename'], 'modules/'.$module_name.'/') !== 0) {
unset($files_list[$i]);
}
}
foreach ($files_list as $file) {
if (isset($file['filename']) && is_string($file['filename'])) {
$files_listing[] = $file['filename'];
}
}
}
if ($gz) {
$gz->extractList($files_listing, _PS_TRANSLATIONS_DIR_.'../', '');
}
}
}