aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggPluginManifest.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-04 21:04:34 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-04 21:04:34 +0000
commit1026deb7ef24677a2a0b48b4297911a4c2eceb6d (patch)
treef155d96d9369aab9adae2f2c07c69fac1fd84914 /engine/classes/ElggPluginManifest.php
parent21874b0235acfe83d9f260d9bc71489dbce9172f (diff)
downloadelgg-1026deb7ef24677a2a0b48b4297911a4c2eceb6d.tar.gz
elgg-1026deb7ef24677a2a0b48b4297911a4c2eceb6d.tar.bz2
Added new priority 'requires' for plugin dep system. You can now say that a plugin is required to be after / before another plugin in the system.
git-svn-id: http://code.elgg.org/elgg/trunk@8016 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggPluginManifest.php')
-rw-r--r--engine/classes/ElggPluginManifest.php67
1 files changed, 41 insertions, 26 deletions
diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php
index 9ddf60396..95f008f98 100644
--- a/engine/classes/ElggPluginManifest.php
+++ b/engine/classes/ElggPluginManifest.php
@@ -32,6 +32,15 @@ class ElggPluginManifest {
'comparison' => 'ge'
);
+ /**
+ * The expected structure of a requires element
+ */
+ private $depsRequiresStructPriority = array(
+ 'type' => '',
+ 'name' => '',
+ 'priority' => '',
+ );
+
/*
* The expected structure of elgg and elgg_release requires element
*/
@@ -405,6 +414,10 @@ class ElggPluginManifest {
$struct = $this->depsRequiresStructPlugin;
break;
+ case 'priority':
+ $struct = $this->depsRequiresStructPriority;
+ break;
+
case 'php_extension':
$struct = $this->depsRequiresStructPhpExtension;
break;
@@ -438,32 +451,34 @@ class ElggPluginManifest {
$normalized_req = $this->buildStruct($struct, $req);
// normalize comparison operators
- switch ($normalized_req['comparison']) {
- case '<':
- $normalized_req['comparison'] = 'lt';
- break;
-
- case '<=':
- $normalized_req['comparison'] = 'le';
- break;
-
- case '>':
- $normalized_req['comparison'] = 'gt';
- break;
-
- case '>=':
- $normalized_req['comparison'] = 'ge';
- break;
-
- case '==':
- case 'eq':
- $normalized_req['comparison'] = '=';
- break;
-
- case '<>':
- case 'ne':
- $normalized_req['comparison'] = '!=';
- break;
+ if (isset($normalized_req['comparison'])) {
+ switch ($normalized_req['comparison']) {
+ case '<':
+ $normalized_req['comparison'] = 'lt';
+ break;
+
+ case '<=':
+ $normalized_req['comparison'] = 'le';
+ break;
+
+ case '>':
+ $normalized_req['comparison'] = 'gt';
+ break;
+
+ case '>=':
+ $normalized_req['comparison'] = 'ge';
+ break;
+
+ case '==':
+ case 'eq':
+ $normalized_req['comparison'] = '=';
+ break;
+
+ case '<>':
+ case 'ne':
+ $normalized_req['comparison'] = '!=';
+ break;
+ }
}
$normalized[] = $normalized_req;