-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsched_attach_delete.php
More file actions
36 lines (28 loc) · 975 Bytes
/
sched_attach_delete.php
File metadata and controls
36 lines (28 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
Remove old attachments (to be run via cron).
This script checks closed tasks and removes some attachments in them.
Criteria for removal can include:
<li>task type
<li>task category
<li>file size
<li>file type
*/
define('IN_FS', true);
require_once 'header.php';
require_once BASEDIR . '/includes/class.AttachmentRemoval.php';
$del_config = include BASEDIR . '/attachment_delete.config.php';
$sch_helper = new AttachmentRemoval($del_config);
// echo "\n".$sch_helper->filter->letter_to_byte('1M');
// echo "\n".$sch_helper->filter->letter_to_byte('1MB');
// die();
$is_enabled = isset($conf['attach_del']) && isset($conf['attach_del']['enabled']) ? intval(isset($conf['attach_del']['enabled'])) : 0;
if($is_enabled) {
if(php_sapi_name() === 'cli') {
$sch_helper->run_schedule($conf['attach_del']);
} else {
die("[WARNING] you are not authorized to start the schedule.\n");
}
} else {
die("[WARNING] schedule is disabled... not running.\n");
}