Skip to content

Instantly share code, notes, and snippets.

@videlalvaro
Created February 19, 2010 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save videlalvaro/309087 to your computer and use it in GitHub Desktop.
Save videlalvaro/309087 to your computer and use it in GitHub Desktop.
<?php
/**
The modifications to this class caches in APC all the file system scans that symfony does to find plugins paths, configurations files, modules, etc.
**/
class frontendConfiguration extends sfApplicationConfiguration
{
public function callFromApc($method, $args)
{
$key = get_called_class() . ':' . $method . ':' . md5(serialize($args));
$return = apc_fetch($key);
if($return === false)
{
$return = call_user_func_array('parent::'. $method, $args);
apc_add($key, $return, 0);
}
return $return;
}
public function getConfigPaths($configPath)
{
return $this->callFromApc('getConfigPaths', func_get_args());
}
public function getControllerDirs($moduleName)
{
return $this->callFromApc('getControllerDirs', func_get_args());
}
public function getLibDirs($moduleName)
{
return $this->callFromApc('getLibDirs', func_get_args());
}
public function getTemplateDirs($moduleName)
{
return $this->callFromApc('getTemplateDirs', func_get_args());
}
public function getHelperDirs($moduleName = '')
{
return $this->callFromApc('getHelperDirs', func_get_args());
}
public function getTemplateDir($moduleName, $templateFile)
{
return $this->callFromApc('getTemplateDir', func_get_args());
}
public function getTemplatePath($moduleName, $templateFile)
{
return $this->callFromApc('getTemplatePath', func_get_args());
}
public function getDecoratorDir($template)
{
return $this->callFromApc('getDecoratorDir', func_get_args());
}
public function getDecoratorDirs()
{
return $this->callFromApc('getDecoratorDirs', func_get_args());
}
public function getI18NGlobalDirs()
{
return $this->callFromApc('getI18NGlobalDirs', func_get_args());
}
public function getI18NDirs($moduleName)
{
return $this->callFromApc('getI18NDirs', func_get_args());
}
public function getModelDirs()
{
return $this->callFromApc('getModelDirs', func_get_args());
}
public function getGeneratorTemplateDirs($class, $theme)
{
return $this->callFromApc('getGeneratorTemplateDirs', func_get_args());
}
public function getGeneratorSkeletonDirs($class, $theme)
{
return $this->callFromApc('getGeneratorSkeletonDirs', func_get_args());
}
public function getGeneratorTemplate($class, $theme, $path)
{
return $this->callFromApc('getGeneratorTemplate', func_get_args());
}
public function getPluginSubPaths($subPath = '')
{
return $this->callFromApc('getPluginSubPaths', func_get_args());
}
public function getPluginPaths()
{
return $this->callFromApc('getPluginPaths', func_get_args());
}
public function getAllPluginPaths()
{
return $this->callFromApc('getAllPluginPaths', func_get_args());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment