Created
April 2, 2010 19:09
-
-
Save kawahara/353563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/config/sfOpenPNEApplicationConfiguration.class.php b/lib/config/sfOpenPNEApplicationConfiguration.class.php | |
index aabc8bd..43b3699 100644 | |
--- a/lib/config/sfOpenPNEApplicationConfiguration.class.php | |
+++ b/lib/config/sfOpenPNEApplicationConfiguration.class.php | |
@@ -19,6 +19,9 @@ abstract class sfOpenPNEApplicationConfiguration extends sfApplicationConfigurat | |
{ | |
static protected $zendLoaded = false; | |
+ protected $globEnablePluginList = array(); | |
+ protected $globEnablePluginControllerList = array(); | |
+ | |
public function initialize() | |
{ | |
mb_internal_encoding('UTF-8'); | |
@@ -377,7 +380,40 @@ abstract class sfOpenPNEApplicationConfiguration extends sfApplicationConfigurat | |
public function globEnablePlugin($pattern, $isControllerPath = false) | |
{ | |
- return $this->globPlugins($pattern, false, $isControllerPath); | |
+ $cacheKey = md5($pattern); | |
+ $cacheHead = substr($cacheKey, 0, 2); | |
+ $cacheDir = sfConfig::get('sf_app_cache_dir').'/config/'; | |
+ | |
+ if ($isControllerPath) | |
+ { | |
+ $cacheFile = $cacheDir.substr($cacheKey, 0, 2).'_glob_enable_plugin_path_controller.php'; | |
+ $cacheProperty = 'globEnablePluginControllerList'; | |
+ } | |
+ else | |
+ { | |
+ $cacheFile = $cacheDir.substr($cacheKey, 0, 2).'_glob_enable_plugin_path.php'; | |
+ $cacheProperty = 'globEnablePluginList'; | |
+ } | |
+ | |
+ $_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); | |
+ file_put_contents($cacheFile, "<?php\nreturn ".var_export($_prop[$cacheHead], true).";"); | |
+ | |
+ return $_prop[$cacheHead][$cacheKey]; | |
} | |
public function getGlobalTemplateDir($templateFile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment