1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 02:39:46 +02:00
Oinktube/plugin/Cache/crontab.php
2021-03-26 08:41:23 -03:00

28 lines
No EOL
767 B
PHP

<?php
require_once dirname(__FILE__) . '/../../videos/configuration.php';
if (!isCommandLineInterface()) {
die('Command Line only');
}
$cacheDir = ObjectYPT::getCacheDir();
if(empty($cacheDir) || !preg_match('/YPTObjectCache/', $cacheDir)){
die('Wrong dir: '.$cacheDir);
}
echo "deleting {$cacheDir}".PHP_EOL;
// delete caches 3 days old
$cmd = "find {$cacheDir}* -mtime +3 -type f -name \"*.cache\" -exec rm {} \;";
echo "Command: {$cmd}";
exec($cmd);
$cacheDir = getCacheDir();
if(empty($cacheDir) || !preg_match('/cache/', $cacheDir)){
die('Wrong dir: '.$cacheDir);
}
echo "deleting {$cacheDir}".PHP_EOL;
// delete caches 3 days old
$cmd = "find {$cacheDir}* -mtime +3 -type f -name \"*.cache\" -exec rm {} \;";
echo "Command: {$cmd}";
exec($cmd);