aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-06 15:23:01 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-06 15:23:01 +0000
commit4b2684e36e226315c5bd4b93f49ab2a5fc121303 (patch)
treef9927c38da56d274dcf732fda2df05896d0749e5 /engine
parent28bb5ab4b12170f7831d584c809e202e07b55a19 (diff)
downloadelgg-4b2684e36e226315c5bd4b93f49ab2a5fc121303.tar.gz
elgg-4b2684e36e226315c5bd4b93f49ab2a5fc121303.tar.bz2
Renamed 'elgg' manifest requirment to 'elgg_version' to be more in line with the current options. Removed assignments in if statements. 1.7 manifest files properly show elgg_version as a requirement.
git-svn-id: http://code.elgg.org/elgg/trunk@7550 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggPluginManifest.php40
-rw-r--r--engine/classes/ElggPluginManifestParser17.php4
-rw-r--r--engine/classes/ElggPluginManifestParser18.php4
-rw-r--r--engine/classes/ElggPluginPackage.php10
-rw-r--r--engine/tests/api/plugins.php10
-rw-r--r--engine/tests/test_files/plugin_18/manifest.xml2
6 files changed, 53 insertions, 17 deletions
diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php
index ccd0d984a..01dcd1046 100644
--- a/engine/classes/ElggPluginManifest.php
+++ b/engine/classes/ElggPluginManifest.php
@@ -234,7 +234,9 @@ class ElggPluginManifest {
* @return string
*/
public function getBlurb() {
- if (!$blurb = elgg_echo($this->parser->getAttribute('blurb'))) {
+ $blurb = elgg_echo($this->parser->getAttribute('blurb'));
+
+ if (!$blurb) {
$blurb = elgg_get_excerpt($this->getDescription());
}
@@ -293,7 +295,9 @@ class ElggPluginManifest {
* @return array
*/
public function getCategories() {
- if (!$cats = $this->parser->getAttribute('category')) {
+ $cats = $this->parser->getAttribute('category');
+
+ if (!$cats) {
$cats = array();
}
@@ -306,7 +310,9 @@ class ElggPluginManifest {
* @return array
*/
public function getScreenshots() {
- if (!$ss = $this->parser->getAttribute('screenshot')) {
+ $ss = $this->parser->getAttribute('screenshot');
+
+ if (!$ss) {
$ss = array();
}
@@ -324,7 +330,9 @@ class ElggPluginManifest {
* @return array
*/
public function getProvides() {
- if (!$provides = $this->parser->getAttribute('provides')) {
+ $provides = $this->parser->getAttribute('provides');
+
+ if (!$provides) {
$provides = array();
}
@@ -351,7 +359,23 @@ class ElggPluginManifest {
* @return array
*/
public function getRequires() {
- if (!$reqs = $this->parser->getAttribute('requires')) {
+ // rewrite the 1.7 style elgg_version as a real requires.
+ if ($this->apiVersion < 1.8) {
+ $elgg_version = $this->parser->getAttribute('elgg_version');
+ if ($elgg_version) {
+ $reqs = array(
+ array(
+ 'type' => 'elgg_version',
+ 'version' => $elgg_version,
+ 'comparison' => 'ge'
+ )
+ );
+ }
+ } else {
+ $reqs = $this->parser->getAttribute('requires');
+ }
+
+ if (!$reqs) {
$reqs = array();
}
@@ -359,7 +383,7 @@ class ElggPluginManifest {
foreach ($reqs as $req) {
switch ($req['type']) {
- case 'elgg':
+ case 'elgg_version':
case 'elgg_release':
$struct = $this->_depsRequiresStructElgg;
break;
@@ -441,7 +465,9 @@ class ElggPluginManifest {
* @return array
*/
public function getConflicts() {
- if (!$conflicts = $this->parser->getAttribute('conflicts')) {
+ $conflicts = $this->parser->getAttribute('conflicts');
+
+ if (!$conflicts) {
$conflicts = array();
}
diff --git a/engine/classes/ElggPluginManifestParser17.php b/engine/classes/ElggPluginManifestParser17.php
index f439b5af0..8e4a79e4f 100644
--- a/engine/classes/ElggPluginManifestParser17.php
+++ b/engine/classes/ElggPluginManifestParser17.php
@@ -45,7 +45,9 @@ class ElggPluginManifestParser17 extends ElggPluginManifestParser {
}
}
- if (!$this->manifest = $elements) {
+ $this->manifest = $elements;
+
+ if (!$this->manifest) {
return false;
}
diff --git a/engine/classes/ElggPluginManifestParser18.php b/engine/classes/ElggPluginManifestParser18.php
index 54aa9603f..9a4cfb2b7 100644
--- a/engine/classes/ElggPluginManifestParser18.php
+++ b/engine/classes/ElggPluginManifestParser18.php
@@ -91,7 +91,9 @@ class ElggPluginManifestParser18 extends ElggPluginManifestParser {
}
}
- if (!$this->manifest = $parsed) {
+ $this->manifest = $parsed;
+
+ if (!$this->manifest) {
return false;
}
diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php
index c00df7f8d..8bb1f2a69 100644
--- a/engine/classes/ElggPluginPackage.php
+++ b/engine/classes/ElggPluginPackage.php
@@ -42,7 +42,7 @@ class ElggPluginPackage {
* @var array
*/
private $_depsSupportedTypes = array(
- 'elgg', 'elgg_release', 'php_extension', 'php_ini', 'plugin'
+ 'elgg_version', 'elgg_release', 'php_extension', 'php_ini', 'plugin'
);
/**
@@ -274,7 +274,9 @@ class ElggPluginPackage {
*/
private function _loadManifest() {
$file = $this->path . 'manifest.xml';
- if ($this->manifest = new ElggPluginManifest($file, $this->id)) {
+ $this->manifest = new ElggPluginManifest($file, $this->id);
+
+ if ($this->manifest) {
return true;
}
@@ -312,7 +314,7 @@ class ElggPluginPackage {
foreach (${$dep_type} as $dep) {
switch ($dep['type']) {
- case 'elgg':
+ case 'elgg_version':
$result = $this->_checkDepElgg($dep, get_version());
break;
@@ -484,7 +486,7 @@ class ElggPluginPackage {
foreach ($requires as $require) {
switch ($require['type']) {
- case 'elgg':
+ case 'elgg_version':
$result = $this->_checkRequiresElgg($require, get_version());
break;
diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php
index 61e2cdde6..c99609559 100644
--- a/engine/tests/api/plugins.php
+++ b/engine/tests/api/plugins.php
@@ -72,7 +72,7 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
'license' => 'GNU Public License version 2',
'requires' => array(
- array('type' => 'elgg', 'version' => '3009030802', 'comparison' => 'lt'),
+ array('type' => 'elgg_version', 'version' => '3009030802', 'comparison' => 'lt'),
array('type' => 'elgg_release', 'version' => '1.8-svn'),
array('type' => 'php_extension', 'name' => 'gd'),
array('type' => 'php_ini', 'name' => 'short_open_tag', 'value' => 'off'),
@@ -175,7 +175,7 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
public function testElggPluginManifestGetRequires() {
$requires = array(
- array('type' => 'elgg', 'version' => '3009030802', 'comparison' => 'lt'),
+ array('type' => 'elgg_version', 'version' => '3009030802', 'comparison' => 'lt'),
array('type' => 'elgg_release', 'version' => '1.8-svn', 'comparison' => 'ge'),
array('type' => 'php_extension', 'name' => 'gd', 'version' => '', 'comparison' => '='),
array('type' => 'php_ini', 'name' => 'short_open_tag', 'value' => 'off', 'comparison' => '='),
@@ -187,7 +187,11 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->package18->getManifest()->getRequires(), $requires);
- $this->assertEqual($this->package17->getManifest()->getRequires(), array());
+ $requires = array(
+ array('type' => 'elgg_version', 'version' => '2009030702', 'comparison' => 'ge')
+ );
+
+ $this->assertEqual($this->package17->getManifest()->getRequires(), $requires);
}
public function testElggPluginManifestGetDescription() {
diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml
index 182117a50..454a418f6 100644
--- a/engine/tests/test_files/plugin_18/manifest.xml
+++ b/engine/tests/test_files/plugin_18/manifest.xml
@@ -10,7 +10,7 @@
<license>GNU Public License version 2</license>
<requires>
- <type>elgg</type>
+ <type>elgg_version</type>
<version>3009030802</version>
<comparison>lt</comparison>
</requires>