Example #1
0
 * @copyright (c) 2016 osCommerce; https://www.oscommerce.com
 * @license MIT; https://www.oscommerce.com/license/mit.txt
 */
use OSC\OM\Cache;
use OSC\OM\FileSystem;
use OSC\OM\HTML;
use OSC\OM\OSCOM;
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (tep_not_null($action)) {
    switch ($action) {
        case 'reset':
            Cache::clear($_GET['block']);
            break;
        case 'resetAll':
            Cache::clearAll();
            break;
    }
    OSCOM::redirect(FILENAME_CACHE);
}
// check if the cache directory exists
if (is_dir(Cache::getPath())) {
    if (!FileSystem::isWritable(Cache::getPath())) {
        $OSCOM_MessageStack->add(OSCOM::getDef('error_cache_directory_not_writeable'), 'error');
    }
} else {
    $OSCOM_MessageStack->add(OSCOM::getDef('error_cache_directory_does_not_exist'), 'error');
}
$cache_files = [];
foreach (glob(Cache::getPath() . '*.cache') as $c) {
    $key = basename($c, '.cache');