OSDN Git Service

Caching existed plugins and entities. Thank you Nekyo and machu!
authorhenoheno <henoheno>
Thu, 4 Nov 2004 12:11:18 +0000 (21:11 +0900)
committerhenoheno <henoheno>
Thu, 4 Nov 2004 12:11:18 +0000 (21:11 +0900)
lib/plugin.php

index 7ad17a3..a60541f 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: plugin.php,v 1.4 2004/10/31 03:45:52 henoheno Exp $
+// $Id: plugin.php,v 1.5 2004/11/04 12:11:18 henoheno Exp $
 //
 
 // ¥×¥é¥°¥¤¥óÍѤË̤ÄêµÁ¤Î¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤òÀßÄê
@@ -16,12 +16,18 @@ function set_plugin_messages($messages)
 //¥×¥é¥°¥¤¥ó¤¬Â¸ºß¤¹¤ë¤«
 function exist_plugin($name)
 {
+       static $exists = array();
+
        $name = strtolower($name);      // Âçʸ»ú¤È¾®Ê¸»ú¤ò¶èÊ̤·¤Ê¤¤¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥àÂкö
+       if(isset($exists[$name])) return $exists[$name];
+
        if (preg_match('/^\w{1,64}$/', $name) &&
            file_exists(PLUGIN_DIR . $name . '.inc.php')) {
+               $exists[$name] = TRUE;
                require_once(PLUGIN_DIR . $name . '.inc.php');
                return TRUE;
        } else {
+               $exists[$name] = FALSE;
                return FALSE;
        }
 }