mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-04-10 01:59:03 +02:00
expire files with no views after 1 day
This commit is contained in:
parent
db22059d10
commit
79cb22de9a
@ -138,19 +138,26 @@
|
||||
}
|
||||
|
||||
function GetExpiredFiles()
|
||||
{
|
||||
return $this->GetExpiredFilesT(_FILE_EXPIRE_TIME);
|
||||
}
|
||||
|
||||
function GetExpiredFilesT($tt)
|
||||
{
|
||||
$res = array();
|
||||
|
||||
$stmt = $this->mysqli->prepare("select hash160, filename, path from files where date_add(lastview, INTERVAL " . _FILE_EXPIRE_TIME . " DAY) < CURRENT_TIMESTAMP");
|
||||
$stmt = $this->mysqli->prepare("select hash160, filename, path, lastview, size from files where date_add(lastview, INTERVAL " . $tt . " DAY) < CURRENT_TIMESTAMP or (views = 0 and date_add(lastview, INTERVAL 1 DAY) < CURRENT_TIMESTAMP) order by lastview desc");
|
||||
if($stmt)
|
||||
{
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($hash160, $filename, $path);
|
||||
$stmt->bind_result($hash160, $filename, $path, $lastview, $size);
|
||||
while($stmt->fetch()){
|
||||
$nf = new FileUpload();
|
||||
$nf->hash160 = $hash160;
|
||||
$nf->filename = $filename;
|
||||
$nf->path = $path;
|
||||
$nf->lastview = $lastview;
|
||||
$nf->size = $size;
|
||||
array_push($res, $nf);
|
||||
}
|
||||
$stmt->close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user