-
Notifications
You must be signed in to change notification settings - Fork 1
/
cron.php
34 lines (34 loc) · 868 Bytes
/
cron.php
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
<?php
if(!defined("CONFIG")) {
include("config.php");
}
$crondemand=CRONDEMAND;
if(isset($_GET["crondemand"])) {
$crondemand = $_GET["crondemand"];
}
if(!$crondemand) { echo "<br><b>CRON</b><br>"; }
foreach($nets as $net) {
$fileList = glob($net."/file/*");
foreach($fileList as $fileName){
if(is_file($fileName)) {
$filemtime = filemtime($fileName);
if(substr($fileName,-2)==".x") {
if(!$crondemand) { echo "X ".$fileName."<br>"; }
// DELETE
if( (time() - $filemtime) > DEL_AGE) {
unlink($fileName);
if(!$crondemand) { echo "DELETED ".$fileName."<br>"; }
}
}
else
{
// FLAG FOR DELETION
if(!$crondemand) { echo $fileName."<br>"; }
if((time() - $filemtime) > FLAG_AGE) {
rename($fileName, $fileName.".x");
if(!$crondemand) { echo "FLAGGED ".$fileName." for deletion<br>"; }
}
}
}
}
}