/**
  * Initialize the cache properties
  */
 protected static function initialize()
 {
     $apcVersion = phpversion('apc');
     $xcVersion = phpversion('xcache');
     static::$supportedCaches = array('OPcache' => array('active' => extension_loaded('Zend OPcache') && ini_get('opcache.enable') === '1', 'version' => phpversion('Zend OPcache'), 'canReset' => TRUE, 'canInvalidate' => function_exists('opcache_invalidate'), 'error' => FALSE, 'clearCallback' => function ($fileAbsPath) {
         if ($fileAbsPath !== NULL && function_exists('opcache_invalidate')) {
             opcache_invalidate($fileAbsPath);
         } else {
             opcache_reset();
         }
     }), 'APC' => array('active' => extension_loaded('apc') && !extension_loaded('apcu') && ini_get('apc.enabled') === '1', 'version' => $apcVersion, 'canReset' => TRUE, 'canInvalidate' => self::canApcInvalidate(), 'error' => $apcVersion && VersionNumberUtility::convertVersionNumberToInteger($apcVersion) < 3001007, 'clearCallback' => function ($fileAbsPath) {
         if ($fileAbsPath !== NULL && OpcodeCacheUtility::getCanInvalidate('APC')) {
             // This may output a warning like: PHP Warning: apc_delete_file(): Could not stat file
             // This warning isn't true, this means that apc was unable to generate the cache key
             // which depends on the configuration of APC.
             apc_delete_file($fileAbsPath);
         } else {
             apc_clear_cache('opcode');
         }
     }), 'WinCache' => array('active' => extension_loaded('wincache') && ini_get('wincache.ocenabled') === '1', 'version' => phpversion('wincache'), 'canReset' => FALSE, 'canInvalidate' => TRUE, 'error' => FALSE, 'clearCallback' => function ($fileAbsPath) {
         if ($fileAbsPath !== NULL) {
             wincache_refresh_if_changed(array($fileAbsPath));
         } else {
             // No argument means refreshing all.
             wincache_refresh_if_changed();
         }
     }), 'XCache' => array('active' => extension_loaded('xcache'), 'version' => $xcVersion, 'canReset' => TRUE, 'canInvalidate' => FALSE, 'error' => FALSE, 'clearCallback' => $xcVersion && VersionNumberUtility::convertVersionNumberToInteger($xcVersion) < 3000000 ? function ($fileAbsPath) {
         if (!ini_get('xcache.admin.enable_auth')) {
             xcache_clear_cache(XC_TYPE_PHP, 0);
         }
     } : function ($fileAbsPath) {
         if (!ini_get('xcache.admin.enable_auth')) {
             xcache_clear_cache(XC_TYPE_PHP);
         }
     }), 'eAccelerator' => array('active' => extension_loaded('eAccelerator'), 'version' => phpversion('eaccelerator'), 'canReset' => FALSE, 'canInvalidate' => FALSE, 'error' => TRUE, 'clearCallback' => function ($fileAbsPath) {
         eaccelerator_clear();
     }), 'ZendOptimizerPlus' => array('active' => extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable') === '1', 'version' => phpversion('Zend Optimizer+'), 'canReset' => TRUE, 'canInvalidate' => FALSE, 'error' => FALSE, 'clearCallback' => function ($fileAbsPath) {
         accelerator_reset();
     }));
     static::$activeCaches = array();
     // Cache the active ones
     foreach (static::$supportedCaches as $opcodeCache => $properties) {
         if ($properties['active']) {
             static::$activeCaches[$opcodeCache] = $properties;
         }
     }
 }
 /**
  * Flushes a directory by first moving to a temporary resource, and then
  * triggering the remove process. This way directories can be flushed faster
  * to prevent race conditions on concurrent processes accessing the same directory.
  *
  * @param string $directory The directory to be renamed and flushed
  * @param bool $keepOriginalDirectory Whether to only empty the directory and not remove it
  * @param bool $flushOpcodeCache Also flush the opcode cache right after renaming the directory.
  * @return boolean Whether the action was successful
  */
 public static function flushDirectory($directory, $keepOriginalDirectory = FALSE, $flushOpcodeCache = FALSE)
 {
     $result = FALSE;
     if (is_dir($directory)) {
         $temporaryDirectory = rtrim($directory, '/') . '.' . uniqid('remove', TRUE) . '/';
         if (rename($directory, $temporaryDirectory)) {
             $flushOpcodeCache && OpcodeCacheUtility::clearAllActive($directory);
             if ($keepOriginalDirectory) {
                 self::mkdir($directory);
             }
             clearstatcache();
             $result = self::rmdir($temporaryDirectory, TRUE);
         }
     }
     return $result;
 }