class CRM_Extension_Manager

The extension manager handles installing, disabling enabling, and uninstalling extensions.

Constants

STATUS_INSTALLED

The extension is fully installed and enabled.

STATUS_DISABLED

The extension config has been applied to database but deactivated.

STATUS_UNINSTALLED

The extension code is visible, but nothing has been applied to DB

STATUS_UNKNOWN

The extension code is not locally accessible

STATUS_INSTALLED_MISSING

The extension is installed but the code is not accessible

STATUS_DISABLED_MISSING

The extension was installed and is now disabled; the code is not accessible

Properties

CRM_Extension_Container_Interface $fullContainer
CRM_Extension_Container_Basic|false $defaultContainer Default container.
CRM_Extension_Mapper $mapper Mapper.
array $typeManagers Type managers.
array $statuses Statuses.

Methods

__construct(CRM_Extension_Container_Interface $fullContainer, CRM_Extension_Container_Basic|FALSE $defaultContainer, CRM_Extension_Mapper $mapper, array $typeManagers)

Class constructor.

replace(string $tmpCodeDir)

Install or upgrade the code for an extension -- and perform any necessary database changes (eg replacing extension metadata).

install(string|array $keys)

Add records of the extension to the database -- and enable it

enable(array $keys)

Add records of the extension to the database -- and enable it

disable(string|array $keys)

Disable extension without removing record from db.

uninstall(string|array $keys)

Remove all database references to an extension.

string
getStatus($key)

Determine the status of an extension.

bool|array
isIncompatible($key)

Check if a given extension is incompatible with this version of CiviCRM

array
getStatuses()

Determine the status of all extensions.

refresh()

No description

createInfoFromDB($key)

Auto-generate a place-holder for a missing extension using info from database.

array
findInstallRequirements(array $keys, CRM_Extension_Info $info = NULL)

Build a list of extensions to install, in an order that will satisfy dependencies.

array
findDisableRequirements(array $keys)

Build a list of extensions to remove, in an order that will satisfy dependencies.

array
filterInfosByStatus($infos, $filterStatuses)

No description

Details

at line 121
__construct(CRM_Extension_Container_Interface $fullContainer, CRM_Extension_Container_Basic|FALSE $defaultContainer, CRM_Extension_Mapper $mapper, array $typeManagers)

Class constructor.

Parameters

CRM_Extension_Container_Interface $fullContainer
CRM_Extension_Container_Basic|FALSE $defaultContainer
CRM_Extension_Mapper $mapper
array $typeManagers

at line 138
replace(string $tmpCodeDir)

Install or upgrade the code for an extension -- and perform any necessary database changes (eg replacing extension metadata).

This only works if the extension is stored in the default container.

Parameters

string $tmpCodeDir Path to a local directory containing a copy of the new (inert) code.

Exceptions

CRM_Extension_Exception

at line 222
install(string|array $keys)

Add records of the extension to the database -- and enable it

Parameters

string|array $keys One or more extension keys.

Exceptions

CRM_Extension_Exception

at line 319
enable(array $keys)

Add records of the extension to the database -- and enable it

Parameters

array $keys List of extension keys.

Exceptions

CRM_Extension_Exception

at line 330
disable(string|array $keys)

Disable extension without removing record from db.

Parameters

string|array $keys One or more extension keys.

Exceptions

CRM_Extension_Exception

at line 387
uninstall(string|array $keys)

Remove all database references to an extension.

Parameters

string|array $keys One or more extension keys.

Exceptions

CRM_Extension_Exception

at line 439
string getStatus($key)

Determine the status of an extension.

Parameters

$key

Return Value

string constant self::STATUS_*

at line 455
bool|array isIncompatible($key)

Check if a given extension is incompatible with this version of CiviCRM

Parameters

$key

Return Value

bool|array

at line 466
array getStatuses()

Determine the status of all extensions.

Return Value

array ($key => status_constant)

at line 503
refresh()

at line 630
CRM_Extension_Info|NULL createInfoFromDB($key)

Auto-generate a place-holder for a missing extension using info from database.

Parameters

$key

Return Value

CRM_Extension_Info|NULL

at line 656
array findInstallRequirements(array $keys, CRM_Extension_Info $info = NULL)

Build a list of extensions to install, in an order that will satisfy dependencies.

Parameters

array $keys List of extensions to install.
CRM_Extension_Info $info An extension info object that we should use instead of our local versions (eg. when checking for upgradeability).

Return Value

array List of extension keys, including dependencies, in order of installation.

Exceptions

CRM_Extension_Exception
CircularDependencyException
ElementNotFoundException

at line 699
array findDisableRequirements(array $keys)

Build a list of extensions to remove, in an order that will satisfy dependencies.

Parameters

array $keys List of extensions to install.

Return Value

array List of extension keys, including dependencies, in order of removal.

at line 735
protected array filterInfosByStatus($infos, $filterStatuses)

Parameters

$infos
$filterStatuses

Return Value

array