fixes #1545 avoid fatal error during upgrade from 11 to 12

This commit is contained in:
plegall
2021-11-03 19:12:58 +01:00
parent c7214a33fb
commit 97fce5d251
2 changed files with 15 additions and 1 deletions

View File

@@ -545,9 +545,14 @@ class updates
self::process_obsolete_list($obsolete_list);
deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
invalidate_user_cache(true);
$template->delete_compiled_templates();
if ($step == 2)
{
// only delete compiled templates on minor update. Doing this on
// a major update might even encounter fatal error if Smarty
// changes. Anyway, a compiled template purge will be performed
// by upgrade.php
$template->delete_compiled_templates();
$page['infos'][] = l10n('Update Complete');
$page['infos'][] = $upgrade_to;
$step = -1;

View File

@@ -61,6 +61,15 @@ class Smarty_Internal_Undefined
if (isset($this->class)) {
throw new SmartyException("undefined extension class '{$this->class}'");
} else {
// Piwigo specifics - starts here
// when updating from Piwigo 11 to 12, we try to delete compiled templates and there is a mix old and new Smarty files, resulting in a:
// Fatal error: Uncaught --> Smarty: Smarty->_clearTemplateCache() undefined method
// indeed this method does not exist in Smarty 3.1.29 (Piwigo 11) but exists in Smarty 3.1.39 (Piwigo 12)
if ('_clearTemplateCache' == $name)
{
return;
}
// Piwigo specifics - stops here
throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
}
}