Enhance regeneration of pages
This commit is contained in:
parent
245453f3c6
commit
26cb59e2f9
@ -2060,6 +2060,19 @@ if ($action == 'exportsite') {
|
|||||||
|
|
||||||
// Regenerate site
|
// Regenerate site
|
||||||
if ($action == 'regeneratesite') {
|
if ($action == 'regeneratesite') {
|
||||||
|
// Check symlink to medias and restore it if ko. Recreate also dir of website if not found.
|
||||||
|
$pathtomedias = DOL_DATA_ROOT.'/medias';
|
||||||
|
$pathtomediasinwebsite = $pathofwebsite.'/medias';
|
||||||
|
if (!is_link(dol_osencode($pathtomediasinwebsite))) {
|
||||||
|
dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite);
|
||||||
|
dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists
|
||||||
|
$result = symlink($pathtomedias, $pathtomediasinwebsite);
|
||||||
|
if (!$result) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors');
|
||||||
|
$action = 'importsite';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = $object->rebuildWebSiteFiles();
|
$result = $object->rebuildWebSiteFiles();
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
setEventMessages($langs->trans("PagesRegenerated", $result), null, 'mesgs');
|
setEventMessages($langs->trans("PagesRegenerated", $result), null, 'mesgs');
|
||||||
@ -2077,7 +2090,7 @@ if ($action == 'importsiteconfirm') {
|
|||||||
$action = 'importsite';
|
$action = 'importsite';
|
||||||
} else {
|
} else {
|
||||||
if (!empty($_FILES) || GETPOSTISSET('templateuserfile')) {
|
if (!empty($_FILES) || GETPOSTISSET('templateuserfile')) {
|
||||||
// Check symlink to medias and restore it if ko
|
// Check symlink to medias and restore it if ko. Recreate also dir of website if not found.
|
||||||
$pathtomedias = DOL_DATA_ROOT.'/medias';
|
$pathtomedias = DOL_DATA_ROOT.'/medias';
|
||||||
$pathtomediasinwebsite = $pathofwebsite.'/medias';
|
$pathtomediasinwebsite = $pathofwebsite.'/medias';
|
||||||
if (!is_link(dol_osencode($pathtomediasinwebsite))) {
|
if (!is_link(dol_osencode($pathtomediasinwebsite))) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user