/** * Clear thumbnails (cron task function). * * @param vivvo_lite_site $sm */ function auto_clear_thumbnails($sm = null) { clear_directory(VIVVO_FS_INSTALL_ROOT . VIVVO_FS_FILES_DIR . 'thumbnail/'); if (defined('VIVVO_CRONJOB_MODE')) { echo 'auto_clear_thumbnails: Finished.' . PHP_EOL; } }
function force_remove_directory($path) { if (clear_directory($path)) { if (rmdir($path)) { return true; } else { return false; } } else { return false; } }
function clear_directory($directory) { $iterator = new \DirectoryIterator($directory); foreach ($iterator as $file) { if (!$file->isDot()) { if ($file->isDir()) { clear_directory($file->getPathname()); } else { unlink($file->getPathname()); } } } }
function clearCache() { $cache_dir = BASEPATH . '/cache/output/'; clear_directory($cache_dir); }