示例#1
0
/**
 * @deprecated Replaced by {@link phorum_api_cache_purge()}.
 */
function phorum_cache_purge($full = false)
{
    return phorum_api_cache_purge($full);
}
示例#2
0
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
if (!defined("PHORUM_ADMIN")) {
    return;
}
// Execute file purging.
if (count($_POST)) {
    print "<h2>Purging the cache now.<br/>One moment please...</h2>";
    ob_flush();
    // The standard cache system that is in use should handle its own
    // cache cleanup if needed. It can do so by implementing the
    // phorum_api_cache_purge() function. If the required function is not
    // available, then the caching layer purge will be ignored.
    if (function_exists("phorum_api_cache_purge")) {
        $full_purge = isset($_POST["purge_all"]) && $_POST["purge_all"];
        $report = phorum_api_cache_purge($full_purge);
        print $report . "<br/>";
    }
    // Cleanup compiled templates.
    $purged = 0;
    $dh = opendir($PHORUM['CACHECONFIG']['directory']);
    if (!$dh) {
        die("Can't opendir " . htmlspecialchars($PHORUM['CACHECONFIG']['directory']));
    }
    while ($entry = readdir($dh)) {
        if (preg_match('/^tpl-.*[a-f0-9]{32}\\.php(-stage2)?$/', $entry)) {
            $compiled_tpl = $PHORUM['CACHECONFIG']['directory'] . "/{$entry}";
            $size = filesize($compiled_tpl);
            if (@unlink($compiled_tpl)) {
                $purged += $size;
            }