diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 33093fb953c..776c535d586 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -229,11 +229,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) /** - * Save content of the index.php and wrapper.php page + * Save content of the index.php and/or wrapper.php page * * @param string $pathofwebsite Path of website root * @param string $fileindex Full path of file index.php - * @param string $filetpl File tpl to index.php page redirect to + * @param string $filetpl File tpl the index.php page redirect to * @param string $filewrapper Full path of file wrapper.php * @return boolean True if OK */ @@ -246,29 +246,39 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper) dol_mkdir($pathofwebsite); - dol_delete_file($fileindex); - $indexcontent = ''."\n"; - $result1 = file_put_contents($fileindex, $indexcontent); - if (!empty($conf->global->MAIN_UMASK)) { - @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); + if ($fileindex) { + dol_delete_file($fileindex); + $indexcontent = ''."\n"; + + $result1 = file_put_contents($fileindex, $indexcontent); + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); + } + } + else { + $result1 = true; } - dol_delete_file($filewrapper); - $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php'); + if ($filewrapper) { + dol_delete_file($filewrapper); + $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php'); - $result2 = file_put_contents($filewrapper, $wrappercontent); - if (!empty($conf->global->MAIN_UMASK)) { - @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); + $result2 = file_put_contents($filewrapper, $wrappercontent); + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); + } + } else { + $result2 = true; } return ($result1 && $result2); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b6d2404de6f..eefebd0e652 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -197,6 +197,7 @@ $fileindex = $pathofwebsite.'/index.php'; $filewrapper = $pathofwebsite.'/wrapper.php'; $filemanifestjson = $pathofwebsite.'/manifest.json.php'; $filereadme = $pathofwebsite.'/README.md'; +$filemaster = $pathofwebsite.'/master.inc.php'; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -1189,8 +1190,6 @@ if ($action == 'updatecss') if (!$error) { // Save master.inc.php file - $filemaster = $pathofwebsite.'/master.inc.php'; - dol_syslog("Save master file ".$filemaster); dol_mkdir($pathofwebsite); @@ -1384,6 +1383,10 @@ if ($action == 'updatecss') } + // Save wrapper.php + $result = dolSaveIndexPage($pathofwebsite, '', '', $filewrapper); + + // Message if no error if (!$error) { @@ -1727,8 +1730,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf } else { - $fileindex = $pathofwebsitenew.'/index.php'; $filetpl = $pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php'; + $fileindex = $pathofwebsitenew.'/index.php'; $filewrapper = $pathofwebsitenew.'/wrapper.php'; //var_dump($pathofwebsitenew);