if (!empty($compat[$info->key]['obsolete'])) {
continue;
}
- $row = (array) $info;
+ $row = self::fillMissingInfoKeys((array) $info);
$row['id'] = $info->key;
$row['upgradelink'] = '';
$action = CRM_Core_Action::UPDATE;
* @return array
*/
public static function createExtendedInfo(CRM_Extension_Info $obj) {
- return CRM_Extension_System::createExtendedInfo($obj);
+ return self::fillMissingInfoKeys(CRM_Extension_System::createExtendedInfo($obj));
+ }
+
+ /**
+ * Extension templates expect certain keys to always be set, but these might be missing from the relevant info.xml files
+ * This ensures the expect keys are always set.
+ *
+ * @param array $info
+ * @return array
+ */
+ private static function fillMissingInfoKeys(array $info) {
+ $defaultKeys = [
+ 'urls' => [],
+ 'authors' => [],
+ 'version' => '',
+ 'description' => '',
+ 'license' => '',
+ 'path' => '',
+ 'releaseDate' => '',
+ 'downloadUrl' => FALSE,
+ 'compatibility' => FALSE,
+ 'develStage' => FALSE,
+ 'comments' => FALSE,
+ ];
+ $info = array_merge($defaultKeys, $info);
+ foreach ($info['authors'] as &$author) {
+ $author = array_merge(['homepage' => ''], $author);
+ }
+ return $info;
}
}