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; global $conf;
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header) // 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 = '<?php'."\n";
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n"; $aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";

View File

@ -1086,6 +1086,8 @@ class Website extends CommonObject
dolSavePageContent($filetpl, $object, $objectpagestatic); dolSavePageContent($filetpl, $object, $objectpagestatic);
// Regenerate alternative aliases pages // Regenerate alternative aliases pages
if (is_array($aliasesarray))
{
foreach($aliasesarray as $aliasshortcuttocreate) foreach($aliasesarray as $aliasshortcuttocreate)
{ {
if (trim($aliasshortcuttocreate)) if (trim($aliasshortcuttocreate))
@ -1097,6 +1099,7 @@ class Website extends CommonObject
} }
} }
} }
}
// Regenerate index page to point to new index page // Regenerate index page to point to new index page
$pathofwebsite = $conf->website->dir_output.'/'.$object->ref; $pathofwebsite = $conf->website->dir_output.'/'.$object->ref;

View File

@ -1392,12 +1392,15 @@ if ($action == 'updatemeta')
if (is_array($tmpaltaliases)) if (is_array($tmpaltaliases))
{ {
foreach($tmpaltaliases as $tmpaliasalt) foreach($tmpaltaliases as $tmpaliasalt)
{
if (trim($tmpaliasalt))
{ {
$result=dolSavePageAlias($pathofwebsite.'/'.trim($tmpaliasalt).'.php', $object, $objectpage); $result=dolSavePageAlias($pathofwebsite.'/'.trim($tmpaliasalt).'.php', $object, $objectpage);
if (! $result) setEventMessages('Failed to write file '.$pathofwebsite.'/'.trim($tmpaliasalt).'.php', null, 'errors'); if (! $result) setEventMessages('Failed to write file '.$pathofwebsite.'/'.trim($tmpaliasalt).'.php', null, 'errors');
} }
} }
} }
}
// Save page of content // Save page of content