class CRM_Upgrade_Incremental_php_FourFour extends CRM_Upgrade_Incremental_Base

Upgrade logic for 4.4

Constants

BATCH_SIZE

MAX_WORD_REPLACEMENT_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.

bool
upgrade_4_4_alpha1(string $rev)

Upgrade 4.4.alpha1.

upgrade_4_4_beta1($rev)

No description

upgrade_4_4_1($rev)

No description

bool
upgrade_4_4_4($rev)

No description

upgrade_4_4_6($rev)

No description

upgrade_4_4_7(string $rev, string $originalVer, string $latestVer)

Upgrade script for 4.4.7.

static bool
upgradeImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId)

Upgrade image URLs.

static bool
changeSavedSearch(CRM_Queue_TaskContext $ctx)

Change saved search.

static bool
cleanupBackendImageUrls(CRM_Queue_TaskContext $ctx, int $startId, int $endId)

For WordPress/Joomla(?) sites which upgraded to 4.4.6, find back-end image_URLs (e.g. "http://example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm/contact/imagefile&photo=123.jpg") and convert them to front-end URLs (e.g. "http://example.com/?page=CiviCRM&q=civicrm/contact/imagefile&photo=123.jpg").

static CRM_Core_DAO
findContactImageUrls(int $startId, int $endId)

No description

static 
setContactImageUrl(int $cid, string $newImageUrl)

No description

static bool
activityContacts(CRM_Queue_TaskContext $ctx)

Update activity contacts CRM-12274

static bool
wordReplacements(CRM_Queue_TaskContext $ctx)

Migrate word-replacements from $config to civicrm_word_replacement

static bool
wordReplacements_patch(CRM_Queue_TaskContext $ctx, $rev)

Fix misconfigured constraints created in 4.4.0. To distinguish the good and bad configurations, we change the constraint name from "UI_find" (the original name in 4.4.0) to "UI_domain_find" (the new name in 4.4.1).

static array
getConfigArraysAsAPIParams(bool $rebuildEach)

Get all the word-replacements stored in config-arrays and convert them to params for the WordReplacement.create API.

static 
rebuildWordReplacementTable()

Get all the word-replacements stored in config-arrays and write them out as records in civicrm_word_replacement.

updateReportInstanceTable()

CRM-13998 missing alter statements for civicrm_report_instance

static bool
isValidWordReplacement(array $params)

No description

Details

bool verifyPreDBstate($errors)

Verify DB state.

Parameters

$errors

Return Value

bool

at line 45
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 70
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 106
bool upgrade_4_4_alpha1(string $rev)

Upgrade 4.4.alpha1.

Parameters

string $rev

Return Value

bool

at line 119
upgrade_4_4_beta1($rev)

Parameters

$rev

at line 148
upgrade_4_4_1($rev)

Parameters

$rev

at line 259
bool upgrade_4_4_4($rev)

Parameters

$rev

Return Value

bool

at line 335
upgrade_4_4_6($rev)

Parameters

$rev

at line 360
upgrade_4_4_7(string $rev, string $originalVer, string $latestVer)

Upgrade script for 4.4.7.

Parameters

string $rev
string $originalVer
string $latestVer

at line 386
static bool upgradeImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId)

Upgrade image URLs.

Parameters

CRM_Queue_TaskContext $ctx
$startId
$endId

Return Value

bool

at line 426
static bool changeSavedSearch(CRM_Queue_TaskContext $ctx)

Change saved search.

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool

at line 485
static bool cleanupBackendImageUrls(CRM_Queue_TaskContext $ctx, int $startId, int $endId)

For WordPress/Joomla(?) sites which upgraded to 4.4.6, find back-end image_URLs (e.g. "http://example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm/contact/imagefile&photo=123.jpg") and convert them to front-end URLs (e.g. "http://example.com/?page=CiviCRM&q=civicrm/contact/imagefile&photo=123.jpg").

Parameters

CRM_Queue_TaskContext $ctx
int $startId
int $endId

Return Value

bool

at line 506
static CRM_Core_DAO findContactImageUrls(int $startId, int $endId)

Parameters

int $startId
int $endId

Return Value

CRM_Core_DAO columns include "id" and "image_URL"

at line 527
static setContactImageUrl(int $cid, string $newImageUrl)

Parameters

int $cid
string $newImageUrl

at line 544
static bool activityContacts(CRM_Queue_TaskContext $ctx)

Update activity contacts CRM-12274

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool TRUE for success

at line 654
static bool wordReplacements(CRM_Queue_TaskContext $ctx)

Migrate word-replacements from $config to civicrm_word_replacement

Parameters

CRM_Queue_TaskContext $ctx

Return Value

bool TRUE for success

See also

http://issues.civicrm.org/jira/browse/CRM-13187

at line 687
static bool wordReplacements_patch(CRM_Queue_TaskContext $ctx, $rev)

Fix misconfigured constraints created in 4.4.0. To distinguish the good and bad configurations, we change the constraint name from "UI_find" (the original name in 4.4.0) to "UI_domain_find" (the new name in 4.4.1).

Parameters

CRM_Queue_TaskContext $ctx
$rev

Return Value

bool TRUE for success

See also

http://issues.civicrm.org/jira/browse/CRM-13655

at line 716
static array getConfigArraysAsAPIParams(bool $rebuildEach)

Get all the word-replacements stored in config-arrays and convert them to params for the WordReplacement.create API.

Note: This function is duplicated in CRM_Core_BAO_WordReplacement and CRM_Upgrade_Incremental_php_FourFour to ensure that the incremental upgrade step behaves consistently even as the BAO evolves in future versions. However, if there's a bug in here prior to 4.4.0, we should apply the bugfix in both places.

Parameters

bool $rebuildEach Whether to perform rebuild after each individual API call.

Return Value

array Each item is $params for WordReplacement.create

See also

CRM_Core_BAO_WordReplacement::convertConfigArraysToAPIParams

at line 766
static rebuildWordReplacementTable()

Get all the word-replacements stored in config-arrays and write them out as records in civicrm_word_replacement.

Note: This function is duplicated in CRM_Core_BAO_WordReplacement and CRM_Upgrade_Incremental_php_FourFour to ensure that the incremental upgrade step behaves consistently even as the BAO evolves in future versions. However, if there's a bug in here prior to 4.4.0, we should apply the bugfix in both places.

at line 777
updateReportInstanceTable()

CRM-13998 missing alter statements for civicrm_report_instance

at line 811
static bool isValidWordReplacement(array $params)

Parameters

array $params

Return Value

bool TRUE if $params is valid