]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2763. Better normalizing for unused 1.7 manifest options. Added logging when...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 3 Jan 2011 02:09:15 +0000 (02:09 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 3 Jan 2011 02:09:15 +0000 (02:09 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7819 36083f99-b078-4883-b0ff-0f9b5a30f544

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

index fb9138ab9bc6053f076572d281d1b876c5d1166a..eac98da57a6be2eb5dc51ba74afbd4a692db6b88 100644 (file)
@@ -83,6 +83,7 @@ class ElggPlugin extends ElggObject {
                        $this->manifest = $this->package->getManifest();
                } catch (Exception $e) {
                        // we always have to allow the entity to load.
+                       elgg_log("Failed to load $this->guid as a plugin. " . $e->getMessage(), 'WARNING');
                }
        }
 
index 9fcdaaf55ae46f7060a8944049ee98dbdd8340a7..290a59a0cd0f76495f876491beae02a256d57004 100644 (file)
@@ -330,7 +330,12 @@ class ElggPluginManifest {
         * @return array
         */
        public function getProvides() {
-               $provides = $this->parser->getAttribute('provides');
+               // normalize for 1.7
+               if ($this->getApiVersion() < 1.8) {
+                       $provides = array();
+               } else {
+                       $provides = $this->parser->getAttribute('provides');
+               }
 
                if (!$provides) {
                        $provides = array();
@@ -370,6 +375,8 @@ class ElggPluginManifest {
                                                'comparison' => 'ge'
                                        )
                                );
+                       } else {
+                               $reqs = array();
                        }
                } else {
                        $reqs = $this->parser->getAttribute('requires');
@@ -465,7 +472,12 @@ class ElggPluginManifest {
         * @return array
         */
        public function getConflicts() {
-               $conflicts = $this->parser->getAttribute('conflicts');
+               // normalize for 1.7
+               if ($this->getApiVersion() < 1.8) {
+                       $conflicts = array();
+               } else {
+                       $conflicts = $this->parser->getAttribute('conflicts');
+               }
 
                if (!$conflicts) {
                        $conflicts = array();
index cd74353de07ae22f4385eee4c5068e8287545808..b48f1c6705e2c494b137bf906c1460f937fb986f 100644 (file)
@@ -136,6 +136,9 @@ function elgg_generate_plugin_entities() {
                        if ($plugin->enabled != 'yes') {
                                $plugin->enable();
                                $plugin->deactivate();
+                               $plugin->setPriority($new_plugin_priority);
+
+                               $new_plugin_priority++;
                        }
 
                        // remove from the list of plugins to disable
@@ -154,8 +157,13 @@ function elgg_generate_plugin_entities() {
        // because they are entities, but their dirs were removed.
        // don't delete the entities because they hold settings.
        foreach ($known_plugins as $plugin) {
-               $plugin->deactivate();
-               $plugin->disable();
+               if ($plugin->isActive()) {
+                       $plugin->deactivate();
+                       // remove the priority.
+                       $name = elgg_namespace_plugin_private_setting('internal', 'priority');
+                       remove_private_setting($plugin->guid, $name);
+                       $plugin->disable();
+               }
        }
 
        access_show_hidden_entities($old_access);