当前位置: 首页>>代码示例>>PHP>>正文


PHP apc_compile_file函数代码示例

本文整理汇总了PHP中apc_compile_file函数的典型用法代码示例。如果您正苦于以下问题:PHP apc_compile_file函数的具体用法?PHP apc_compile_file怎么用?PHP apc_compile_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了apc_compile_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compileScripts

 public function compileScripts()
 {
     if (!extension_loaded('apc')) {
         return;
     }
     $files = array();
     foreach ($this->_refresh_rules as $rules) {
         $rules = (object) $rules;
         $files = array_merge($files, File::getFilesFromDirectory($rules->dir, $rules->extension, $rules->recursive));
     }
     foreach ($files as $file) {
         if (!$this->isFileCached($file)) {
             if ($d = \apc_delete_file($file)) {
                 Logger::debug('Elimino dalla cache lo script ' . $file . ' per ricompilarlo', RENDER_CORE_LOGNAME);
             } else {
                 Logger::debug('Non sono riuscito ad eliminare ' . $file . ' ' . print_r($d, true));
             }
             if ($d = \apc_compile_file($file)) {
                 Logger::debug('Ho compilato lo script ' . $file, 'core');
             } else {
                 Logger::debug('Non sono riuscito a compilare ' . $file . ' ' . print_r($d, true), 'core');
             }
         }
     }
 }
开发者ID:smnDev,项目名称:pheeca,代码行数:25,代码来源:APC.php

示例2: compile

 public function compile($filename, $atomic = true)
 {
     if (CACHE_STATUS) {
         apc_compile_file($filename, $atomic);
     }
     return false;
 }
开发者ID:jgianpiere,项目名称:ZanPHP,代码行数:7,代码来源:apc.php

示例3: write

 /**
  * {@inheritdoc}
  */
 public function write($key, $content)
 {
     $dir = dirname($key);
     if (!is_dir($dir)) {
         if (false === @mkdir($dir, 0777, true)) {
             clearstatcache(false, $dir);
             if (!is_dir($dir)) {
                 throw new RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir));
             }
         }
     } elseif (!is_writable($dir)) {
         throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir));
     }
     $tmpFile = tempnam($dir, basename($key));
     if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) {
         @chmod($key, 0666 & ~umask());
         if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
             // Compile cached file into bytecode cache
             if (function_exists('opcache_invalidate')) {
                 opcache_invalidate($key, true);
             } elseif (function_exists('apc_compile_file')) {
                 apc_compile_file($key);
             }
         }
         return;
     }
     throw new RuntimeException(sprintf('Failed to write cache file "%s".', $key));
 }
开发者ID:kayneth,项目名称:site_enchere,代码行数:31,代码来源:Filesystem.php

示例4: save

 /**
  * Formats the output and saved it to disc.
  *
  * @param   string     $identifier  filename
  * @param   $contents  $contents    language array to save
  * @return  bool       \File::update result
  */
 public function save($identifier, $contents)
 {
     // store the current filename
     $file = $this->file;
     // save it
     $return = parent::save($identifier, $contents);
     // existing file? saved? and do we need to flush the opcode cache?
     if ($file == $this->file and $return and static::$flush_needed) {
         if ($this->file[0] !== '/' and (!isset($this->file[1]) or $this->file[1] !== ':')) {
             // locate the file
             if ($pos = strripos($identifier, '::')) {
                 // get the namespace path
                 if ($file = \Autoloader::namespace_path('\\' . ucfirst(substr($identifier, 0, $pos)))) {
                     // strip the namespace from the filename
                     $identifier = substr($identifier, $pos + 2);
                     // strip the classes directory as we need the module root
                     $file = substr($file, 0, -8) . 'lang' . DS . $identifier;
                 } else {
                     // invalid namespace requested
                     return false;
                 }
             } else {
                 $file = \Finder::search('lang', $identifier);
             }
         }
         // make sure we have a fallback
         $file or $file = APPPATH . 'lang' . DS . $identifier;
         // flush the opcode caches that are active
         static::$uses_opcache and opcache_invalidate($file, true);
         static::$uses_apc and apc_compile_file($file);
     }
     return $return;
 }
开发者ID:takawasitobi,项目名称:pembit,代码行数:40,代码来源:php.php

示例5: compile

 public function compile($filename, $atomic = TRUE)
 {
     if (_cacheStatus) {
         apc_compile_file($filename, $atomic);
     }
     return FALSE;
 }
开发者ID:no2key,项目名称:ZanPHP,代码行数:7,代码来源:apc.php

示例6: flush_file

 public function flush_file($filename)
 {
     if (file_exists($filename)) {
     } else {
         if (file_exists(ABSPATH . $filename)) {
             $filename = ABSPATH . DIRECTORY_SEPARATOR . $filename;
         } elseif (file_exists(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $filename)) {
             $filename = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $filename;
         } elseif (file_exists(WPINC . DIRECTORY_SEPARATOR . $filename)) {
             $filename = WPINC . DIRECTORY_SEPARATOR . $filename;
         } elseif (file_exists(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $filename)) {
             $filename = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $filename;
         } else {
             return false;
         }
     }
     if (function_exists('opcache_invalidate')) {
         return opcache_invalidate($filename, true);
     } else {
         if (function_exists('apc_compile_file')) {
             return apc_compile_file($filename);
         }
     }
     return false;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:25,代码来源:SystemOpCache_Core.php

示例7: writeCacheFile

 /**
  * write apc-cache()
  *
  * @param $file
  * @param $content
  */
 protected function writeCacheFile($file, $content)
 {
     parent::writeCacheFile($file, $content);
     // Compile cached-file into bytecode-cache
     if (function_exists('apc_compile_file') === true) {
         apc_compile_file($file);
     }
 }
开发者ID:voku,项目名称:twig-wrapper,代码行数:14,代码来源:Environment.php

示例8: RunAPC

 /**
  *  Runs the APC cache to pre-cache the php files
  *  returns true if all files where cached
  */
 public static function RunAPC()
 {
     if (function_exists('apc_compile_file')) {
         $file01 = @apc_compile_file(DUPLICATOR_PLUGIN_PATH . "duplicator.php");
         return $file01;
     } else {
         return false;
     }
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:13,代码来源:utility.php

示例9: write

 /**
  * {@inheritdoc}
  */
 public function write($key, $content)
 {
     $this->filesystem->put($key, $content);
     // Compile cached file into bytecode cache
     if (function_exists('opcache_invalidate')) {
         opcache_invalidate($key, true);
     } elseif (function_exists('apc_compile_file')) {
         apc_compile_file($key);
     }
 }
开发者ID:torann,项目名称:snazzy-twig,代码行数:13,代码来源:Filesystem.php

示例10: compile_dir

 /**
  * Сохраняет каталог в двоичном кэше
  *
  * @param string $dir_name
  * @param bool   $recursively
  *
  * @return bool
  */
 public static function compile_dir($dir_name, $recursively = true)
 {
     $compiled = true;
     if ($recursively) {
         foreach (glob($dir_name . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $dir) {
             $compiled = $compiled && self::compile_dir($dir, $recursively);
         }
     }
     foreach (glob($dir_name . DIRECTORY_SEPARATOR . '*.php') as $file) {
         $compiled = $compiled && apc_compile_file($file);
     }
     return $compiled;
 }
开发者ID:techart,项目名称:tao,代码行数:21,代码来源:APC.php

示例11: save

 /**
  * Sets a new dynamic configuration
  * 
  * @param array $config
  */
 public static function save($config)
 {
     $content = "<" . "?php return ";
     $content .= var_export($config, true);
     $content .= "; ?" . ">";
     $configFile = self::getConfigFilePath();
     file_put_contents($configFile, $content);
     if (function_exists('opcache_invalidate')) {
         opcache_reset();
         opcache_invalidate($configFile);
     }
     if (function_exists('apc_compile_file')) {
         apc_compile_file($configFile);
     }
 }
开发者ID:honestgorillas,项目名称:humhub,代码行数:20,代码来源:DynamicConfig.php

示例12: compile_files

/**
 * Compile Files for APC
 * The function runs through each directory and
 * compiles each *.php file through apc_compile_file
 * @param string $dir start directory
 * @return void
 */
function compile_files($dir, $exts = array('*.php'))
{
    $dirs = glob($dir . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);
    if (is_array($dirs) && count($dirs) > 0) {
        while (list(, $v) = each($dirs)) {
            compile_files($v, $exts);
        }
    }
    foreach ($exts as $ext) {
        echo "\n\n" . 'Compiling ' . $ext . "\n";
        $files = glob($dir . DIRECTORY_SEPARATOR . $ext);
        if (is_array($files) && count($files) > 0) {
            while (list(, $v) = each($files)) {
                echo 'Compiling ' . $v . "\n";
                apc_compile_file($v);
            }
        }
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:26,代码来源:apc_cache.php

示例13: compile_files

function compile_files($dir)
{
    $dirs = glob($dir . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);
    $files = glob($dir . DIRECTORY_SEPARATOR . '*.php');
    if (is_array($files) && count($files) > 0) {
        while (list(, $v) = each($files)) {
            if (apc_compile_file($v)) {
                $GLOBALS["COMPILED"] = $GLOBALS["COMPILED"] + 1;
            }
        }
    }
    $files = glob($dir . DIRECTORY_SEPARATOR . '*.inc');
    if (is_array($files) && count($files) > 0) {
        while (list(, $v) = each($files)) {
            if (apc_compile_file($v)) {
                $GLOBALS["COMPILED"] = $GLOBALS["COMPILED"] + 1;
            }
        }
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:20,代码来源:exec.apc.compile.php

示例14: save

 /**
  * Formats the output and saved it to disk.
  *
  * @param   $contents  $contents    config array to save
  * @return  bool       \File::update result
  */
 public function save($contents)
 {
     // store the current filename
     $file = $this->file;
     // save it
     $return = parent::save($contents);
     // existing file? saved? and do we need to flush the opcode cache?
     if ($file == $this->file and $return and static::$flush_needed) {
         if ($this->file[0] !== '/' and (!isset($this->file[1]) or $this->file[1] !== ':')) {
             // locate the file
             $file = \Finder::search('config', $this->file, $this->ext);
         }
         // make sure we have a fallback
         $file or $file = APPPATH . 'config' . DS . $this->file . $this->ext;
         // flush the opcode caches that are active
         static::$uses_opcache and opcache_invalidate($file, true);
         static::$uses_apc and apc_compile_file($file);
     }
     return $return;
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:26,代码来源:php.php

示例15: refreshOpcodeCache

 /**
  * Refreshes all active opcode caches for the specified file
  *
  * @param  string $path Path to the file
  * @return boolean      True on success, false on failure
  */
 protected static function refreshOpcodeCache($path)
 {
     try {
         // Zend OPcache
         if (function_exists('opcache_invalidate')) {
             opcache_invalidate($path, true);
         }
         // Zend Optimizer+
         if (function_exists('accelerator_reset')) {
             accelerator_reset();
         }
         // APC
         if (function_exists('apc_compile_file') && !ini_get('apc.stat')) {
             apc_compile_file($path);
         }
         // eAccelerator
         if (function_exists('eaccelerator_purge') && !ini_get('eaccelerator.check_mtime')) {
             @eaccelerator_purge();
         }
         // XCache
         if (function_exists('xcache_count') && !ini_get('xcache.stat')) {
             if (($count = xcache_count(XC_TYPE_PHP)) > 0) {
                 for ($id = 0; $id < $count; $id++) {
                     xcache_clear_cache(XC_TYPE_PHP, $id);
                 }
             }
         }
         // WinCache
         if (function_exists('wincache_refresh_if_changed')) {
             wincache_refresh_if_changed(array($path));
         }
     } catch (\Exception $exception) {
         return false;
     }
     return true;
 }
开发者ID:Tastaturberuf,项目名称:contao-rocksolid-custom-elements,代码行数:42,代码来源:CustomElements.php


注:本文中的apc_compile_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。