]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #3079: Better checks in ElggPlugin::setPriority() to avoid priorities of 0....
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 13 Mar 2011 19:33:03 +0000 (19:33 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 13 Mar 2011 19:33:03 +0000 (19:33 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8693 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggPlugin.php

index 18d97d23a83a335609d5c0203f7cb772fede2d1e..208d1eff89686096965a689599158dcad334773a 100644 (file)
@@ -177,8 +177,9 @@ class ElggPlugin extends ElggObject {
 
                $db_prefix = get_config('dbprefix');
                $name = elgg_namespace_plugin_private_setting('internal', 'priority');
-               // if no priority assume a priority of 0
+               // if no priority assume a priority of 1
                $old_priority = (int) $this->getPriority();
+               $old_priority = (!$old_priority) ? 1 : $old_priority;
                $max_priority = elgg_get_max_plugin_priority();
 
                // can't use switch here because it's not strict and
@@ -194,7 +195,7 @@ class ElggPlugin extends ElggObject {
                }
 
                // should be a number by now
-               if ($priority) {
+               if ($priority > 0) {
                        if (!is_numeric($priority)) {
                                return false;
                        }
@@ -234,7 +235,6 @@ class ElggPlugin extends ElggObject {
 
                        // set this priority
                        if ($this->set($name, $priority)) {
-                               //return elgg_plugins_reindex_priorities();
                                return true;
                        } else {
                                return false;