Файл: public/cron_del.php
Строк: 22
<?php
/* Cron: Удаление файлов, старше 180 дней */
try {
$dbh = new PDO("mysql:host=localhost;dbname=pornotvsu", 'pornotvsu', 'pornotvsqlx2');
}
catch(PDOException $e) {
echo $e->getMessage();
}
$root = $_SERVER['DOCUMENT_ROOT'];
$files = $dbh
->query("SELECT * FROM `fo_video` WHERE `date_upload` < UNIX_TIMESTAMP(NOW() - INTERVAL 180 DAY) && cron_del = '1'")
->fetchAll();
foreach ($files as $file) {
$video = $root . '/public/video_fo/' . PREFIX . $file['alias'] . '.' . $file['ext'];;
$screen = $root . '/public/screen_fo/' . $file['alias'] . '.png';
@unlink($video);
@unlink($screen);
$dbh->query("DELETE FROM `fo_comments` WHERE parent = '{$file['id']}'");
$dbh->query("DELETE FROM `fo_rating_list` WHERE video_id = '{$file['id']}'");
}
$dbh->query("DELETE FROM `fo_video` WHERE `date_upload` < UNIX_TIMESTAMP(NOW() - INTERVAL 180 DAY) && cron_del = '1'");
echo '<pre>', print_r($_SERVER), '</pre>';
?>