Commit 1290d87d by Seldaek

git-svn-id: svn://dwoo.org/dwoo/trunk@46 0598d79b-80c4-4d41-97ba-ac86fbbd088b

parent ecad8099
......@@ -1507,17 +1507,23 @@ class Dwoo_Loader
* loads a plugin file
*
* @param string $class the plugin name, without the Dwoo_Plugin_ prefix
* @param bool $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it has just been added, defaults to true
*/
public static function loadPlugin($class)
public static function loadPlugin($class, $forceRehash = true)
{
// a new class was added or the include failed so we rebuild the cache
if(!isset(self::$classpath[$class]) || !include self::$classpath[$class])
{
self::rebuildClassPathCache(DWOO_DIRECTORY . 'plugins', DWOO_COMPILE_DIRECTORY . DIRECTORY_SEPARATOR . 'classpath.cache.php');
foreach(self::$paths as $path=>$file)
self::rebuildClassPathCache($path, $file);
if(isset(self::$classpath[$class]))
include self::$classpath[$class];
if($forceRehash)
{
self::rebuildClassPathCache(DWOO_DIRECTORY . 'plugins', DWOO_COMPILE_DIRECTORY . DIRECTORY_SEPARATOR . 'classpath.cache.php');
foreach(self::$paths as $path=>$file)
self::rebuildClassPathCache($path, $file);
if(isset(self::$classpath[$class]))
include self::$classpath[$class];
else
throw new Dwoo_Exception('Plugin <em>'.$class.'</em> can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
}
else
throw new Dwoo_Exception('Plugin <em>'.$class.'</em> can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
}
......
......@@ -2293,7 +2293,7 @@ class Dwoo_Compiler implements Dwoo_ICompiler
if($pluginType===-1)
{
try {
Dwoo_Loader::loadPlugin($name);
Dwoo_Loader::loadPlugin($name, isset($phpFunc)===false);
} catch (Exception $e) {
if(isset($phpFunc))
$pluginType = Dwoo::NATIVE_PLUGIN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment