]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2852: Checking other plugins' conflicts to see if plugin is able to be activat...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 5 Feb 2011 19:53:33 +0000 (19:53 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 5 Feb 2011 19:53:33 +0000 (19:53 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8034 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggPluginPackage.php
engine/lib/plugins.php

index 84cb8c1dbc3517207d6ffe7ecf5cf13a7636340a..48a5fc4a8fcefde4e9790b6f4ebbc25f3b1b6ef4 100644 (file)
@@ -313,8 +313,33 @@ class ElggPluginPackage {
                $requires = $this->getManifest()->getRequires();
                $conflicts = $this->getManifest()->getConflicts();
                $enabled_plugins = elgg_get_plugins('active');
+               $this_id = $this->getID();
                $report = array();
 
+               // first, check if any active plugin conflicts with us.
+               foreach ($enabled_plugins as $plugin) {
+                       $temp_conflicts = $plugin->manifest->getConflicts();
+                       foreach ($temp_conflicts as $conflict) {
+                               if ($conflict['type'] == 'plugin' && $conflict['name'] == $this_id) {
+                                       $result = $this->checkDepPlugin($conflict, $enabled_plugins, false);
+
+                                       // rewrite the conflict to show the originating plugin
+                                       $conflict['name'] = $plugin->manifest->getName();
+
+                                       if (!$full_report && !$result['status']) {
+                                               return $result['status'];
+                                       } else {
+                                               $report[] = array(
+                                                       'type' => 'conflicted',
+                                                       'dep' => $conflict,
+                                                       'status' => $result['status'],
+                                                       'value' => $this->getManifest()->getVersion()
+                                               );
+                                       }
+                               }
+                       }
+               }
+
                foreach (array('requires', 'conflicts') as $dep_type) {
                        $inverse = ($dep_type == 'conflicts') ? true : false;
 
index 5cb6d23f67c43f819a801c45bbc42c3b6f5cb2cb..f356ed253fbe6ee071cc64baaeebe2dd656f600a 100644 (file)
@@ -667,6 +667,7 @@ function elgg_get_plugin_dependency_strings($dep) {
        'requires'      'plugin oauth_lib'      <1.3    1.3             'downgrade'
        'requires'      'php setting bob'       >3              3               'change it'
        'conflicts'     'php setting'           >3              4               'change it'
+       'conflicted''plugin profile'    any             1.8             'disable profile'
        'provides'      'plugin oauth_lib'      1.3             --              --
        'priority'      'before blog'           --              after   'move it'
        */
@@ -705,9 +706,9 @@ function elgg_get_plugin_dependency_strings($dep) {
 
                case 'plugin':
                        $strings['name'] = elgg_echo('ElggPlugin:Dependencies:Plugin', array($info['name']));
-                       $expected = $info['version'] ? "$comparison {$info['version']}" : '';
+                       $expected = $info['version'] ? "$comparison {$info['version']}" : elgg_echo('any');
                        $strings['expected_value'] = $expected;
-                       $strings['local_value'] = $dep['value'];
+                       $strings['local_value'] = $dep['value'] ? $dep['value'] : '--';
                        $strings['comment'] = '';
                        break;