CRM_CivicrmSearchUi_Upgrader
extends CRM_Extension_Upgrader_Base
in package
Collection of upgrade steps.
Table of Contents
Properties
- $ctx : CRM_Queue_TaskContext
- $extensionDir : string
- $extensionName : string
- $queue : CRM_Queue_Queue
- $revisions : array<string|int, mixed>
- $revisionStorageIsDeprecated : bool
Methods
- _queueAdapter() : mixed
- Adapter that lets you add normal (non-static) member functions to the queue.
- addColumn() : bool
- Add a column to a table if it doesn't already exist
- addIndex() : bool
- Add an index to one or more columns.
- addTask() : mixed
- disable() : void
- dropColumn() : bool
- Drop a column from a table if it exists.
- dropIndex() : bool
- Drop index from a table if it exists.
- enable() : void
- See https://github.com/civicrm/civicrm-core/pull/26669
- enqueuePendingRevisions() : mixed
- Add any pending revisions to the queue.
- executeCustomDataFile() : bool
- Run a CustomData file.
- executeSql() : bool
- Run one SQL query.
- executeSqlFile() : bool
- Run a SQL file.
- executeSqlTemplate() : bool
- Run the sql commands in the specified file.
- getCurrentRevision() : mixed
- getExtensionDir() : string
- getExtensionKey() : string
- getQueue() : CRM_Queue_Queue
- getRevisions() : array<string|int, mixed>
- Get a list of revisions.
- hasPendingRevisions() : bool
- Determine if there are any pending revisions.
- init() : mixed
- {@inheritDoc}
- notify() : mixed
- Notify the upgrader about a key lifecycle event, such as installation or uninstallation.
- onDisable() : mixed
- onEnable() : mixed
- onInstall() : mixed
- Run early installation steps. Ex: Create new MySQL table.
- onPostInstall() : mixed
- Run later installation steps. Ex: Call a bespoke API-job for the first time.
- onPreInstall() : void
- Run pre-installation steps. Ex: Validate system environment
- onUninstall() : mixed
- onUpgrade() : mixed
- prependTask() : mixed
- Enqueue a task based on a method in this class.
- setCurrentRevision() : mixed
- setQueue() : void
- upgrade_1000() : bool
- appendTask() : mixed
- Enqueue a task based on a method in this class.
- executeCustomDataFileByAbsPath() : bool
- Run a CustomData file
- replaceFindContactMenuPath() : mixed
- deleteDeprecatedRevision() : mixed
- getCurrentRevisionDeprecated() : mixed
Properties
$ctx
protected
CRM_Queue_TaskContext
$ctx
$extensionDir
protected
string
$extensionDir
full path to the extension's source tree
$extensionName
protected
string
$extensionName
eg 'com.example.myextension'
$queue
protected
CRM_Queue_Queue
$queue
$revisions
private
array<string|int, mixed>
$revisions
sorted numerically
$revisionStorageIsDeprecated
private
bool
$revisionStorageIsDeprecated
= \FALSE
Flag to clean up extension revision data in civicrm_setting
Methods
_queueAdapter()
Adapter that lets you add normal (non-static) member functions to the queue.
public
static _queueAdapter(CRM_Queue_TaskContext $ctx, string $extensionKey, string $method, mixed ...$args) : mixed
While working through a task-queue, the _queueAdapter is called statically. It looks up the appropriate object and invokes the expected method.
CRM_Extension_Upgrader::_queueAdapter($ctx, 'org.example.myext', 'methodName', 'arg1', 'arg2');
Parameters
- $ctx : CRM_Queue_TaskContext
- $extensionKey : string
- $method : string
- $args : mixed
addColumn()
Add a column to a table if it doesn't already exist
public
static addColumn(string $table, string $column, string $properties) : bool
Parameters
- $table : string
- $column : string
- $properties : string
Return values
booladdIndex()
Add an index to one or more columns.
public
static addIndex(string $table, string|array<string|int, mixed> $columns[, string $prefix = 'index' ]) : bool
Parameters
- $table : string
- $columns : string|array<string|int, mixed>
- $prefix : string = 'index'
Return values
booladdTask()
public
addTask(string $title, string $funcName, mixed ...$options) : mixed
Parameters
- $title : string
- $funcName : string
- $options : mixed
disable()
public
disable() : void
dropColumn()
Drop a column from a table if it exists.
public
static dropColumn(string $table, string $column) : bool
Parameters
- $table : string
- $column : string
Return values
booldropIndex()
Drop index from a table if it exists.
public
static dropIndex(string $table, string $indexName) : bool
Parameters
- $table : string
- $indexName : string
Return values
boolenable()
See https://github.com/civicrm/civicrm-core/pull/26669
public
enable() : void
enqueuePendingRevisions()
Add any pending revisions to the queue.
public
enqueuePendingRevisions() : mixed
executeCustomDataFile()
Run a CustomData file.
public
executeCustomDataFile(string $relativePath) : bool
Parameters
- $relativePath : string
-
the CustomData XML file path (relative to this extension's dir)
Return values
boolexecuteSql()
Run one SQL query.
public
executeSql(mixed $query[, mixed $params = [] ]) : bool
This is just a wrapper for CRM_Core_DAO::executeSql, but it provides syntactic sugar for queueing several tasks that run different queries
Parameters
- $query : mixed
- $params : mixed = []
Return values
boolexecuteSqlFile()
Run a SQL file.
public
executeSqlFile(string $tplFile) : bool
Parameters
- $tplFile : string
-
The SQL file path (relative to this extension's dir, or absolute)
Return values
boolexecuteSqlTemplate()
Run the sql commands in the specified file.
public
executeSqlTemplate(string $tplFile) : bool
Parameters
- $tplFile : string
-
The SQL file path (relative to this extension's dir, or absolute). Ex: "sql/mydata.mysql.tpl".
Tags
Return values
boolgetCurrentRevision()
public
getCurrentRevision() : mixed
getExtensionDir()
public
getExtensionDir() : string
Return values
string —Ex: '/var/www/sites/default/ext/org.example.foobar'
getExtensionKey()
public
getExtensionKey() : string
Return values
string —Ex: 'org.example.foobar'
getQueue()
public
getQueue() : CRM_Queue_Queue
Return values
CRM_Queue_QueuegetRevisions()
Get a list of revisions.
public
getRevisions() : array<string|int, mixed>
Return values
array<string|int, mixed> —revisionNumbers sorted numerically
hasPendingRevisions()
Determine if there are any pending revisions.
public
hasPendingRevisions() : bool
Return values
boolinit()
{@inheritDoc}
public
init(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
notify()
Notify the upgrader about a key lifecycle event, such as installation or uninstallation.
public
notify(string $event[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $event : string
-
One of the following: 'install', 'onPostInstall', 'enable', 'disable', 'uninstall', 'upgrade'
- $params : array<string|int, mixed> = []
-
Any data that would ordinarily be provided via the equivalent hook.
onDisable()
public
onDisable() : mixed
Tags
onEnable()
public
onEnable() : mixed
Tags
onInstall()
Run early installation steps. Ex: Create new MySQL table.
public
onInstall() : mixed
This dispatches directly to each new extension. You will only receive notices for your own installation.
If multiple extensions are installed simultaneously, they will all run
hook_install
/hook_enable
back-to-back (in order of dependency).
This runs AFTER creating tables, but
BEFORE refreshing major caches and services (such as
ManagedEntities
and CRM_Logging_Schema
).
Tags
onPostInstall()
Run later installation steps. Ex: Call a bespoke API-job for the first time.
public
onPostInstall() : mixed
This dispatches directly to each new extension. You will only receive notices for your own installation.
If multiple extensions are installed simultaneously, they will all run
hook_postInstall
back-to-back (in order of dependency).
This runs AFTER refreshing major caches and services (such as
ManagedEntities
and CRM_Logging_Schema
).
Tags
onPreInstall()
Run pre-installation steps. Ex: Validate system environment
public
onPreInstall() : void
This runs BEFORE creating any sql tables.
onUninstall()
public
onUninstall() : mixed
Tags
onUpgrade()
public
onUpgrade(mixed $op[, CRM_Queue_Queue|null $queue = NULL ]) : mixed
Parameters
- $op : mixed
- $queue : CRM_Queue_Queue|null = NULL
Tags
prependTask()
Enqueue a task based on a method in this class.
public
prependTask(string $title, string $funcName, mixed ...$options) : mixed
The task is weighted so that it is processed as part of the currently-pending revision.
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
- $options : mixed
setCurrentRevision()
public
setCurrentRevision(mixed $revision) : mixed
Parameters
- $revision : mixed
setQueue()
public
setQueue(CRM_Queue_Queue $queue) : void
Parameters
- $queue : CRM_Queue_Queue
upgrade_1000()
public
upgrade_1000() : bool
Return values
boolappendTask()
Enqueue a task based on a method in this class.
protected
appendTask(string $title, string $funcName, mixed ...$options) : mixed
The task has a default weight.
Parameters
- $title : string
- $funcName : string
- $options : mixed
executeCustomDataFileByAbsPath()
Run a CustomData file
protected
executeCustomDataFileByAbsPath(string $xml_file) : bool
Parameters
- $xml_file : string
-
the CustomData XML file path (absolute path)
Return values
boolreplaceFindContactMenuPath()
protected
replaceFindContactMenuPath(mixed $path) : mixed
Parameters
- $path : mixed
deleteDeprecatedRevision()
private
deleteDeprecatedRevision() : mixed
getCurrentRevisionDeprecated()
private
getCurrentRevisionDeprecated() : mixed