Documentation

CRM_Upgrade_Incremental_php_FiveThirtyFour extends CRM_Upgrade_Incremental_Base
in package

Upgrade logic for FiveThirtyFour

Table of Contents

Constants

BATCH_SIZE  = 5000

Properties

$majorMinor  : string|null

Methods

addColumn()  : bool
Add a column to a table if it doesn't already exist
addIndex()  : bool
Add a index to a table column.
addOptionGroup()  : bool
Add the specified option group, gracefully if it already exists.
alterColumn()  : bool
alterSchemaField()  : bool
Task to add or change a column definition, based on the php schema spec.
checkFKExists()  : bool
createEntityTable()  : bool
Installs a newly-added core entity.
dropColumn()  : bool
Drop a column from a table if it exist.
dropIndex()  : bool
Drop a index from a table if it exist.
dropTable()  : bool
Drop a table if it exists.
dropTableIfEmpty()  : bool
Drop a table... but only if it's empty.
enableExtension()  : bool
enableSimpleExtension()  : bool
This callback is used to enable one or more extensions which have no install or upgrade code, and whose autoloaders are needed right away.
getMajorMinor()  : string
Get the major and minor version for this class (based on English-style class name).
getRevisionSequence()  : array<string|int, mixed>
Get a list of revisions (PATCH releases) related to this class.
migrateSmtpPasswords()  : bool
Find any SMTP passwords. Remove the CRM_Utils_Crypt encryption.
rebuildMultilingalSchema()  : bool
Rebuild Multilingual Schema.
removePaymentProcessorType()  : bool
Remove a payment processor if not in use
removeUnusedXOAUTH2()  : mixed
This option value was never used, but check anyway if someone happens to be using it and then ask them to report what they're doing with it.
runSql()  : bool
(Queue Task Callback)
setPostUpgradeMessage()  : mixed
Compute any messages which should be displayed after upgrade.
setPreUpgradeMessage()  : mixed
Compute any messages which should be displayed beforeupgrade.
uninstallExtension()  : bool
updateActionScheduleToken()  : bool
Updated a message token within a scheduled reminder.
updateContributeSettings()  : bool
Re-save any valid values from contribute settings into the normal setting format.
updateCurrencyName()  : bool
Updated a currency in civicrm_currency and related configurations
updateFinancialTypeTable()  : bool
Update financial type table to reflect recent schema changes.
updateGreetingOptions()  : bool
Updated a message token within greeting options.
updateMessageTemplates()  : mixed
Do any relevant message template updates.
updateMessageToken()  : bool
Updated a message token within a template.
updatePledgeTable()  : bool
Update pledge table to reflect recent schema changes making fields required.
updatePrintLabelToken()  : bool
Updated a message token within a label.
updateSmartGroups()  : bool
Do any relevant smart group updates.
upgrade_5_34_alpha1()  : void
Upgrade function.
addExtensionTask()  : void
Add a task to activate an extension. It will use the full, normal installation process (invoking `hook_install`, `hook_enable`, and so on). To ensure that the installation process can rely on regular core services and APIs, it will run after the core-upgrade-steps.
addSimpleExtensionTask()  : void
Add a task to activate an extension. It will use a simple (low-tech) installation process (skipping events like `hook_install`; instead, it merely updates `civicrm_extension` and `CRM_Extension_ClassLoader`). The extension should not now (or in the future) use `hook_install`. Simple installations can run at any point during the upgrade process.
addSnapshotTask()  : void
Add a task to store a snapshot of some data (if upgrade-snapshots are supported).
addTask()  : mixed
Syntactic sugar for adding a task.
addUninstallTask()  : void
Add a task to uninstall an extension. It will use the full, uninstallation process (invoking `hook_uninstall`, `hook_disable`, and so on).
canBeStored()  : bool
If you decode an old value of smtpPassword, will it be possible to store that password in the updated format?
findSmtpPasswords()  : array<string|int, mixed>
getXOAuth2Warning()  : string
isXOAUTH2InUse()  : bool
Determine if option value is enabled or used in mail settings.

Constants

BATCH_SIZE

public mixed BATCH_SIZE = 5000

Properties

$majorMinor

protected string|null $majorMinor

Methods

addColumn()

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

public static addColumn(CRM_Queue_TaskContext $ctx, string $table, string $column, string $properties[, bool $localizable = FALSE ][, string|null $version = NULL ][, bool $triggerRebuild = TRUE ]) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$table : string
$column : string
$properties : string
$localizable : bool = FALSE

is this a field that should be localized

$version : string|null = NULL

CiviCRM version to use if rebuilding multilingual schema

$triggerRebuild : bool = TRUE

should we trigger the rebuild of the multilingual schema

Return values
bool

addIndex()

Add a index to a table column.

public static addIndex(CRM_Queue_TaskContext $ctx, string $table, string|array<string|int, mixed> $columns[, string $prefix = 'index' ]) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$table : string
$columns : string|array<string|int, mixed>
$prefix : string = 'index'
Return values
bool

addOptionGroup()

Add the specified option group, gracefully if it already exists.

public static addOptionGroup(CRM_Queue_TaskContext $ctx, array<string|int, mixed> $params, array<string|int, mixed> $options) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$params : array<string|int, mixed>
$options : array<string|int, mixed>
Return values
bool

alterColumn()

public static alterColumn(mixed $ctx, mixed $table, mixed $column, mixed $properties[, mixed $localizable = FALSE ]) : bool
Parameters
$ctx : mixed
$table : mixed
$column : mixed
$properties : mixed
$localizable : mixed = FALSE
Return values
bool

alterSchemaField()

Task to add or change a column definition, based on the php schema spec.

public static alterSchemaField(mixed $ctx, string $entityName, string $fieldName, array<string|int, mixed> $fieldSpec) : bool
Parameters
$ctx : mixed
$entityName : string
$fieldName : string
$fieldSpec : array<string|int, mixed>

As definied in the .entityType.php file for $entityName

Tags
throws
CRM_Core_Exception
Return values
bool

checkFKExists()

public static checkFKExists(string $table_name, string $constraint_name) : bool
Parameters
$table_name : string
$constraint_name : string
Return values
bool

createEntityTable()

Installs a newly-added core entity.

public static createEntityTable(mixed $ctx, string $fileName) : bool

The entityType.php file should be copied into CRM/Upgrade/Incremental/schema and prefixed with the version-added.

Parameters
$ctx : mixed
$fileName : string
Tags
throws
DBQueryException
Return values
bool

dropColumn()

Drop a column from a table if it exist.

public static dropColumn(CRM_Queue_TaskContext $ctx, string $table, string $column) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$table : string
$column : string
Return values
bool

dropIndex()

Drop a index from a table if it exist.

public static dropIndex(CRM_Queue_TaskContext $ctx, string $table, string $indexName) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$table : string
$indexName : string
Return values
bool

enableExtension()

public static enableExtension(CRM_Queue_TaskContext $ctx, array<string|int, string> $keys) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$keys : array<string|int, string>

List of extensions to enable.

Return values
bool

enableSimpleExtension()

This callback is used to enable one or more extensions which have no install or upgrade code, and whose autoloaders are needed right away.

public static enableSimpleExtension(CRM_Queue_TaskContext $ctx, string|array<string|int, mixed> $keys) : bool

It was written to facilitate migrating core code into extensions. Moving a class into an extension means it is no longer loaded by the core autoloader. Upgrade code that relies on it could crash if classes disappear during the upgrade, so this function sets the extension status to enabled and installs its autoloader; both of which are important depending on the upgrade interface:

  • The web UI does each step as a separate ajax request, so inserting/enabling the extension in the db ensures it is loaded on subsequent requests.
  • The CLI upgrader does everything in a single request so its autoloader should be installed right away.
Parameters
$ctx : CRM_Queue_TaskContext
$keys : string|array<string|int, mixed>
Tags
throws
CRM_Extension_Exception
throws
DBQueryException
Return values
bool

getMajorMinor()

Get the major and minor version for this class (based on English-style class name).

public getMajorMinor() : string
Return values
string

Ex: '5.34' or '4.7'

getRevisionSequence()

Get a list of revisions (PATCH releases) related to this class.

public getRevisionSequence() : array<string|int, mixed>
Tags
throws
ReflectionException
Return values
array<string|int, mixed>

Ex: ['4.5.6', '4.5.7']

rebuildMultilingalSchema()

Rebuild Multilingual Schema.

public static rebuildMultilingalSchema(CRM_Queue_TaskContext $ctx[, string|null $version = NULL ]) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$version : string|null = NULL

CiviCRM version to use if rebuilding multilingual schema

Return values
bool

removeUnusedXOAUTH2()

This option value was never used, but check anyway if someone happens to be using it and then ask them to report what they're doing with it.

public static removeUnusedXOAUTH2(CRM_Queue_TaskContext $ctx) : mixed

There's no way to send a message to the user during the task, so we have to check it here and also as a pre/post upgrade message. Similar to removeGooglePlusOption from 5.23 except there we know some people would have used it.

Parameters
$ctx : CRM_Queue_TaskContext

setPostUpgradeMessage()

Compute any messages which should be displayed after upgrade.

public setPostUpgradeMessage(string &$postUpgradeMessage, string $rev) : mixed
Parameters
$postUpgradeMessage : string

alterable.

$rev : string

an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.

setPreUpgradeMessage()

Compute any messages which should be displayed beforeupgrade.

public setPreUpgradeMessage(string &$preUpgradeMessage, string $rev[, null $currentVer = NULL ]) : mixed

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

Parameters
$preUpgradeMessage : string
$rev : string

a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.

$currentVer : null = NULL

uninstallExtension()

public static uninstallExtension(CRM_Queue_TaskContext $ctx, array<string|int, string> $extensionKeys) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$extensionKeys : array<string|int, string>

List of extensions to enable.

Return values
bool

updateActionScheduleToken()

Updated a message token within a scheduled reminder.

public static updateActionScheduleToken(CRM_Queue_TaskContext $ctx, string $old, string $new, mixed $version) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$old : string
$new : string
$version : mixed
Return values
bool

updateContributeSettings()

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

public static updateContributeSettings(mixed $ctx) : bool

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 : mixed
Return values
bool

updateCurrencyName()

Updated a currency in civicrm_currency and related configurations

public static updateCurrencyName(CRM_Queue_TaskContext $ctx, string $old_name, string $new_name) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$old_name : string
$new_name : string
Return values
bool

updateGreetingOptions()

Updated a message token within greeting options.

public static updateGreetingOptions(CRM_Queue_TaskContext $ctx, string $old, string $new, mixed $version) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$old : string
$new : string
$version : mixed
Return values
bool

updateMessageToken()

Updated a message token within a template.

public static updateMessageToken(CRM_Queue_TaskContext $ctx, string $workflowName, string $old, string $new, mixed $version) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$workflowName : string
$old : string
$new : string
$version : mixed
Return values
bool

updatePrintLabelToken()

Updated a message token within a label.

public static updatePrintLabelToken(CRM_Queue_TaskContext $ctx, string $old, string $new, mixed $version) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$old : string
$new : string
$version : mixed
Return values
bool

updateSmartGroups()

Do any relevant smart group updates.

public static updateSmartGroups(CRM_Queue_TaskContext $ctx, array<string|int, mixed> $actions) : bool
Parameters
$ctx : CRM_Queue_TaskContext
$actions : array<string|int, mixed>
Return values
bool

upgrade_5_34_alpha1()

Upgrade function.

public upgrade_5_34_alpha1(string $rev) : void
Parameters
$rev : string

addExtensionTask()

Add a task to activate an extension. It will use the full, normal installation process (invoking `hook_install`, `hook_enable`, and so on). To ensure that the installation process can rely on regular core services and APIs, it will run after the core-upgrade-steps.

protected addExtensionTask(string $title, array<string|int, string> $keys[, int $weight = 2000 ]) : void

This is more suited to green-field extensions (which started life as an extension). If you have a brown-field extension which doesn't have install-logic (i.e. it arises from rearranging pre-existing core-core functionality), then consider addSimpleExtensionTask().

Parameters
$title : string
$keys : array<string|int, string>

List of extensions to enable.

$weight : int = 2000

A weight > 1500 will install after extension upgrades run. Do this for brand-new extensions. A weight < 1500 will install before extension upgrades. Do this if the extension may have previously been enabled.

addSimpleExtensionTask()

Add a task to activate an extension. It will use a simple (low-tech) installation process (skipping events like `hook_install`; instead, it merely updates `civicrm_extension` and `CRM_Extension_ClassLoader`). The extension should not now (or in the future) use `hook_install`. Simple installations can run at any point during the upgrade process.

protected addSimpleExtensionTask(string $title, string|array<string|int, string> $keys) : void

This is more suited to brown-field extensions (which arise from rearranging pre-existing core-core functionality). If you have a green-field extension (which has always been an extension), then consider addExtensionTask() instead.

Parameters
$title : string
$keys : string|array<string|int, string>

List of extensions to enable.

addSnapshotTask()

Add a task to store a snapshot of some data (if upgrade-snapshots are supported).

protected addSnapshotTask(string $name, CRM_Utils_SQL_Select $select) : void

If there is a large amount of data, this may actually add multiple tasks.

Ex :$this->addSnapshotTask('event_dates', CRM_Utils_SQL_Select::from('civicrm_event') ->select('id, start_date, end_date'));

Parameters
$name : string

Logical name for the snapshot. This will become part of the table.

$select : CRM_Utils_SQL_Select
Tags
throws
CRM_Core_Exception

addTask()

Syntactic sugar for adding a task.

protected addTask(string $title, string $funcName) : mixed

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
$title : string
$funcName : string

addUninstallTask()

Add a task to uninstall an extension. It will use the full, uninstallation process (invoking `hook_uninstall`, `hook_disable`, and so on).

protected addUninstallTask(string $title, array<string|int, string> $keys[, int $weight = 1000 ]) : void
Parameters
$title : string
$keys : array<string|int, string>

List of extensions to uninstall.

$weight : int = 1000

canBeStored()

If you decode an old value of smtpPassword, will it be possible to store that password in the updated format?

protected static canBeStored(string $oldCipherText, CryptoRegistry $registry) : bool

If you actually have encryption enabled, then it's straight-yes. But if you have to write in plain-text, then you're working within the constraints of php-mysqli-utf8mb4, and it does not accept anything > chr(128).

Note: This could potentially change in the future if we updated CryptToken to put difficult strings into ^CTK?k=plain&t={base64} format.

Parameters
$oldCipherText : string
$registry : CryptoRegistry
Tags
throws
CryptoException
Return values
bool

findSmtpPasswords()

protected static findSmtpPasswords() : array<string|int, mixed>
Return values
array<string|int, mixed>

A list of "civicrm_setting" records which have SMTP passwords, or NULL.

getXOAuth2Warning()

private getXOAuth2Warning() : string
Return values
string

isXOAUTH2InUse()

Determine if option value is enabled or used in mail settings.

private static isXOAUTH2InUse(mixed $xoauth2Value) : bool
Parameters
$xoauth2Value : mixed
Return values
bool

        
On this page

Search results