Toward CRM-19414
authorAllen Shaw <allen@JoineryHQ.com>
Mon, 26 Sep 2016 19:58:57 +0000 (14:58 -0500)
committerAllen Shaw <allen@JoineryHQ.com>
Mon, 26 Sep 2016 19:58:57 +0000 (14:58 -0500)
CRM/Admin/Page/Extensions.php
CRM/Extension/System.php

index b595b59162721c4c4a04cf3c7e44ceb5b4c135bf..257a2faac52bc4fb60108ca2ee304ee65df05581 100644 (file)
@@ -296,43 +296,7 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
    * @return array
    */
   public static function createExtendedInfo(CRM_Extension_Info $obj) {
-    $mapper = CRM_Extension_System::singleton()->getMapper();
-    $manager = CRM_Extension_System::singleton()->getManager();
-
-    $extensionRow = (array) $obj;
-    try {
-      $extensionRow['path'] = $mapper->keyToBasePath($obj->key);
-    }
-    catch (CRM_Extension_Exception $e) {
-      $extensionRow['path'] = '';
-    }
-    $extensionRow['status'] = $manager->getStatus($obj->key);
-
-    switch ($extensionRow['status']) {
-      case CRM_Extension_Manager::STATUS_UNINSTALLED:
-        $extensionRow['statusLabel'] = ''; // ts('Uninstalled');
-        break;
-
-      case CRM_Extension_Manager::STATUS_DISABLED:
-        $extensionRow['statusLabel'] = ts('Disabled');
-        break;
-
-      case CRM_Extension_Manager::STATUS_INSTALLED:
-        $extensionRow['statusLabel'] = ts('Enabled'); // ts('Installed');
-        break;
-
-      case CRM_Extension_Manager::STATUS_DISABLED_MISSING:
-        $extensionRow['statusLabel'] = ts('Disabled (Missing)');
-        break;
-
-      case CRM_Extension_Manager::STATUS_INSTALLED_MISSING:
-        $extensionRow['statusLabel'] = ts('Enabled (Missing)'); // ts('Installed');
-        break;
-
-      default:
-        $extensionRow['statusLabel'] = '(' . $extensionRow['status'] . ')';
-    }
-    return $extensionRow;
+    return CRM_Extension_System::createExtendedInfo($obj);
   }
 
 }
index 98937ff2742205ea2ce8e80a19ebf5218921a57a..e117ebc5c5302e68be17046f732434ef8937a99b 100644 (file)
@@ -285,4 +285,53 @@ class CRM_Extension_System {
     return $this->_repoUrl;
   }
 
+  /**
+   * Take an extension's raw XML info and add information about the
+   * extension's status on the local system.
+   *
+   * The result format resembles the old CRM_Core_Extensions_Extension.
+   *
+   * @param CRM_Extension_Info $obj
+   *
+   * @return array
+   */
+  public static function createExtendedInfo(CRM_Extension_Info $obj) {
+    $mapper = CRM_Extension_System::singleton()->getMapper();
+    $manager = CRM_Extension_System::singleton()->getManager();
+
+    $extensionRow = (array) $obj;
+    try {
+      $extensionRow['path'] = $mapper->keyToBasePath($obj->key);
+    }
+    catch (CRM_Extension_Exception $e) {
+      $extensionRow['path'] = '';
+    }
+    $extensionRow['status'] = $manager->getStatus($obj->key);
+
+    switch ($extensionRow['status']) {
+      case CRM_Extension_Manager::STATUS_UNINSTALLED:
+        $extensionRow['statusLabel'] = ''; // ts('Uninstalled');
+        break;
+
+      case CRM_Extension_Manager::STATUS_DISABLED:
+        $extensionRow['statusLabel'] = ts('Disabled');
+        break;
+
+      case CRM_Extension_Manager::STATUS_INSTALLED:
+        $extensionRow['statusLabel'] = ts('Enabled'); // ts('Installed');
+        break;
+
+      case CRM_Extension_Manager::STATUS_DISABLED_MISSING:
+        $extensionRow['statusLabel'] = ts('Disabled (Missing)');
+        break;
+
+      case CRM_Extension_Manager::STATUS_INSTALLED_MISSING:
+        $extensionRow['statusLabel'] = ts('Enabled (Missing)'); // ts('Installed');
+        break;
+
+      default:
+        $extensionRow['statusLabel'] = '(' . $extensionRow['status'] . ')';
+    }
+    return $extensionRow;
+  }
 }