Fixes a bug where indexing plugin with no name crashes fetchers and queue servers, a=chris

Chris Pollett [2015-01-17 00:Jan:th]
Fixes a bug where indexing plugin with no name crashes fetchers and queue servers, a=chris
Filename
bin/fetcher.php
bin/queue_server.php
configs/default_crawl.ini
controllers/components/crawl_component.php
models/crawl_model.php
views/elements/pageoptions_element.php
diff --git a/bin/fetcher.php b/bin/fetcher.php
index d794a4f22..66bae8c4a 100755
--- a/bin/fetcher.php
+++ b/bin/fetcher.php
@@ -1358,6 +1358,7 @@ class Fetcher implements CrawlConstants
         if(isset($info[self::INDEXING_PLUGINS])) {
             $this->plugin_processors = array();
             foreach($info[self::INDEXING_PLUGINS] as $plugin) {
+                if($plugin == "") { continue; }
                 $plugin_name = $plugin."Plugin";
                 $processors = $plugin_name::getProcessors();
                 $plugin_object = new $plugin_name();
diff --git a/bin/queue_server.php b/bin/queue_server.php
index f1b9adeb0..adc829c1b 100755
--- a/bin/queue_server.php
+++ b/bin/queue_server.php
@@ -963,6 +963,7 @@ class QueueServer implements CrawlConstants, Join
                 crawlLog("... Will now shutdown $num_plugins plugins.");
             }
             foreach($this->indexing_plugins as $plugin) {
+                if($plugin == "") {continue; }
                 $plugin_instance_name =
                     lcfirst($plugin)."Plugin";
                 $plugin_name = $plugin."Plugin";
diff --git a/configs/default_crawl.ini b/configs/default_crawl.ini
index edf581306..cc3df5d67 100644
--- a/configs/default_crawl.ini
+++ b/configs/default_crawl.ini
@@ -178,4 +178,3 @@ url[] = 'http://www.thesun.co.uk/';
 [page_rules]

 [indexing_plugins]
-plugins[] = "";
diff --git a/controllers/components/crawl_component.php b/controllers/components/crawl_component.php
index 7089c1ac2..89a624472 100644
--- a/controllers/components/crawl_component.php
+++ b/controllers/components/crawl_component.php
@@ -206,6 +206,7 @@ class CrawlComponent extends Component implements CrawlConstants
         if(isset($crawl_params[self::INDEXING_PLUGINS]) &&
             is_array($crawl_params[self::INDEXING_PLUGINS])) {
             foreach($crawl_params[self::INDEXING_PLUGINS] as $plugin) {
+                if($plugin == "") {continue;}
                 $plugin_class = $plugin."Plugin";
                 $plugin_obj = $parent->plugin(lcfirst($plugin));
                 if(method_exists($plugin_class, "loadConfiguration")) {
@@ -968,6 +969,7 @@ class CrawlComponent extends Component implements CrawlConstants
                 $seed_info['indexing_plugins']['plugins']
                 : array();
         foreach($parent->indexing_plugins as $plugin) {
+            if($plugin == "") {continue; }
             $plugin_name = ucfirst($plugin);
             $data['INDEXING_PLUGINS'][$plugin_name]['checked'] =
                 (in_array($plugin_name, $included_plugins)) ?
@@ -1198,6 +1200,7 @@ class CrawlComponent extends Component implements CrawlConstants
             $plugin_processors = array();
             if (isset($seed_info['indexing_plugins']['plugins'])) {
                 foreach($seed_info['indexing_plugins']['plugins'] as $plugin) {
+                    if($plugin == "") { continue; }
                     $plugin_name = $plugin."Plugin";
                     $supported_processors = $plugin_name::getProcessors();
                     foreach($supported_processors as $supported_processor) {
diff --git a/models/crawl_model.php b/models/crawl_model.php
index 96665c6c0..569812cd1 100755
--- a/models/crawl_model.php
+++ b/models/crawl_model.php
@@ -550,6 +550,7 @@ EOT;
         $n[] = "[indexing_plugins]";
         if(isset($info["indexing_plugins"]['plugins'])) {
             foreach($info["indexing_plugins"]['plugins'] as $plugin) {
+                if($plugin == "") { continue; }
                 $n[] = "plugins[] = '$plugin';";
             }
         }
diff --git a/views/elements/pageoptions_element.php b/views/elements/pageoptions_element.php
index c4889b3b6..3aced1afa 100644
--- a/views/elements/pageoptions_element.php
+++ b/views/elements/pageoptions_element.php
@@ -219,6 +219,7 @@ class PageOptionsElement extends Element
                 $k = 0;
                 foreach($data['INDEXING_PLUGINS'] as
                     $plugin => $plugin_data) {
+                    if($plugin == "") { continue; }
                 ?>
                 <tr><td><?php e($plugin. "Plugin"); ?></td>
                 <td class="check"><input type="checkbox"
ViewGit