Fix purge of log files was missing some log files.
This commit is contained in:
parent
33ceb22b8b
commit
a487492a7a
@ -47,7 +47,7 @@ class Utils
|
|||||||
* Purge files into directory of data files.
|
* Purge files into directory of data files.
|
||||||
* CAN BE A CRON TASK
|
* CAN BE A CRON TASK
|
||||||
*
|
*
|
||||||
* @param string $choice Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfiles')
|
* @param string $choice Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfile')
|
||||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||||
*/
|
*/
|
||||||
function purgeFiles($choice='tempfilesold')
|
function purgeFiles($choice='tempfilesold')
|
||||||
@ -81,7 +81,7 @@ class Utils
|
|||||||
|
|
||||||
if ($choice=='allfiles')
|
if ($choice=='allfiles')
|
||||||
{
|
{
|
||||||
// Delete all files
|
// Delete all files (except install.lock)
|
||||||
if ($dolibarr_main_data_root)
|
if ($dolibarr_main_data_root)
|
||||||
{
|
{
|
||||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
|
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
|
||||||
@ -90,15 +90,25 @@ class Utils
|
|||||||
|
|
||||||
if ($choice=='logfile')
|
if ($choice=='logfile')
|
||||||
{
|
{
|
||||||
// Define filelog to discard it from purge
|
// Define files log
|
||||||
|
if ($dolibarr_main_data_root)
|
||||||
|
{
|
||||||
|
$filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log$', 'install\.lock$');
|
||||||
|
}
|
||||||
|
|
||||||
$filelog='';
|
$filelog='';
|
||||||
if (! empty($conf->syslog->enabled))
|
if (! empty($conf->syslog->enabled))
|
||||||
{
|
{
|
||||||
$filelog=$conf->global->SYSLOG_FILE;
|
$filelog=$conf->global->SYSLOG_FILE;
|
||||||
$filelog=preg_replace('/DOL_DATA_ROOT/i',DOL_DATA_ROOT,$filelog);
|
$filelog=preg_replace('/DOL_DATA_ROOT/i',DOL_DATA_ROOT,$filelog);
|
||||||
}
|
|
||||||
|
|
||||||
$filesarray[]=array('fullname'=>$filelog,'type'=>'file');
|
$alreadyincluded=false;
|
||||||
|
foreach ($filesarray as $tmpcursor)
|
||||||
|
{
|
||||||
|
if ($tmpcursor['fullname'] == $filelog) { $alreadyincluded=true; }
|
||||||
|
}
|
||||||
|
if (! $alreadyincluded) $filesarray[]=array('fullname'=>$filelog,'type'=>'file');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$count=0;
|
$count=0;
|
||||||
|
|||||||
@ -140,7 +140,7 @@ SystemToolsArea=System tools area
|
|||||||
SystemToolsAreaDesc=This area provides administration features. Use the menu to choose the feature you're looking for.
|
SystemToolsAreaDesc=This area provides administration features. Use the menu to choose the feature you're looking for.
|
||||||
Purge=Purge
|
Purge=Purge
|
||||||
PurgeAreaDesc=This page allows you to delete all files generated or stored by Dolibarr (temporary files or all files in <b>%s</b> directory). Using this feature is not necessary. It is provided as a workaround for users whose Dolibarr is hosted by a provider that does not offer permissions to delete files generated by the web server.
|
PurgeAreaDesc=This page allows you to delete all files generated or stored by Dolibarr (temporary files or all files in <b>%s</b> directory). Using this feature is not necessary. It is provided as a workaround for users whose Dolibarr is hosted by a provider that does not offer permissions to delete files generated by the web server.
|
||||||
PurgeDeleteLogFile=Delete log file <b>%s</b> defined for Syslog module (no risk of losing data)
|
PurgeDeleteLogFile=Delete log files, including <b>%s</b> defined for Syslog module (no risk of losing data)
|
||||||
PurgeDeleteTemporaryFiles=Delete all temporary files (no risk of losing data)
|
PurgeDeleteTemporaryFiles=Delete all temporary files (no risk of losing data)
|
||||||
PurgeDeleteTemporaryFilesShort=Delete temporary files
|
PurgeDeleteTemporaryFilesShort=Delete temporary files
|
||||||
PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory <b>%s</b>. Temporary files but also database backup dumps, files attached to elements (third parties, invoices, ...) and uploaded into the ECM module will be deleted.
|
PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory <b>%s</b>. Temporary files but also database backup dumps, files attached to elements (third parties, invoices, ...) and uploaded into the ECM module will be deleted.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user