2 namespace TYPO3\CMS\Scheduler\Task;
50 if (TYPO3_OS ===
'WIN') {
51 throw new \BadMethodCallException(
'This task is not reliable for Windows OS', 1308270454);
53 $seconds = 60 * 60 * 24 * (int)$this->numberOfDays;
54 $timestamp =
$GLOBALS[
'EXEC_TIME'] - $seconds;
56 $directory = PATH_site .
'fileadmin/';
57 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileadminDir'])) {
58 $directory = PATH_site . trim(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileadminDir']);
75 $directory = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($directory);
76 $timestamp = (int)$timestamp;
78 if (!@is_dir($directory)) {
79 throw new \RuntimeException(
'Given directory "' . $directory .
'" does not exist', 1301614535);
82 $directoryContent = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($directory));
83 foreach ($directoryContent as $fileName => $file) {
85 $filePath = $file->getPath();
86 if (substr($filePath, strrpos($filePath,
'/') + 1) !== $this->recyclerDirectory) {
90 if ($file->isFile() && $timestamp > $file->getCTime()) {
91 if (!@unlink($fileName)) {
92 throw new \RuntimeException(
'Could not remove file "' . $fileName .
'"', 1301614537);