From ce7fb7d76f8bc2d0c23b5fa8208fe9fbd668db9a Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Tue, 18 Sep 2012 01:24:46 +0200
Subject: [PATCH] Only complain about invalid plugin names when plugins are
 loaded FS#2595

This fixes error messages about invalid plugin names for directories in
the plugin directory which didn't contain any plugin. Now the message is
only displayed for plugins which couldn't be loaded because of the
invalid name.
---
 inc/plugincontroller.class.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php
index 968d47a5c..0b4041a77 100644
--- a/inc/plugincontroller.class.php
+++ b/inc/plugincontroller.class.php
@@ -97,6 +97,9 @@ class Doku_Plugin_Controller {
             $inf = confToHash(DOKU_PLUGIN."$dir/plugin.info.txt");
             if($inf['base'] && $inf['base'] != $plugin){
                 msg(sprintf("Plugin installed incorrectly. Rename plugin directory '%s' to '%s'.", hsc($plugin), hsc($inf['base'])), -1);
+            } elseif (preg_match('/^'.DOKU_PLUGIN_NAME_REGEX.'$/', $plugin) !== 1) {
+                msg(sprintf("Plugin name '%s' is not a valid plugin name, only the characters a-z and 0-9 are allowed. ".
+                                'Maybe the plugin has been installed in the wrong directory?', hsc($plugin)), -1);
             }
             return null;
         }
@@ -156,10 +159,6 @@ class Doku_Plugin_Controller {
                 } else {
                     $all_plugins[$plugin] = 1;
                 }
-                if ($all_plugins[$plugin] == 1 && preg_match('/^'.DOKU_PLUGIN_NAME_REGEX.'$/', $plugin) !== 1) {
-                    msg(sprintf("Plugin name '%s' is not a valid plugin name, only the characters a-z and 0-9 are allowed. ".
-                                 'Maybe the plugin has been installed in the wrong directory?', hsc($plugin)), -1);
-                }
             }
             $this->tmp_plugins = $all_plugins;
             if (!file_exists($this->last_local_config_file)) {
-- 
GitLab