本文整理汇总了PHP中AgaviToolkit::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP AgaviToolkit::clearCache方法的具体用法?PHP AgaviToolkit::clearCache怎么用?PHP AgaviToolkit::clearCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AgaviToolkit
的用法示例。
在下文中一共展示了AgaviToolkit::clearCache方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrap
/**
* Startup the Agavi core
*
* @param string environment the environment to use for this session.
*
* @author David Zülke <dz@bitxtender.com>
* @since 0.11.0
*/
public static function bootstrap($environment = null)
{
// set up our __autoload
spl_autoload_register(array('AgaviAutoloader', 'loadClass'));
try {
if ($environment === null) {
// no env given? let's read one from core.environment
$environment = AgaviConfig::get('core.environment');
} elseif (AgaviConfig::has('core.environment') && AgaviConfig::isReadonly('core.environment')) {
// env given, but core.environment is read-only? then we must use that instead and ignore the given setting
$environment = AgaviConfig::get('core.environment');
}
if ($environment === null) {
// still no env? oh man...
throw new AgaviException('You must supply an environment name to Agavi::bootstrap() or set the name of the default environment to be used in the configuration directive "core.environment".');
}
// finally set the env to what we're really using now.
AgaviConfig::set('core.environment', $environment, true, true);
AgaviConfig::set('core.debug', false, false);
if (!AgaviConfig::has('core.app_dir')) {
throw new AgaviException('Configuration directive "core.app_dir" not defined, terminating...');
}
// define a few filesystem paths
AgaviConfig::set('core.cache_dir', AgaviConfig::get('core.app_dir') . '/cache', false, true);
AgaviConfig::set('core.config_dir', AgaviConfig::get('core.app_dir') . '/config', false, true);
AgaviConfig::set('core.system_config_dir', AgaviConfig::get('core.agavi_dir') . '/config/defaults', false, true);
AgaviConfig::set('core.lib_dir', AgaviConfig::get('core.app_dir') . '/lib', false, true);
AgaviConfig::set('core.model_dir', AgaviConfig::get('core.app_dir') . '/models', false, true);
AgaviConfig::set('core.module_dir', AgaviConfig::get('core.app_dir') . '/modules', false, true);
AgaviConfig::set('core.template_dir', AgaviConfig::get('core.app_dir') . '/templates', false, true);
AgaviConfig::set('core.cldr_dir', AgaviConfig::get('core.agavi_dir') . '/translation/data', false, true);
// autoloads first (will trigger the compilation of config_handlers.xml)
$autoload = AgaviConfig::get('core.config_dir') . '/autoload.xml';
if (!is_readable($autoload)) {
$autoload = AgaviConfig::get('core.system_config_dir') . '/autoload.xml';
}
AgaviConfigCache::load($autoload);
// load base settings
AgaviConfigCache::load(AgaviConfig::get('core.config_dir') . '/settings.xml');
// clear our cache if the conditions are right
if (AgaviConfig::get('core.debug')) {
AgaviToolkit::clearCache();
// load base settings
AgaviConfigCache::load(AgaviConfig::get('core.config_dir') . '/settings.xml');
}
$compile = AgaviConfig::get('core.config_dir') . '/compile.xml';
if (!is_readable($compile)) {
$compile = AgaviConfig::get('core.system_config_dir') . '/compile.xml';
}
// required classes for the framework
AgaviConfigCache::load($compile);
} catch (Exception $e) {
AgaviException::render($e);
}
}
示例2: clearCache
/**
* Flushes the cache for a group
*
* @param array An array of cache groups
*
* @author David Zülke <dz@bitxtender.com>
* @since 0.11.0
*/
public static function clearCache(array $groups = array())
{
foreach ($groups as &$group) {
$group = base64_encode($group);
}
$path = self::CACHE_SUBDIR . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $groups);
if (is_file(AgaviConfig::get('core.cache_dir') . DIRECTORY_SEPARATOR . $path . '.cefcache')) {
AgaviToolkit::clearCache($path . '.cefcache');
} else {
AgaviToolkit::clearCache($path);
}
}
示例3: clearAgaviCache
private function clearAgaviCache()
{
AgaviToolkit::clearCache();
$this->log('Agavi cache cleared through webinterface', AgaviLogger::INFO);
}
示例4: main
public function main()
{
parent::main();
AgaviToolkit::clearCache();
}
示例5: unset
<?php
$agaviTestSettings = $GLOBALS['AGAVI_TESTING_ISOLATED_TEST_SETTINGS'];
unset($GLOBALS['AGAVI_TESTING_ISOLATED_TEST_SETTINGS']);
if ($agaviTestSettings['bootstrap'] || $agaviTestSettings['clearCache']) {
require __DIR__ . '/../../testing.php';
}
if ($agaviTestSettings['bootstrap']) {
// when agavi is not bootstrapped we don't want / need to load the agavi config
// values from outside the isolation
AgaviConfig::fromArray($GLOBALS['AGAVI_TESTING_CONFIG']);
}
unset($GLOBALS['AGAVI_TESTING_CONFIG']);
if ($agaviTestSettings['clearCache']) {
AgaviToolkit::clearCache();
}
$env = null;
if ($agaviTestSettings['environment']) {
$env = $agaviTestSettings['environment'];
}
if ($agaviTestSettings['bootstrap']) {
AgaviTesting::bootstrap($env);
}
if ($agaviTestSettings['defaultContext']) {
AgaviConfig::set('core.default_context', $agaviTestSettings['defaultContext']);
}
if (!defined('AGAVI_TESTING_BOOTSTRAPPED')) {
// when PHPUnit runs with preserve global state enabled, AGAVI_TESTING_BOOTSTRAPPED will already be defined
define('AGAVI_TESTING_BOOTSTRAPPED', true);
}
if (AGAVI_TESTING_ORIGINAL_PHPUNIT_BOOTSTRAP) {
示例6: clear
/**
* Clear all configuration cache files.
*
* @author Sean Kerr <skerr@mojavi.org>
* @since 0.9.0
*/
public static function clear()
{
AgaviToolkit::clearCache(self::CACHE_SUBDIR);
}
示例7: handleCustomTestSuite
/**
* Custom callback for test suite discovery.
* This is called by PHPUnit in the setup process, right after all command line
* arguments have been parsed.
*
* @author Dominik del Bondio <dominik.del.bondio@bitextender.com>
* @since 1.1.0
*/
protected function handleCustomTestSuite()
{
// ensure the bootstrap script doesn't run and bootstraps agavi another time
define('AGAVI_TESTING_BOOTSTRAPPED', true);
AgaviToolkit::clearCache();
$this->bootstrap($this->arguments['agaviEnvironment']);
// use the default configuration only if another configuration was not given as command line argument
$defaultConfigPath = AgaviConfig::get('core.testing_dir') . '/config/phpunit.xml';
if (empty($this->arguments['configuration']) && is_file($defaultConfigPath)) {
$this->arguments['configuration'] = $defaultConfigPath;
}
$this->arguments['configuration'] = $this->expandConfiguration($this->arguments['configuration']);
if (count($this->options[1]) > 0) {
// positional args were given, so the user specified a test or folder on the command line
return;
}
$suites = (require AgaviConfigCache::checkConfig(AgaviConfig::get('core.testing_dir') . '/config/suites.xml'));
$masterSuite = new AgaviTestSuite('Master');
if ($this->arguments['agaviIncludeSuites']) {
foreach ($this->arguments['agaviIncludeSuites'] as $name) {
if (empty($suites[$name])) {
throw new InvalidArgumentException(sprintf('Invalid suite name %1$s.', $name));
}
$masterSuite->addTest(self::createSuite($name, $suites[$name]));
}
} else {
foreach ($suites as $name => $suite) {
if (!in_array($name, $this->arguments['agaviExcludeSuites'])) {
$masterSuite->addTest(self::createSuite($name, $suite));
}
}
}
$this->arguments['test'] = $masterSuite;
}