You are here

function drupal_clear_opcode_cache in Drupal 7

Invalidates a PHP file from any active opcode caches.

If the opcode cache does not support the invalidation of individual files, the entire cache will be flushed.

Parameters

string $filepath: The absolute path of the PHP file to invalidate.

1 call to drupal_clear_opcode_cache()
drupal_rewrite_settings in includes/install.inc
Replaces values in settings.php with values in the submitted array.

File

includes/bootstrap.inc, line 3858
Functions that need to be loaded on every Drupal request.

Code

function drupal_clear_opcode_cache($filepath) {
  if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) {

    // Below PHP 5.3, clearstatcache does not accept any function parameters.
    clearstatcache();
  }
  else {
    clearstatcache(TRUE, $filepath);
  }

  // Zend OPcache.
  if (function_exists('opcache_invalidate')) {
    opcache_invalidate($filepath, TRUE);
  }

  // APC.
  if (function_exists('apc_delete_file')) {

    // apc_delete_file() throws a PHP warning in case the specified file was
    // not compiled yet.
    // @see http://php.net/apc-delete-file
    @apc_delete_file($filepath);
  }
}