]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2863: Can now use all 6 dep types with conflicts.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 8 Feb 2011 06:14:19 +0000 (06:14 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 8 Feb 2011 06:14:19 +0000 (06:14 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8071 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggPluginManifest.php
engine/classes/ElggPluginPackage.php

index 7c9c0670e36ccd20d544f1acf89b0bf3ba61ad7b..bef099dcdecb5794589491c0a7d57ce05bd0aaf1 100644 (file)
@@ -23,7 +23,7 @@ class ElggPluginManifest {
        protected $parser;
 
        /**
-        * The expected structure of a requires element
+        * The expected structure of a plugins requires element
         */
        private $depsStructPlugin = array(
                'type' => '',
@@ -33,7 +33,7 @@ class ElggPluginManifest {
        );
 
        /**
-        * The expected structure of a requires element
+        * The expected structure of a priority element
         */
        private $depsStructPriority = array(
                'type' => '',
@@ -42,7 +42,7 @@ class ElggPluginManifest {
        );
 
        /*
-        * The expected structure of elgg and elgg_release requires element
+        * The expected structure of elgg_version and elgg_release requires element
         */
        private $depsStructElgg = array(
                'type' => '',
index 2ae686b253c5d431e143b6287d095d233e3cbebd..cc23dcf21ec586fc7bd1761ad21feff8dc7da514 100644 (file)
@@ -353,11 +353,11 @@ class ElggPluginPackage {
                        foreach (${$dep_type} as $dep) {
                                switch ($dep['type']) {
                                        case 'elgg_version':
-                                               $result = $this->checkDepElgg($dep, get_version());
+                                               $result = $this->checkDepElgg($dep, get_version(), $inverse);
                                                break;
 
                                        case 'elgg_release':
-                                               $result = $this->checkDepElgg($dep, get_version(true));
+                                               $result = $this->checkDepElgg($dep, get_version(true), $inverse);
                                                break;
 
                                        case 'plugin':
@@ -369,11 +369,11 @@ class ElggPluginPackage {
                                                break;
 
                                        case 'php_extension':
-                                               $result = $this->checkDepPhpExtension($dep);
+                                               $result = $this->checkDepPhpExtension($dep, $inverse);
                                                break;
 
                                        case 'php_ini':
-                                               $result = $this->checkDepPhpIni($dep);
+                                               $result = $this->checkDepPhpIni($dep, $inverse);
                                                break;
                                }
 
@@ -506,13 +506,14 @@ class ElggPluginPackage {
         *
         * @todo Can this be merged with the plugin checker?
         *
-        * @param array $dep An Elgg manifest.xml deps array
+        * @param array $dep     An Elgg manifest.xml deps array
+        * @param bool  $inverse Inverse the result to use as a conflicts.
         * @return array An array in the form array(
         *      'status' => bool
         *      'value' => string The version provided
         * )
         */
-       private function checkDepPhpExtension(array $dep) {
+       private function checkDepPhpExtension(array $dep, $inverse = false) {
                $name = $dep['name'];
                $version = $dep['version'];
                $comparison = $dep['comparison'];
@@ -542,6 +543,10 @@ class ElggPluginPackage {
                        $ext_version = $provides['value'];
                }
 
+               if ($inverse) {
+                       $status = !$status;
+               }
+
                return array(
                        'status' => $status,
                        'value' => $ext_version
@@ -551,10 +556,11 @@ class ElggPluginPackage {
        /**
         * Check if the PHP ini setting satisfies $dep.
         *
-        * @param array $dep An Elgg manifest.xml deps array
+        * @param array $dep     An Elgg manifest.xml deps array
+        * @param bool  $inverse Inverse the result to use as a conflicts.
         * @return bool
         */
-       private function checkDepPhpIni($dep) {
+       private function checkDepPhpIni($dep, $inverse = false) {
                $name = $dep['name'];
                $value = $dep['value'];
                $comparison = $dep['comparison'];
@@ -570,6 +576,10 @@ class ElggPluginPackage {
 
                $status = version_compare($setting, $value, $comparison);
 
+               if ($inverse) {
+                       $status = !$status;
+               }
+
                return array(
                        'status' => $status,
                        'value' => $setting