class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base

Upgrade logic for 4.7

Constants

BATCH_SIZE

Methods

bool
verifyPreDBstate($errors)

Verify DB state.

setPreUpgradeMessage($preUpgradeMessage, string $rev, null $currentVer = NULL)

Compute any messages which should be displayed beforeupgrade.

setPostUpgradeMessage(string $postUpgradeMessage, string $rev)

Compute any messages which should be displayed after upgrade.

static bool
runSql(CRM_Queue_TaskContext $ctx, string $rev)

(Queue Task Callback)

addTask(string $title, string $funcName)

Syntactic sugar for adding a task.

static bool
removePaymentProcessorType(CRM_Queue_TaskContext $ctx, string $name)

Remove a payment processor if not in use

static bool
checkFKExists(string $table_name, string $constraint_name)

No description

static bool
addColumn(CRM_Queue_TaskContext $ctx, string $table, string $column, string $properties, bool $localizable = FALSE, string|null $version = NULL)

Add a column to a table if it doesn't already exist

static 
updateMessageTemplates(CRM_Queue_TaskContext $ctx, string $version)

Do any relevant message template updates.

static bool
updateContributeSettings($ctx)

Re-save any valid values from contribute settings into the normal setting format.

bool
updateSmartGroups(CRM_Queue_TaskContext $ctx, array $actions)

Do any relevant smart group updates.

static bool
dropColumn(CRM_Queue_TaskContext $ctx, string $table, string $column)

Drop a column from a table if it exist.

static bool
addIndex(CRM_Queue_TaskContext $ctx, string $table, string|array $column)

Add a index to a table column.

static bool
dropIndex(CRM_Queue_TaskContext $ctx, string $table, string $indexName)

Drop a index from a table if it exist.

static bool
dropTableIfEmpty(CRM_Queue_TaskContext $ctx, string $table)

Drop a table.

static bool
rebuildMultilingalSchema(CRM_Queue_TaskContext $ctx, string|null $version = NULL)

Rebuild Multilingual Schema.

upgrade_4_7_alpha1(string $rev)

Upgrade function.

upgrade_4_7_alpha4(string $rev)

Upgrade function.

upgrade_4_7_beta2(string $rev)

Upgrade function.

upgrade_4_7_beta6(string $rev)

Upgrade function.

upgrade_4_7_1(string $rev)

Upgrade function.

upgrade_4_7_2(string $rev)

Upgrade function.

upgrade_4_7_3(string $rev)

Upgrade function.

upgrade_4_7_4(string $rev)

Upgrade function.

upgrade_4_7_7(string $rev)

Upgrade function.

upgrade_4_7_8(string $rev)

Upgrade function.

upgrade_4_7_10(string $rev)

Upgrade function.

upgrade_4_7_11(string $rev)

Upgrade function.

upgrade_4_7_12(string $rev)

Upgrade function.

upgrade_4_7_13(string $rev)

Upgrade function.

upgrade_4_7_14(string $rev)

Upgrade function.

upgrade_4_7_15(string $rev)

Upgrade function.

upgrade_4_7_16(string $rev)

Upgrade function.

upgrade_4_7_18(string $rev)

Upgrade function.

upgrade_4_7_19(string $rev)

Upgrade function.

upgrade_4_7_20(string $rev)

Upgrade function.

upgrade_4_7_23(string $rev)

Upgrade function.

upgrade_4_7_25(string $rev)

Upgrade function.

upgrade_4_7_27(string $rev)

Upgrade function.

upgrade_4_7_28(string $rev)

Upgrade function.

upgrade_4_7_31(string $rev)

Upgrade function.

upgrade_4_7_32(string $rev)

Upgrade function.

static int
updateWysiwyg()

CRM-16354

static bool
migrateSettings(CRM_Queue_TaskContext $ctx)

Migrate any last remaining options from civicrm_domain.config_backend to civicrm_setting.

static array
convertBackendToSettings(int $domainId, string $config_backend)

Take a config_backend blob and produce an equivalent list of settings.

static bool
updateContributionInvoiceNumber(CRM_Queue_TaskContext $ctx, int $startID, int $endID, string $invoicePrefix)

Update Invoice number for all completed contribution.

static bool
addGettingStartedDashlet(CRM_Queue_TaskContext $ctx)

Add Getting Started dashlet to dashboard

static bool
migrateOnBehalfOfInfo(CRM_Queue_TaskContext $ctx)

Migrate on-behalf information to uf_join.module_data as on-behalf columns will be dropped on DB upgrade

static bool
migrateRemoteSubmissionsSetting(CRM_Queue_TaskContext $ctx)

v4.7.11 adds a new setting "remote_profile_submissions". This is long-standing feature that existing sites may be using; however, it's a bit prone to abuse. For new sites, the default is to disable it (since that is more secure). For existing sites, the default is to enable it (since that is more compatible).

static bool
fixContactTypeInSmartGroups(CRM_Queue_TaskContext $ctx)

CRM-11782 - Get rid of VALUE_SEPARATOR character in saved search form values

static bool
deleteVersionCheckCacheFile(CRM_Queue_TaskContext $ctx)

CRM-17637 - Ths file location has been moved; delete the old one

static bool
disableFlexibleJobsExtension(CRM_Queue_TaskContext $ctx)

CRM-17669 and CRM-17686, make scheduled jobs more flexible, disable the 4.6 extension if installed

static bool
addIndexFinancialTrxnTrxnID(CRM_Queue_TaskContext $ctx)

CRM-17752 add index to civicrm_financial_trxn.trxn_id (deliberately non-unique).

static bool
addIndexContributionCreditNoteID(CRM_Queue_TaskContext $ctx)

CRM-17882 Add index to civicrm_contribution.credit_note_id.

static bool
addCombinedIndexFinancialItemEntityIDEntityType()

CRM-17775 Add correct index for table civicrm_financial_item.

static 
addRefundAndChargeBackAccountsIfNotExist()

CRM-17951 Add accounts option values for refund and chargeback.

static bool
addIndexContributionSource(CRM_Queue_TaskContext $ctx)

CRM-17999 Add index to civicrm_contribution.source.

static bool
addIndexContributionAmount(CRM_Queue_TaskContext $ctx)

CRM-18124 Add index to civicrm_contribution.total_amount.

static bool
addDeletedByMergeActivityType(CRM_Queue_TaskContext $ctx)

CRM-18124 Add index to civicrm_contribution.total_amount.

static bool
addHelpPreAndHelpPostFieldsPriceFieldValue(CRM_Queue_TaskContext $ctx)

CRM-12252 Add Help Pre and Help Post Fields for Price Field Value Table.

static bool
dropActionScheudleMappingForeignKey(CRM_Queue_TaskContext $ctx)

CRM-18464 Check if Foreign key exists and also drop any index of same name accidentially created.

static bool
upgradeMailingFKs(CRM_Queue_TaskContext $ctx)

CRM-18345 Don't delete mailing data on email/phone deletion Implemented here in CRM-18526

static bool
dashboardSchemaUpdate(CRM_Queue_TaskContext $ctx)

CRM-17663 - Dashboard schema changes

static bool
alterIndexAndTypeForImageURL()

CRM-19100 - Alter Index and Type for Image URL

static bool
addMailingTemplateType()

Add mailing template type.

static bool
addDataTypeColumnToOptionGroupTable()

CRM-18651 Add DataType column to Option Group Table

static bool
addWysiwygPresets()

CRM-19372 Add field to store accepted credit credit cards for a payment processor.

static 
updateKenyanProvinces(CRM_Queue_TaskContext $ctx)

Update Kenyan Provinces to reflect changes per CRM-20062

static 
deprecateStateProvinces(int $countryID, array $provinces)

Deprecate provinces that no longer exist.

static 
populateSMSProviderDomainId()

CRM-19961 Poputate newly added domain id column and add foriegn key onto table.

static bool
addChangeCaseSubjectActivityType(CRM_Queue_TaskContext $ctx)

CRM-16633 - Add activity type for Change Case Status

static 
fixSchemaOnCiviCRMActionSchedule()

CRM-19986 fix schema differnces in civicrm_action_schedule

static 
static bool
tajikistanMissingSubdivisions(CRM_Queue_TaskContext $ctx)

Add in missing Tajikistan Subdivisions

static bool
removeContributionLoggingReports(CRM_Queue_TaskContext $ctx)

Remove the contribution logging reports which have been broken for a very long time.

bool
checkImageUploadDir()

No description

static bool
fixDateFieldsInSmartGroups(CRM_Queue_TaskContext $ctx)

CRM-20572 - Format date fields in Contrib Sybunt custom search's saved criteria.

static bool
civiMailingCreatedDateNull(CRM_Queue_TaskContext $ctx)

CRM-20892 Convert default of created_date in civicrm_mailing table to NULL

Details

bool verifyPreDBstate($errors)

Verify DB state.

Parameters

$errors

Return Value

bool

at line 43
setPreUpgradeMessage($preUpgradeMessage, string $rev, null $currentVer = NULL)

Compute any messages which should be displayed beforeupgrade.

Note: This function is called iteratively for each upcoming revision to the database.

Parameters

$preUpgradeMessage
string $rev a version number, e.g. '4.8.alpha1', '4.8.beta3', '4.8.0'.
null $currentVer

at line 98
setPostUpgradeMessage(string $postUpgradeMessage, string $rev)

Compute any messages which should be displayed after upgrade.

Parameters

string $postUpgradeMessage alterable.
string $rev an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.

static bool runSql(CRM_Queue_TaskContext $ctx, string $rev)

(Queue Task Callback)

Parameters

CRM_Queue_TaskContext $ctx
string $rev

Return Value

bool

protected addTask(string $title, string $funcName)

Syntactic sugar for adding a task.

Task is (a) in this class and (b) has a high priority.

After passing the $funcName, you can also pass parameters that will go to the function. Note that all params must be serializable.

Parameters

string $title
string $funcName

static bool removePaymentProcessorType(CRM_Queue_TaskContext $ctx, string $name)

Remove a payment processor if not in use

Parameters

CRM_Queue_TaskContext $ctx
string $name

Return Value

bool

Exceptions

CiviCRM_API3_Exception

static bool checkFKExists(string $table_name, string $constraint_name)

Parameters

string $table_name
string $constraint_name

Return Value

bool

static bool addColumn(CRM_Queue_TaskContext $ctx, string $table, string $column, string $properties, bool $localizable = FALSE, string|null $version = NULL)

Add a column to a table if it doesn't already exist

Parameters

CRM_Queue_TaskContext $ctx
string $table
string $column
string $properties
bool $localizable is this a field that should be localized
string|null $version CiviCRM version to use if rebuilding multilingual schema

Return Value

bool

static updateMessageTemplates(CRM_Queue_TaskContext $ctx, string $version)

Do any relevant message template updates.

Parameters

CRM_Queue_TaskContext $ctx
string $version

static bool updateContributeSettings($ctx)

Re-save any valid values from contribute settings into the normal setting format.

We render the array of contribution_invoice_settings and any that have metadata defined we add to the correct key. This is safe to run even if no settings are to be converted, per the test in testConvertUpgradeContributeSettings.

Parameters

$ctx

Return Value

bool

bool updateSmartGroups(CRM_Queue_TaskContext $ctx, array $actions)

Do any relevant smart group updates.

Parameters

CRM_Queue_TaskContext $ctx
array $actions

Return Value

bool

static bool dropColumn(CRM_Queue_TaskContext $ctx, string $table, string $column)

Drop a column from a table if it exist.

Parameters

CRM_Queue_TaskContext $ctx
string $table
string $column

Return Value

bool

static bool addIndex(CRM_Queue_TaskContext $ctx, string $table, string|array $column)

Add a index to a table column.

Parameters

CRM_Queue_TaskContext $ctx
string $table
string|array $column

Return Value

bool

static bool dropIndex(CRM_Queue_TaskContext $ctx, string $table, string $indexName)

Drop a index from a table if it exist.

Parameters

CRM_Queue_TaskContext $ctx
string $table
string $indexName

Return Value

bool

static bool dropTableIfEmpty(CRM_Queue_TaskContext $ctx, string $table)

Drop a table.

.. but only if it's empty.

Parameters

CRM_Queue_TaskContext $ctx
string $table

Return Value

bool

static bool rebuildMultilingalSchema(CRM_Queue_TaskContext $ctx, string|null $version = NULL)

Rebuild Multilingual Schema.

Parameters

CRM_Queue_TaskContext $ctx
string|null $version CiviCRM version to use if rebuilding multilingual schema

Return Value

bool

at line 178
upgrade_4_7_alpha1(string $rev)

Upgrade function.

Parameters

string $rev

at line 191
upgrade_4_7_alpha4(string $rev)

Upgrade function.

Parameters

string $rev

at line 202
upgrade_4_7_beta2(string $rev)

Upgrade function.

Parameters

string $rev

at line 212
upgrade_4_7_beta6(string $rev)

Upgrade function.

Parameters

string $rev

at line 223
upgrade_4_7_1(string $rev)

Upgrade function.

Parameters

string $rev

at line 233
upgrade_4_7_2(string $rev)

Upgrade function.

Parameters

string $rev

at line 245
upgrade_4_7_3(string $rev)

Upgrade function.

Parameters

string $rev

at line 255
upgrade_4_7_4(string $rev)

Upgrade function.

Parameters

string $rev

at line 265
upgrade_4_7_7(string $rev)

Upgrade function.

Parameters

string $rev

at line 278
upgrade_4_7_8(string $rev)

Upgrade function.

Parameters

string $rev

at line 288
upgrade_4_7_10(string $rev)

Upgrade function.

Parameters

string $rev

at line 299
upgrade_4_7_11(string $rev)

Upgrade function.

Parameters

string $rev

at line 310
upgrade_4_7_12(string $rev)

Upgrade function.

Parameters

string $rev

at line 320
upgrade_4_7_13(string $rev)

Upgrade function.

Parameters

string $rev

at line 331
upgrade_4_7_14(string $rev)

Upgrade function.

Parameters

string $rev

at line 341
upgrade_4_7_15(string $rev)

Upgrade function.

Parameters

string $rev

at line 352
upgrade_4_7_16(string $rev)

Upgrade function.

Parameters

string $rev

at line 370
upgrade_4_7_18(string $rev)

Upgrade function.

Parameters

string $rev

at line 380
upgrade_4_7_19(string $rev)

Upgrade function.

Parameters

string $rev

at line 403
upgrade_4_7_20(string $rev)

Upgrade function.

Parameters

string $rev

at line 415
upgrade_4_7_23(string $rev)

Upgrade function.

Parameters

string $rev

at line 426
upgrade_4_7_25(string $rev)

Upgrade function.

Parameters

string $rev

at line 451
upgrade_4_7_27(string $rev)

Upgrade function.

Parameters

string $rev

at line 469
upgrade_4_7_28(string $rev)

Upgrade function.

Parameters

string $rev

at line 494
upgrade_4_7_31(string $rev)

Upgrade function.

Parameters

string $rev

at line 506
upgrade_4_7_32(string $rev)

Upgrade function.

Parameters

string $rev

at line 536
static int updateWysiwyg()

CRM-16354

Return Value

int

at line 553
static bool migrateSettings(CRM_Queue_TaskContext $ctx)

Migrate any last remaining options from civicrm_domain.config_backend to civicrm_setting.

Cleanup setting schema.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 623
static array convertBackendToSettings(int $domainId, string $config_backend)

Take a config_backend blob and produce an equivalent list of settings.

Parameters

int $domainId Domain ID.
string $config_backend Serialized blob.

Return Value

array

at line 656
static bool updateContributionInvoiceNumber(CRM_Queue_TaskContext $ctx, int $startID, int $endID, string $invoicePrefix)

Update Invoice number for all completed contribution.

Parameters

CRM_Queue_TaskContext $ctx
int $startID
int $endID
string $invoicePrefix

Return Value

bool

at line 677
static bool addGettingStartedDashlet(CRM_Queue_TaskContext $ctx)

Add Getting Started dashlet to dashboard

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 703
static bool migrateOnBehalfOfInfo(CRM_Queue_TaskContext $ctx)

Migrate on-behalf information to uf_join.module_data as on-behalf columns will be dropped on DB upgrade

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool TRUE for success

at line 773
static bool migrateRemoteSubmissionsSetting(CRM_Queue_TaskContext $ctx)

v4.7.11 adds a new setting "remote_profile_submissions". This is long-standing feature that existing sites may be using; however, it's a bit prone to abuse. For new sites, the default is to disable it (since that is more secure). For existing sites, the default is to enable it (since that is more compatible).

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 798
static bool fixContactTypeInSmartGroups(CRM_Queue_TaskContext $ctx)

CRM-11782 - Get rid of VALUE_SEPARATOR character in saved search form values

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 823
static bool deleteVersionCheckCacheFile(CRM_Queue_TaskContext $ctx)

CRM-17637 - Ths file location has been moved; delete the old one

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 839
static bool disableFlexibleJobsExtension(CRM_Queue_TaskContext $ctx)

CRM-17669 and CRM-17686, make scheduled jobs more flexible, disable the 4.6 extension if installed

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 857
static bool addIndexFinancialTrxnTrxnID(CRM_Queue_TaskContext $ctx)

CRM-17752 add index to civicrm_financial_trxn.trxn_id (deliberately non-unique).

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 870
static bool addIndexContributionCreditNoteID(CRM_Queue_TaskContext $ctx)

CRM-17882 Add index to civicrm_contribution.credit_note_id.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 885
static bool addCombinedIndexFinancialItemEntityIDEntityType()

CRM-17775 Add correct index for table civicrm_financial_item.

Note that the entity ID should always precede the entity_table as it is more unique. This is better for performance and does not cause fallback to no index if table it omitted.

Return Value

bool

at line 900
static addRefundAndChargeBackAccountsIfNotExist()

CRM-17951 Add accounts option values for refund and chargeback.

Add Chargeback contribution status and Chargeback and Contra account relationships, checking first if one exists.

at line 933
static bool addIndexContributionSource(CRM_Queue_TaskContext $ctx)

CRM-17999 Add index to civicrm_contribution.source.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 948
static bool addIndexContributionAmount(CRM_Queue_TaskContext $ctx)

CRM-18124 Add index to civicrm_contribution.total_amount.

Note that I made this a combined index with receive_date because the issue included both criteria and they seemed likely to be used in conjunction to me in other cases.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 965
static bool addDeletedByMergeActivityType(CRM_Queue_TaskContext $ctx)

CRM-18124 Add index to civicrm_contribution.total_amount.

Note that I made this a combined index with receive_date because the issue included both criteria and they seemed likely to be used in conjunction to me in other cases.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 984
static bool addHelpPreAndHelpPostFieldsPriceFieldValue(CRM_Queue_TaskContext $ctx)

CRM-12252 Add Help Pre and Help Post Fields for Price Field Value Table.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1021
static bool dropActionScheudleMappingForeignKey(CRM_Queue_TaskContext $ctx)

CRM-18464 Check if Foreign key exists and also drop any index of same name accidentially created.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1034
static bool upgradeMailingFKs(CRM_Queue_TaskContext $ctx)

CRM-18345 Don't delete mailing data on email/phone deletion Implemented here in CRM-18526

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1093
static bool dashboardSchemaUpdate(CRM_Queue_TaskContext $ctx)

CRM-17663 - Dashboard schema changes

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1130
static bool alterIndexAndTypeForImageURL()

CRM-19100 - Alter Index and Type for Image URL

Return Value

bool

at line 1146
static bool addMailingTemplateType()

Add mailing template type.

Return Value

bool

at line 1161
static bool addDataTypeColumnToOptionGroupTable()

CRM-18651 Add DataType column to Option Group Table

Return Value

bool

at line 1182
static bool addWysiwygPresets()

CRM-19372 Add field to store accepted credit credit cards for a payment processor.

Return Value

bool

at line 1218
static updateKenyanProvinces(CRM_Queue_TaskContext $ctx)

Update Kenyan Provinces to reflect changes per CRM-20062

Parameters

CRM_Queue_TaskContext $ctx

at line 1237
static deprecateStateProvinces(int $countryID, array $provinces)

Deprecate provinces that no longer exist.

Parameters

int $countryID
array $provinces

at line 1269
static populateSMSProviderDomainId()

CRM-19961 Poputate newly added domain id column and add foriegn key onto table.

at line 1293
static bool addChangeCaseSubjectActivityType(CRM_Queue_TaskContext $ctx)

CRM-16633 - Add activity type for Change Case Status

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1308
static fixSchemaOnCiviCRMActionSchedule()

CRM-19986 fix schema differnces in civicrm_action_schedule

at line 1321
static pickActivityRevisionPolicy(CRM_Queue_TaskContext $ctx)

Parameters

CRM_Queue_TaskContext $ctx

at line 1335
static bool tajikistanMissingSubdivisions(CRM_Queue_TaskContext $ctx)

Add in missing Tajikistan Subdivisions

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1357
static bool removeContributionLoggingReports(CRM_Queue_TaskContext $ctx)

Remove the contribution logging reports which have been broken for a very long time.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1384
protected bool checkImageUploadDir()

Return Value

bool

at line 1397
static bool fixDateFieldsInSmartGroups(CRM_Queue_TaskContext $ctx)

CRM-20572 - Format date fields in Contrib Sybunt custom search's saved criteria.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 1411
static bool civiMailingCreatedDateNull(CRM_Queue_TaskContext $ctx)

CRM-20892 Convert default of created_date in civicrm_mailing table to NULL

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool