Piwik\Filesystem::clearPhpCaches PHP Method

clearPhpCaches() public static method

public static clearPhpCaches ( )
    public static function clearPhpCaches()
    {
        if (function_exists('apc_clear_cache')) {
            apc_clear_cache();
            // clear the system (aka 'opcode') cache
        }
        if (function_exists('opcache_reset')) {
            @opcache_reset();
            // reset the opcode cache (php 5.5.0+)
        }
        if (function_exists('wincache_refresh_if_changed')) {
            @wincache_refresh_if_changed();
            // reset the wincache
        }
        if (function_exists('xcache_clear_cache') && defined('XC_TYPE_VAR')) {
            if (ini_get('xcache.admin.enable_auth')) {
                // XCache will not be cleared because "xcache.admin.enable_auth" is enabled in php.ini.
            } else {
                @xcache_clear_cache(XC_TYPE_VAR);
            }
        }
    }

Usage Example

示例#1
0
 private function oneClick_Copy()
 {
     /*
      * Make sure the execute bit is set for this shell script
      */
     if (!Rules::isBrowserTriggerEnabled()) {
         @chmod($this->pathRootExtractedPiwik . '/misc/cron/archive.sh', 0755);
     }
     $model = new Model();
     /*
      * Copy all files to PIWIK_INCLUDE_PATH.
      * These files are accessed through the dispatcher.
      */
     Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_INCLUDE_PATH);
     $model->removeGoneFiles($this->pathRootExtractedPiwik, PIWIK_INCLUDE_PATH);
     /*
      * These files are visible in the web root and are generally
      * served directly by the web server.  May be shared.
      */
     if (PIWIK_INCLUDE_PATH !== PIWIK_DOCUMENT_ROOT) {
         /*
          * Copy PHP files that expect to be in the document root
          */
         $specialCases = array('/index.php', '/piwik.php', '/js/index.php');
         foreach ($specialCases as $file) {
             Filesystem::copy($this->pathRootExtractedPiwik . $file, PIWIK_DOCUMENT_ROOT . $file);
         }
         /*
          * Copy the non-PHP files (e.g., images, css, javascript)
          */
         Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_DOCUMENT_ROOT, true);
         $model->removeGoneFiles($this->pathRootExtractedPiwik, PIWIK_DOCUMENT_ROOT);
     }
     /*
      * Config files may be user (account) specific
      */
     if (PIWIK_INCLUDE_PATH !== PIWIK_USER_PATH) {
         Filesystem::copyRecursive($this->pathRootExtractedPiwik . '/config', PIWIK_USER_PATH . '/config');
     }
     Filesystem::unlinkRecursive($this->pathRootExtractedPiwik, true);
     Filesystem::clearPhpCaches();
 }
All Usage Examples Of Piwik\Filesystem::clearPhpCaches