25if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
26 define(
'CSRFCHECK_WITH_TOKEN',
'1');
30require
'../../main.inc.php';
31include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
43$action =
GETPOST(
'action',
'aZ09');
44$confirm =
GETPOST(
'confirm',
'alpha');
45$choice =
GETPOST(
'choice',
'aZ09');
50if (isModEnabled(
'syslog')) {
52 $filelog = preg_replace(
'/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog);
65if ($action ==
'purge' && !preg_match(
'/^confirm/i', $choice) && ($choice !=
'allfiles' || $confirm ==
'yes')) {
68 if (!empty($ExecTimeLimit)) {
69 $err = error_reporting();
72 @set_time_limit($ExecTimeLimit);
73 error_reporting($err);
76 require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
77 $utils =
new Utils($db);
79 $result = $utils->purgeFiles($choice, $nbsecondsold);
81 $mesg = $utils->output;
90llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-tools_purge');
96print
'<span class="opacitymedium">'.$langs->trans(
"PurgeAreaDesc", $dolibarr_main_data_root).
'</span><br>';
100print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
101print
'<input type="hidden" name="token" value="'.newToken().
'" />';
102print
'<input type="hidden" name="action" value="purge" />';
104print
'<div class="divsection wordbreak">';
105print
'<table class="border centpercent">';
107print
'<tr class="border"><td style="padding: 4px">';
109if (isModEnabled(
'syslog')) {
110 print
'<input type="radio" name="choice" id="choicelogfile" value="logfile"';
111 print ($choice && $choice ==
'logfile') ?
' checked' :
'';
112 $filelogparam = $filelog;
113 if ($user->admin && preg_match(
'/^dolibarr.*\.log$/', basename($filelog))) {
114 $filelogparam =
'<a class="wordbreak" href="'.DOL_URL_ROOT.
'/document.php?modulepart=logs&file=';
115 $filelogparam .= basename($filelog);
116 $filelogparam .=
'">'.$filelog.
'</a>';
118 $desc = $langs->trans(
"PurgeDeleteLogFile",
'{filelogparam}');
119 $desc = str_replace(
'{filelogparam}', $filelogparam, $desc);
120 print
'> <label for="choicelogfile">'.$desc.
'</label>';
124print
'<input type="radio" name="choice" id="choicetempfiles" value="tempfiles"';
125print (!$choice || $choice ==
'tempfiles' || $choice ==
'allfiles') ?
' checked' :
'';
126print
'> <label for="choicetempfiles">'.$langs->trans(
"PurgeDeleteTemporaryFilesShort").
'</label><br><br>';
128print
'<input type="radio" name="choice" id="choiceallfiles" value="confirm_allfiles"';
129print ($choice && $choice ==
'confirm_allfiles') ?
' checked' :
'';
130print
'> <label for="choiceallfiles">'.$langs->trans(
"PurgeDeleteAllFilesInDocumentsDir", $dolibarr_main_data_root).
'</label>';
133 print
'NbSecondsOld = <input class="width50 right" type="text" name="nbsecondsold" value="'.$nbsecondsold.
'">';
135print
'</td></tr></table>';
141 print
'<div class="center"><input type="submit" class="button" value="'.$langs->trans(
"PurgeRunNow").
'"></div>';
146if (preg_match(
'/^confirm/i', $choice)) {
148 $formquestion = array();
149 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage utility methods.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
getDolGlobalString($key, $default='')
Return a 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.