diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php
index 3462212ee25..e558e4ee545 100644
--- a/htdocs/core/lib/website2.lib.php
+++ b/htdocs/core/lib/website2.lib.php
@@ -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;
}
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index 0c90b499bed..1f2212668f7 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -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)
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 3979dc90fbe..30937b74c34 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -2429,15 +2429,17 @@ if (!GETPOST('hide_websitemenu'))
//print '';
print '';
+
print '';
print '';
+ // Regenerate all pages
+ print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">';
+
print ' ';
print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">';
-
- print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">';
}
print '';