24if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
25 define(
'CSRFCHECK_WITH_TOKEN',
'1');
29require
'../../main.inc.php';
30include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
34$action =
GETPOST(
'action',
'aZ09');
35$confirm =
GETPOST(
'confirm',
'alpha');
36$choice =
GETPOST(
'choice',
'aZ09');
41if (isModEnabled(
'syslog')) {
43 $filelog = preg_replace(
'/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog);
56if ($action ==
'purge' && !preg_match(
'/^confirm/i', $choice) && ($choice !=
'allfiles' || $confirm ==
'yes')) {
59 if (!empty($ExecTimeLimit)) {
60 $err = error_reporting();
63 @set_time_limit($ExecTimeLimit);
64 error_reporting($err);
67 require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
68 $utils =
new Utils($db);
70 $result = $utils->purgeFiles($choice, $nbsecondsold);
72 $mesg = $utils->output;
87print
'<span class="opacitymedium">'.$langs->trans(
"PurgeAreaDesc", $dolibarr_main_data_root).
'</span><br>';
91print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
92print
'<input type="hidden" name="token" value="'.newToken().
'" />';
93print
'<input type="hidden" name="action" value="purge" />';
95print
'<table class="border centpercent">';
97print
'<tr class="border"><td style="padding: 4px">';
99if (isModEnabled(
'syslog')) {
100 print
'<input type="radio" name="choice" id="choicelogfile" value="logfile"';
101 print ($choice && $choice ==
'logfile') ?
' checked' :
'';
102 $filelogparam = $filelog;
103 if ($user->admin && preg_match(
'/^dolibarr.*\.log$/', basename($filelog))) {
104 $filelogparam =
'<a class="wordbreak" href="'.DOL_URL_ROOT.
'/document.php?modulepart=logs&file=';
105 $filelogparam .= basename($filelog);
106 $filelogparam .=
'">'.$filelog.
'</a>';
108 $desc = $langs->trans(
"PurgeDeleteLogFile",
'{filelogparam}');
109 $desc = str_replace(
'{filelogparam}', $filelogparam, $desc);
110 print
'> <label for="choicelogfile">'.$desc.
'</label>';
114print
'<input type="radio" name="choice" id="choicetempfiles" value="tempfiles"';
115print (!$choice || $choice ==
'tempfiles' || $choice ==
'allfiles') ?
' checked' :
'';
116print
'> <label for="choicetempfiles">'.$langs->trans(
"PurgeDeleteTemporaryFilesShort").
'</label><br><br>';
118print
'<input type="radio" name="choice" id="choiceallfiles" value="confirm_allfiles"';
119print ($choice && $choice ==
'confirm_allfiles') ?
' checked' :
'';
120print
'> <label for="choiceallfiles">'.$langs->trans(
"PurgeDeleteAllFilesInDocumentsDir", $dolibarr_main_data_root).
'</label>';
123 print
'NbSecondsOld = <input class="width50 right" type="text" name="nbsecondsold" value="'.$nbsecondsold.
'">';
125print
'</td></tr></table>';
130 print
'<div class="center"><input type="submit" class="button" value="'.$langs->trans(
"PurgeRunNow").
'"></div>';
135if (preg_match(
'/^confirm/i', $choice)) {
137 $formquestion = array();
138 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?choice=allfiles&nbsecondsold='.$nbsecondsold, $langs->trans(
'Purge'), $langs->trans(
'ConfirmPurge').img_warning().
' ',
'purge', $formquestion,
'no', 2);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage utility methods.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.