Skip to content

Commit

Permalink
#976: Invalidate updated cache files from PHP's Opcache
Browse files Browse the repository at this point in the history
Patch provided by Pierre, thanks!
  • Loading branch information
adaur committed Aug 10, 2014
1 parent 9786ac6 commit 6ff296c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions include/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ function fluxbb_write_cache_file($file, $content)
flock($fh, LOCK_UN);
fclose($fh);

if (function_exists('apc_delete_file'))
@apc_delete_file(FORUM_CACHE_DIR.$file);
fluxbb_invalidate_cached_file(FORUM_CACHE_DIR.$file);
}


Expand All @@ -241,9 +240,22 @@ function clear_feed_cache()
{
if (substr($entry, 0, 10) == 'cache_feed' && substr($entry, -4) == '.php')
@unlink(FORUM_CACHE_DIR.$entry);
fluxbb_invalidate_cached_file(FORUM_CACHE_DIR.$entry);
}
$d->close();
}


//
// Invalidate updated php files that are cached by an opcache
//
function fluxbb_invalidate_cached_file($file)
{
if (function_exists('opcache_invalidate'))
opcache_invalidate($file, true);
elseif (function_exists('apc_delete_file'))
@apc_delete_file($file);
}


define('FORUM_CACHE_FUNCTIONS_LOADED', true);

0 comments on commit 6ff296c

Please sign in to comment.