Skip to content

Commit

Permalink
warn about wrongly installed plugin
Browse files Browse the repository at this point in the history
When a plugin is installed in the wrong directory, the class loading
will fail. This patch tries to find the correct directory from the
plugin.info.txt (using the base key) and give a hint to the user on how
to fix this.
  • Loading branch information
splitbrain committed Mar 19, 2011
1 parent 04556a0 commit 74efffc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion inc/plugincontroller.class.php
Expand Up @@ -96,7 +96,15 @@ function &load($type,$name,$new=false,$disabled=false){

//construct class and instantiate
$class = $type.'_plugin_'.$name;
if (!class_exists($class)) return null;
if (!class_exists($class)){
# the plugin might be in the wrong directory
$inf = confToHash(DOKU_PLUGIN."$dir/plugin.info.txt");
if($inf['base'] && $inf['base'] != $plugin){
msg("Plugin installed incorrectly. Rename plugin directory '".
hsc($plugin)."' to '".hsc($inf['base'])."'.",-1);
}
return null;
}

$DOKU_PLUGINS[$type][$name] = new $class;
return $DOKU_PLUGINS[$type][$name];
Expand Down

0 comments on commit 74efffc

Please sign in to comment.