Fix copy of templates during activation of module

This commit is contained in:
Laurent Destailleur
2019-08-15 01:50:01 +02:00
parent f81463af0c
commit bb35d9be0c
3 changed files with 21 additions and 1 deletions

View File

@@ -158,7 +158,7 @@ class modWebsite extends DolibarrModules
// Remove permissions and default values
$this->remove($options);
// Copy flags and octicons directoru
// Copy flags and octicons directory
$dirarray=array('common/flags', 'common/octicons');
foreach($dirarray as $dir)
{
@@ -179,6 +179,26 @@ class modWebsite extends DolibarrModules
}
}
// Website templates
$srcroot=DOL_DOCUMENT_ROOT.'/install/doctemplates/websites';
$destroot=DOL_DATA_ROOT.'/doctemplates/websites';
dol_mkdir($destroot);
$docs=dol_dir_list($srcroot, 'files', 0, 'website_.*(\.zip|\.jpg)$');
foreach($docs as $cursorfile)
{
$src=$srcroot.'/'.$cursorfile['name'];
$dest=$destroot.'/'.$cursorfile['name'];
$result=dol_copy($src, $dest, 0, 0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
}
}
$sql = array();
return $this->_init($sql, $options);

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 KiB