1
0
Fork 0

Dateien hochladen nach „cron“

master release/1.0.0
Chris 2021-01-29 01:10:21 +00:00
parent 20353e1a0a
commit 3d66bdaea9
1 changed files with 29 additions and 0 deletions

29
cron/assetChecker.php Normal file
View File

@ -0,0 +1,29 @@
<?php
$statement = $RUNTIME['PDO']->prepare("SELECT id,hash FROM fsassets ORDER BY create_time DESC");
$statement->execute();
$count = 0;
while($row = $statement->fetch())
{
$fileNameParts = array();
$fileNameParts[0] = substr($row['hash'], 0, 2);
$fileNameParts[1] = substr($row['hash'], 2, 2);
$fileNameParts[2] = substr($row['hash'], 4, 2);
$fileNameParts[3] = substr($row['hash'], 6, 4);
$fileNameParts[4] = $row['hash'].".gz";
//$fileNameParts['Time'] = time();
$fileNameParts['UUID'] = $row['id'];
$fileNameParts['FilePath'] = "/data/assets/base/".$fileNameParts[0]."/".$fileNameParts[1]."/".$fileNameParts[2]."/".$fileNameParts[3]."/".$fileNameParts[4];
$fileNameParts['FileSize'] = @filesize($fileNameParts['FilePath']);
$fileNameParts['Count'] = $count++;
if($fileNameParts['FileSize'] == 0 || !file_exists($fileNameParts['FilePath']))
{
$add = $RUNTIME['PDO']->prepare('DELETE FROM fsassets WHERE hash = :fileHash');
$add->execute(['fileHash' => $row['hash']]);
}
}
?>