Skip to content

Commit

Permalink
CiviGrant - Install extension during upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Nov 15, 2021
1 parent 870366c commit 2f3e03e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions CRM/Upgrade/Incremental/php/FiveFortyFive.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ public function upgrade_5_45_alpha1($rev): void {
$this->addTask('Add entity_modified_date column to civicrm_managed', 'addColumn',
'civicrm_managed', 'entity_modified_date', "timestamp NULL DEFAULT NULL COMMENT 'When the managed entity was changed from its original settings.'"
);
$this->addTask('Migrate CiviGrant component to an extension', 'migrateCiviGrant');
}

/**
* @param \CRM_Queue_TaskContext $ctx
* @return bool
*/
public static function migrateCiviGrant(CRM_Queue_TaskContext $ctx): bool {
$civiGrantEnabled = in_array('CiviGrant', Civi::settings()->get('enable_components'), TRUE);
if ($civiGrantEnabled) {
CRM_Core_BAO_ConfigSetting::disableComponent('CiviGrant');
}
$ext = new CRM_Core_DAO_Extension();
$ext->full_name = 'civigrant';
if (!$ext->find(TRUE)) {
$ext->type = 'module';
$ext->name = 'CiviGrant';
$ext->label = ts('CiviGrant');
$ext->file = 'civigrant';
$ext->is_active = (int) $civiGrantEnabled;
$ext->save();
}

return TRUE;
}

}

0 comments on commit 2f3e03e

Please sign in to comment.