function drupal_clear_opcode_cache

drupal_clear_opcode_cache($filepath)

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.

File

includes/bootstrap.inc, line 3816
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);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_clear_opcode_cache/7.x