本文整理汇总了PHP中opToolkit::writeCacheFile方法的典型用法代码示例。如果您正苦于以下问题:PHP opToolkit::writeCacheFile方法的具体用法?PHP opToolkit::writeCacheFile怎么用?PHP opToolkit::writeCacheFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opToolkit
的用法示例。
在下文中一共展示了opToolkit::writeCacheFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateApplicationMessages
public function generateApplicationMessages($dirs)
{
$catalogues = array();
$files = sfFinder::type('file')->follow_link()->name('*.xml')->maxdepth(1)->in($dirs);
foreach ($files as $file) {
$name = basename($file);
if (empty($catalogues[$name])) {
$catalogues[$name] = array();
}
$messageSource = sfMessageSource::factory('OpenPNE');
$data = $messageSource->loadData($file);
$catalogues[$name] = array_merge($data, $catalogues[$name]);
}
$cacheDir = sfConfig::get('sf_app_cache_dir') . DIRECTORY_SEPARATOR . 'i18n';
foreach ($catalogues as $filename => $catalogue) {
$path = $cacheDir . DIRECTORY_SEPARATOR . $filename . '.php';
opToolkit::writeCacheFile($path, '<?php return ' . var_export($catalogue, true) . ';');
}
}
示例2: setOpenPNEConfiguration
protected function setOpenPNEConfiguration()
{
$opConfigCachePath = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'OpenPNE.yml.php';
if (is_readable($opConfigCachePath)) {
$config = (array) (include $opConfigCachePath);
} else {
$path = OPENPNE3_CONFIG_DIR . '/OpenPNE.yml';
$config = sfYaml::load($path . '.sample');
if (is_readable($path)) {
$config = array_merge($config, sfYaml::load($path));
}
if (isset($config['base_url'])) {
$config['base_url'] = preg_replace('/\\/$/', '', $config['base_url']);
}
opToolkit::writeCacheFile($opConfigCachePath, '<?php return ' . var_export($config, true) . ';');
}
$this->configureSessionStorage($config['session_storage']['name'], (array) $config['session_storage']['options']);
unset($config['session_storage']);
foreach ($config as $key => $value) {
sfConfig::set('op_' . $key, $value);
}
}
示例3: globEnablePlugin
public function globEnablePlugin($pattern, $isControllerPath = false)
{
if ($this->isDebug()) {
return $this->globPlugins($pattern, false, $isControllerPath);
}
$cacheKey = md5(serialize($pattern));
$cacheHead = substr($cacheKey, 0, 2);
$cacheDir = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR;
$cacheFile = $cacheDir . 'glob_enable_plugin_path' . DIRECTORY_SEPARATOR . $cacheHead . '.php';
$cacheProperty = 'globEnablePluginList';
if ($isControllerPath) {
$cacheFile = $cacheDir . 'glob_enable_plugin_path_controller' . DIRECTORY_SEPARATOR . $cacheHead . '.php';
$cacheProperty = 'globEnablePluginControllerList';
}
$_prop =& $this->{$cacheProperty};
if (empty($_prop[$cacheHead])) {
if (is_readable($cacheFile)) {
$_prop[$cacheHead] = (include $cacheFile);
}
}
if (isset($_prop[$cacheHead][$cacheKey])) {
return $_prop[$cacheHead][$cacheKey];
}
$_prop[$cacheHead][$cacheKey] = $this->globPlugins($pattern, false, $isControllerPath);
opToolkit::writeCacheFile($cacheFile, "<?php\nreturn " . var_export($_prop[$cacheHead], true) . ';');
return $_prop[$cacheHead][$cacheKey];
}