]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2820, Fixes #2823. Using elgg_get_plugins() in elgg_get_plugins_provides(...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 4 Feb 2011 03:12:48 +0000 (03:12 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 4 Feb 2011 03:12:48 +0000 (03:12 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8010 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggPluginPackage.php
engine/lib/deprecated-1.8.php
engine/lib/plugins.php

index d7392132cc2c928939ceec86e60615b5ed0bb194..01437a4e4158f8f1f74cc0e76e960151e53c632c 100644 (file)
@@ -489,28 +489,6 @@ class ElggPluginPackage {
                );
        }
 
-       /**
-        * Activate the plugin.
-        *
-        * @note This method is activate() to avoid clashing with ElggEntity::enable()
-        *
-        * @return bool
-        */
-       public function activate() {
-               return enable_plugin($this->getID());
-       }
-
-       /**
-        * Deactivate the plugin.
-        *
-        * @note This method is deactivate() to avoid clashing with ElggEntity::disable()
-        *
-        * @return bool
-        */
-       public function deactivate() {
-               return disable_plugin($this->getID());
-       }
-
        /**
         * Returns the Plugin ID
         *
index dbe53c1155e819fa02c63a2da4ea7c6455ac3b04..3db32c5226c23c73e4899f079e811f8cc572f38a 100644 (file)
@@ -49,7 +49,7 @@ function register_action($action, $public = false, $filename = "", $admin_only =
  * @param int    $priority       Optional priority to govern the appearance in the list.
  *
  * @deprecated 1.8 Extend admin views manually
- * 
+ *
  * @return void
  */
 function extend_elgg_admin_page($new_admin_view, $view = 'admin/main', $priority = 500) {
@@ -1162,7 +1162,7 @@ function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type
  * @param bool   $pagination     Display pagination? Default: true
  *
  * @return string List of ElggEntities suitable for display
- * 
+ *
  * @deprecated 1.8 Use elgg_list_entities_from_metadata() instead
  */
 function list_entities_from_metadata_multi($meta_array, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = true, $pagination = true) {
@@ -1610,10 +1610,20 @@ function get_installed_plugins($status = 'all') {
                        continue;
                }
 
-               $installed_plugins[$plugin->getID()] = array(
-                       'active' => $plugin->isActive(),
-                       'manifest' => $plugin->manifest->getManifest()
-               );
+               $include = true;
+
+               if ($status == 'enabled' && !$plugin->isActive()) {
+                       $include = false;
+               } elseif ($status == 'disabled' && $plugin->isActive()) {
+                       $include = true;
+               }
+
+               if ($include) {
+                       $installed_plugins[$plugin->getID()] = array(
+                               'active' => $plugin->isActive(),
+                               'manifest' => $plugin->manifest->getManifest()
+                       );
+               }
        }
 
        return $installed_plugins;
@@ -2396,7 +2406,7 @@ $owner_guid = "", $owner_relationship = "") {
  * @param string $password The password, optionally (for standard logins)
  *
  * @return ElggUser|false The authenticated user object, or false on failure.
- * 
+ *
  * @deprecated 1.8 Use elgg_authenticate
  */
 function authenticate($username, $password) {
@@ -2468,7 +2478,7 @@ function list_site_members($site_guid, $limit = 10, $fullview = true) {
  * @param int $collection_guid Collection GUID
  *
  * @return mixed
- * @deprecated 1.8 
+ * @deprecated 1.8
  */
 function add_site_collection($site_guid, $collection_guid) {
        elgg_deprecated_notice("add_site_collection has been deprecated", 1.8);
index 783827d27f7dbe42f70d22c751f09c5bc4fd6fed..2174814bd2270373ad54f4bbe7f191a3348e3e86 100644 (file)
@@ -551,16 +551,13 @@ function elgg_get_calling_plugin_id($mainfilename = false) {
  */
 function elgg_get_plugins_provides($type = null, $name = null) {
        static $provides = null;
-       $active_plugins = get_installed_plugins('enabled');
+       $active_plugins = elgg_get_plugins('active');
 
        if (!isset($provides)) {
                $provides = array();
 
-               foreach ($active_plugins as $plugin_id => $plugin_info) {
-                       // @todo remove this when fully converted to ElggPluginPackage.
-                       $package = new ElggPluginPackage($plugin_id);
-
-                       if ($plugin_provides = $package->getManifest()->getProvides()) {
+               foreach ($active_plugins as $plugin) {
+                       if ($plugin_provides = $plugin->manifest->getProvides()) {
                                foreach ($plugin_provides as $provided) {
                                        $provides[$provided['type']][$provided['name']] = array(
                                                'version' => $provided['version'],
@@ -621,7 +618,7 @@ function elgg_check_plugins_provides($type, $name, $version = null, $comparison
        }
 
        return array(
-               'status' => $r,
+               'status' => $status,
                'value' => $version
        );
 }
@@ -716,6 +713,8 @@ function elgg_get_plugin_dependency_strings($dep) {
 
        if ($dep['status']) {
                $strings['comment'] = elgg_echo('ok');
+       } else {
+               $strings['comment'] = elgg_echo('error');
        }
 
        return $strings;