$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask('Migrate CiviGrant component to an extension', 'migrateCiviGrant');
if (CRM_Core_Component::isEnabled('CiviGrant')) {
- $this->addExtensionTask('Enable CiviGrant dependencies', ['org.civicrm.search_kit', 'org.civicrm.afform']);
+ $this->addExtensionTask('Enable CiviGrant extension', ['civigrant']);
}
$this->addTask('Add created_date to civicrm_relationship', 'addColumn', 'civicrm_relationship', 'created_date',
"timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Relationship created date'"
}
CRM_Core_DAO::executeQuery("DELETE FROM civicrm_component WHERE name = 'CiviGrant'", [], TRUE, NULL, FALSE, FALSE);
}
+
+ // There are existing records which should be managed by `civigrant`. To assign ownership, we need
+ // placeholders in `civicrm_extension` and `civicrm_managed`.
$ext = new CRM_Core_DAO_Extension();
$ext->full_name = 'civigrant';
if (!$ext->find(TRUE)) {
$ext->name = 'CiviGrant';
$ext->label = ts('CiviGrant');
$ext->file = 'civigrant';
- $ext->is_active = (int) $civiGrantEnabled;
+ $ext->is_active = 0; /* Not active _yet_. If site uses CiviGrant, we will re-activate once the core-schema has been revised. */
$ext->save();
+ CRM_Extension_System::singleton()->getManager()->refresh();
$managedItems = [
'OptionGroup_advanced_search_options_OptionValue_CiviGrant' => [