Cleanup Script hinzugefügt
This commit is contained in:
parent
16ca95dcd3
commit
2b6e2311c0
27
cleanup.php
Normal file
27
cleanup.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(is_file('config.php')) {
|
||||||
|
include('config.php');
|
||||||
|
} else {
|
||||||
|
include('config.dist.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
$abspath = realpath(dirname(__FILE__));
|
||||||
|
|
||||||
|
$temp = scandir($abspath . '/' . $datadir);
|
||||||
|
$images = array();
|
||||||
|
|
||||||
|
foreach($temp as $item) {
|
||||||
|
if($item != '.' && $item != '..') {
|
||||||
|
array_push($images, $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($images as $image) {
|
||||||
|
$diff = time() - filemtime($abspath . '/' . $datadir . '/' . $image);
|
||||||
|
if($diff >= $lifetime) {
|
||||||
|
unlink($abspath . '/' . $datadir . '/' . $image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -12,4 +12,7 @@ $datadir = "i";
|
|||||||
// Length of the generated file names
|
// Length of the generated file names
|
||||||
$length = 8;
|
$length = 8;
|
||||||
|
|
||||||
|
// Image lifetime in seconds
|
||||||
|
$lifetime = 3600;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user