'
. sprintf('%s |
', ts('[civicrm.files] Path'))
. sprintf('%s | %s |
', ts('5.29 Default value:'), wp_upload_dir()['basedir'] . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR)
. sprintf('%s | %s |
', ts('5.28 Default value:'), CRM_Core_Config::singleton()->userSystem->getDefaultFileStorage()['path'])
. sprintf('%s | %s |
', ts('Active Value:'), Civi::paths()->getVariable('civicrm.files', 'path'))
. sprintf('%s |
', ts('[civicrm.files] URL'))
. sprintf('%s | %s |
', ts('5.29 Default value:'), wp_upload_dir()['baseurl'] . '/civicrm/')
. sprintf('%s | %s |
', ts('5.28 Default value:'), CRM_Core_Config::singleton()->userSystem->getDefaultFileStorage()['url'])
. sprintf('%s | %s |
', ts('Active Value:'), Civi::paths()->getVariable('civicrm.files', 'url'))
. '';
return '' . ts('Starting with version 5.29.0, CiviCRM on WordPress may make a subtle change in the calculation of [civicrm.files]
. To ensure a smooth upgrade, please review the following table. All paths and URLs should appear the same. If there is any discrepancy, then consult the upgrade documentation.', [
1 => 'href="https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/#civicrm-5.29" target="_blank"',
2 => '...wp-content/uploads/civicrm',
]) . '
' . $table;
}
/*
* Important! All upgrade functions MUST add a 'runSql' task.
* Uncomment and use the following template for a new upgrade version
* (change the x in the function name):
*/
/**
* Upgrade function.
*
* @param string $rev
*/
public function upgrade_5_28_alpha1($rev) {
$this->addTask('Populate missing Contact Type name fields', 'populateMissingContactTypeName');
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask('Add icon column to civicrm_custom_group', 'addColumn',
'civicrm_custom_group', 'icon', "varchar(255) COMMENT 'crm-i icon class' DEFAULT NULL");
$this->addTask('Remove index on medium_id from civicrm_activity', 'dropIndex', 'civicrm_activity', 'index_medium_id');
}
public static function populateMissingContactTypeName() {
$contactTypes = \Civi\Api4\ContactType::get(FALSE)
->execute();
foreach ($contactTypes as $contactType) {
if (empty($contactType['name'])) {
\Civi\Api4\ContactType::update()
->addWhere('id', '=', $contactType['id'])
->addValue('name', ucfirst(CRM_Utils_String::munge($contactType['label'])))
->setCheckPermissions(FALSE)
->execute();
}
}
return TRUE;
}
}