'N', 'list_count' => 50, 'regdate_before' => date('YmdHis', time() - ($days * 86400)), ]); if ($output->toBool()) { if ($output->data) { $oDB->begin(); foreach ($output->data as $file_info) { $oFileController->deleteFile($file_info->file_srl); } $oDB->commit(); if ($output->page_navigation && $output->page_navigation->total_count == count($output->data)) { break; } } else { break; } } else { echo "Error while deleting garbage files older than $days days.\n"; echo $output->getMessage() . "\n"; $exit_status = 11; break; } } if ($exit_status == 0) { echo "Successfully deleted all garbage files older than $days days.\n"; } // Find and delete temporary chunks. $dirname = RX_BASEDIR . 'files/attach/chunks'; $threshold = time() - ($days * 86400); $chunks = Rhymix\Framework\Storage::readDirectory($dirname); if ($chunks) { foreach ($chunks as $chunk) { if (@filemtime($chunk) < $threshold) { $result = Rhymix\Framework\Storage::delete($chunk); if (!$result) { $exit_status = 12; } } } } if ($exit_status == 0) { echo "Successfully deleted temporary file chunks older than $days days.\n"; } else { echo "Error while deleting temporary file chunks older than $days days.\n"; } // Set the exit status if there were any errors. if ($exit_status != 0) { exit($exit_status); }