Code comment

This commit is contained in:
Laurent Destailleur 2021-01-24 13:27:52 +01:00
parent 0203965fbf
commit d9908efdef
3 changed files with 17 additions and 10 deletions

View File

@ -52,8 +52,8 @@ function dolSaveMasterFile($filemaster)
}
/**
* Save content of a page on disk.
* It can save file into root directory or into language subdirectory.
* Save an alias page on disk (A page that include the reference page).
* It saves file into the root directory but also into language subdirectory.
*
* @param string $filealias Full path of filename to generate
* @param Website $object Object website
@ -82,7 +82,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
}
// Save also alias into language subdirectory if we have to
// Save also alias into language subdirectory if it is not a main language
if ($objectpage->lang && in_array($objectpage->lang, explode(',', $object->otherlang))) {
$dirname = dirname($filealias);
$filename = basename($filealias);
@ -103,13 +103,16 @@ function dolSavePageAlias($filealias, $object, $objectpage)
}
}
// Save also alias into all language subdirectories if it is a main language
// TODO
return ($result ?true:false);
}
/**
* Save content of a page on disk.
* Page contents are always saved into root directory.
* Save content of a page on disk (page name is generally ID_of_page.php).
* Page contents are always saved into "root" directory. Only aliases pages saved with dolSavePageAlias() can be in root or language subdir.
*
* @param string $filetpl Full path of filename to generate
* @param Website $object Object website
@ -230,10 +233,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
//var_dump($filetpl);exit;
$result = file_put_contents($filetpl, $tplcontent);
if (!empty($conf->global->MAIN_UMASK))
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
}
return $result;
return $result;
}

View File

@ -1316,6 +1316,7 @@ class Website extends CommonObject
$num = $this->db->num_rows($resql);
// Loop on each container/page
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
@ -1333,7 +1334,7 @@ class Website extends CommonObject
$error++;
}
// Regenerate alternative aliases pages
// Regenerate aliases pages (pages with a natural name)
if (is_array($aliasesarray))
{
foreach ($aliasesarray as $aliasshortcuttocreate)

View File

@ -2429,15 +2429,17 @@ if (!GETPOST('hide_websitemenu'))
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($exportlabel).'" name="exportsite">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
print '<input type="submit" class="buttonDelete bordertransp" name="deletesite" value="'.$langs->trans("Delete").'"'.($atleastonepage ? ' disabled="disabled"' : '').'>';
// Regenerate all pages
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=regeneratesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="fa fa-cogs"><span></a>';
print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=replacesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"><span></a>';
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=regeneratesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="fa fa-cogs"><span></a>';
}
print '</span>';