Fix files generated
This commit is contained in:
parent
d2c6c7ddff
commit
b0be1ddadb
@ -542,9 +542,7 @@ function dolSaveMasterFile($filemaster)
|
|||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
|
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
return $result;
|
||||||
|
|
||||||
return ($result?true:false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -618,7 +616,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
|
|||||||
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
||||||
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
||||||
$tplcontent.= '<!-- Include HTML header from common file -->'."\n";
|
$tplcontent.= '<!-- Include HTML header from common file -->'."\n";
|
||||||
$tplcontent.= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/'.$object->ref.'/htmlheader.html")); ?>'."\n";
|
$tplcontent.= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n";
|
||||||
$tplcontent.= '<!-- Include HTML header from page header block -->'."\n";
|
$tplcontent.= '<!-- Include HTML header from page header block -->'."\n";
|
||||||
$tplcontent.= preg_replace('/<\/?html>/ims', '', $objectpage->htmlheader)."\n";
|
$tplcontent.= preg_replace('/<\/?html>/ims', '', $objectpage->htmlheader)."\n";
|
||||||
$tplcontent.= '</head>'."\n";
|
$tplcontent.= '</head>'."\n";
|
||||||
|
|||||||
@ -974,6 +974,11 @@ class Website extends CommonObject
|
|||||||
// Now generate the master.inc.php page
|
// Now generate the master.inc.php page
|
||||||
$filemaster=$conf->website->dir_output.'/'.$object->ref.'/master.inc.php';
|
$filemaster=$conf->website->dir_output.'/'.$object->ref.'/master.inc.php';
|
||||||
dolSaveMasterFile($filemaster);
|
dolSaveMasterFile($filemaster);
|
||||||
|
if (! $result)
|
||||||
|
{
|
||||||
|
$this->errors[]='Failed to write file '.$filemaster;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
||||||
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
||||||
@ -999,7 +1004,7 @@ class Website extends CommonObject
|
|||||||
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1);
|
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1);
|
||||||
if ($runsql <= 0)
|
if ($runsql <= 0)
|
||||||
{
|
{
|
||||||
$this->errors[]='Failed to load sql file '.$sqlfile.'.';
|
$this->errors[]='Failed to load sql file '.$sqlfile;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1134,7 +1134,8 @@ if ($action == 'updatemeta')
|
|||||||
|
|
||||||
|
|
||||||
// Now generate the master.inc.php page
|
// Now generate the master.inc.php page
|
||||||
dolSaveMasterFile($filemaster);
|
$result = dolSaveMasterFile($filemaster);
|
||||||
|
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
||||||
|
|
||||||
// Now delete the alias.php page
|
// Now delete the alias.php page
|
||||||
if (! empty($fileoldalias))
|
if (! empty($fileoldalias))
|
||||||
@ -1321,16 +1322,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
|
|||||||
|
|
||||||
|
|
||||||
// Now generate the master.inc.php page
|
// Now generate the master.inc.php page
|
||||||
dol_syslog("We regenerate the master file");
|
$result = dolSaveMasterFile($filemaster);
|
||||||
dol_delete_file($filemaster);
|
|
||||||
|
|
||||||
$mastercontent = '<?php'."\n";
|
|
||||||
$mastercontent.= '// File generated to link to the master file'."\n";
|
|
||||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
|
||||||
$mastercontent.= '?>'."\n";
|
|
||||||
$result = file_put_contents($filemaster, $mastercontent);
|
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
|
||||||
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
|
|
||||||
|
|
||||||
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user