]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #3079: Making sure elgg_get_max_plugin_priority() returns 1 instead. Fixed probl...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 14 Mar 2011 22:17:34 +0000 (22:17 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 14 Mar 2011 22:17:34 +0000 (22:17 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8706 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggPlugin.php
engine/lib/plugins.php

index 208d1eff89686096965a689599158dcad334773a..69b3b1c673994c9b8b891d3a22d7da7955ede02d 100644 (file)
@@ -200,10 +200,6 @@ class ElggPlugin extends ElggObject {
                                return false;
                        }
 
-                       if ($priority == $old_priority) {
-                               return false;
-                       }
-
                        // there's nothing above the max.
                        if ($priority > $max_priority) {
                                $priority = $max_priority;
index 981896588ad36097e50f147899717a89f2a9c798..c54c12afd2281efbaad4caf5ad73acf619eccc1e 100644 (file)
@@ -124,8 +124,6 @@ function elgg_generate_plugin_entities() {
                return false;
        }
 
-       $new_plugin_priority = elgg_get_max_plugin_priority() + 1;
-
        // check real plugins against known ones
        foreach ($physical_plugins as $plugin_id) {
                // is this already in the db?
@@ -136,20 +134,16 @@ function elgg_generate_plugin_entities() {
                        if ($plugin->enabled != 'yes') {
                                $plugin->enable();
                                $plugin->deactivate();
-                               $plugin->setPriority($new_plugin_priority);
-
-                               $new_plugin_priority++;
+                               $plugin->setPriority('last');
                        }
 
                        // remove from the list of plugins to disable
                        unset($known_plugins[$index]);
                } else {
                        // add new plugins
+                       // priority is force to last in save() if not set.
                        $plugin = new ElggPlugin($plugin_id);
                        $plugin->save();
-                       $plugin->setPriority($new_plugin_priority);
-
-                       $new_plugin_priority++;
                }
        }
 
@@ -235,11 +229,11 @@ function elgg_get_max_plugin_priority() {
 
        $data = get_data($q);
        if ($data) {
-               return $data[0]->max;
+               $max = $data[0]->max;
        }
 
        // can't have a priority of 0.
-       return 1;
+       return ($max) ? $max : 1;
 }
 
 /**