FIX save of empty files

This commit is contained in:
Laurent Destailleur 2019-08-16 02:31:06 +02:00
parent d70e6e4e9a
commit 08038e5078
3 changed files with 13 additions and 7 deletions

View File

@ -61,7 +61,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
global $conf;
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
dol_syslog("We regenerate the alias page filealias=".$filealias);
dol_syslog("dolSavePageAlias We regenerate the alias page filealias=".$filealias);
$aliascontent = '<?php'."\n";
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";

View File

@ -1086,12 +1086,15 @@ class Website extends CommonObject
dolSavePageContent($filetpl, $object, $objectpagestatic);
// Regenerate alternative aliases pages
foreach($aliasesarray as $aliasshortcuttocreate)
if (is_array($aliasesarray))
{
if (trim($aliasshortcuttocreate))
foreach($aliasesarray as $aliasshortcuttocreate)
{
$filealias=$conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php';
dolSavePageAlias($filealias, $object, $objectpagestatic);
if (trim($aliasshortcuttocreate))
{
$filealias=$conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php';
dolSavePageAlias($filealias, $object, $objectpagestatic);
}
}
}
}

View File

@ -1393,8 +1393,11 @@ if ($action == 'updatemeta')
{
foreach($tmpaltaliases as $tmpaliasalt)
{
$result=dolSavePageAlias($pathofwebsite.'/'.trim($tmpaliasalt).'.php', $object, $objectpage);
if (! $result) setEventMessages('Failed to write file '.$pathofwebsite.'/'.trim($tmpaliasalt).'.php', null, 'errors');
if (trim($tmpaliasalt))
{
$result=dolSavePageAlias($pathofwebsite.'/'.trim($tmpaliasalt).'.php', $object, $objectpage);
if (! $result) setEventMessages('Failed to write file '.$pathofwebsite.'/'.trim($tmpaliasalt).'.php', null, 'errors');
}
}
}
}