/** * Cleanup a cache folder hierarchy * * @TODO decouple from global config options * * @param string $cache_folder path to cache folder * @param int $cache_max_age maximum age of cached items in seconds * @param bool $force_prune force cache pruning even if not due according to schedule */ function cache_prune_folders($cache_folder, $cache_max_age, $force_prune = false, $simulate = false, $pattern = '*', $levels = 0) { global $config; // root folder cache_prune_folder($cache_folder, $cache_max_age, $force_prune, $simulate, $pattern, $levels); // descent hierarchy if ($levels > 0) { for ($i = 0; $i < 16; $i++) { $error .= cache_prune_folders($cache_folder . dechex($i) . '/', $cache_max_age, $force_prune, $simulate, $pattern, $levels - 1); } } }
// set default engine to imdb if not set if (empty($config['enginedefault'])) { $config['enginedefault'] = 'imdb'; } // check permissions again - they may have changed if (!check_permission(PERM_ADMIN)) { redirect('login.php'); } // destroy cookies if required if ($_COOKIE['VDBusername'] && !$config['multiuser']) { setcookie('VDBpassword', '', time() - 7200); setcookie('VDBusername', '', time() - 7200); setcookie('VDBuserid', '', time() - 7200); } // cache maintenance if ($cacheempty) { // clear thumbnail cache runSQL('DELETE FROM ' . TBL_CACHE); // clean HTTP cache cache_prune_folders(CACHE . '/' . CACHE_HTML . '/', 0, true, false, '*', (int) $config['hierarchical']); // clean Smarty as well $smarty->clearAllCache(); } // prepare options $setup = setup_mkOptions(false); // prepare templates tpl_page('configview'); $smarty->assign('setup', $setup); $smarty->assign('cacheclear', $cacheempty); // display templates tpl_display('setup.tpl');