CRM_Extension_Browser
in package
This class glues together the various parts of the extension system.
Tags
Table of Contents
Constants
- SINGLE_FILE_PATH = '/single'
- Relative path below remote repository URL for single extensions file.
Properties
- $indexPath : string
- $repoUrl : string
- $_remotesDiscovered : array<string|int, mixed>
- $guzzleClient : Client
Methods
- __construct() : mixed
- checkRequirements() : array<string|int, mixed>
- Determine whether downloading is supported.
- downloadError() : mixed
- A dummy function required for suppressing download errors.
- getExtension() : CRM_Extension_Info|null
- Get a description of a particular extension.
- getExtensions() : array<string|int, CRM_Extension_Info>
- Get a list of all available extensions.
- getGuzzleClient() : Client
- getRepositoryUrl() : string
- isEnabled() : bool
- Determine whether the system policy allows downloading new extensions.
- refresh() : mixed
- Refresh the cache of remotely-available extensions.
- setGuzzleClient() : mixed
- _discoverRemote() : array<string|int, CRM_Extension_Info>
- getCacheKey() : mixed
- Returns a cache key based on the repository URL, which can be updated by admins in civicrm.settings.php or passed as a command-line option to cv.
- grabCachedJson() : string
- Loads the extensions data from the cache file. If it is empty or doesn't exist, try fetching from remote instead.
- grabRemoteJson() : string
- Connects to public server and grabs the list of publicly available extensions.
Constants
SINGLE_FILE_PATH
Relative path below remote repository URL for single extensions file.
public
mixed
SINGLE_FILE_PATH
= '/single'
Properties
$indexPath
public
string
$indexPath
$repoUrl
public
string
$repoUrl
$_remotesDiscovered
protected
array<string|int, mixed>
$_remotesDiscovered
$guzzleClient
protected
Client
$guzzleClient
Methods
__construct()
public
__construct(string $repoUrl, string $indexPath) : mixed
Parameters
- $repoUrl : string
-
URL of the remote repository.
- $indexPath : string
-
Relative path of the 'index' file within the repository.
checkRequirements()
Determine whether downloading is supported.
public
checkRequirements() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of error messages; empty if OK.
downloadError()
A dummy function required for suppressing download errors.
public
static downloadError(mixed $errorNumber, mixed $errorString) : mixed
Parameters
- $errorNumber : mixed
- $errorString : mixed
getExtension()
Get a description of a particular extension.
public
getExtension(string $key) : CRM_Extension_Info|null
Parameters
- $key : string
-
Fully-qualified extension name.
Return values
CRM_Extension_Info|nullgetExtensions()
Get a list of all available extensions.
public
getExtensions() : array<string|int, CRM_Extension_Info>
Return values
array<string|int, CRM_Extension_Info> —($key => CRM_Extension_Info)
getGuzzleClient()
public
getGuzzleClient() : Client
Return values
ClientgetRepositoryUrl()
public
getRepositoryUrl() : string
Return values
stringisEnabled()
Determine whether the system policy allows downloading new extensions.
public
isEnabled() : bool
This is reflection of policy and intent; it does not indicate whether the browser will actually work. For that, see checkRequirements().
Return values
boolrefresh()
Refresh the cache of remotely-available extensions.
public
refresh() : mixed
setGuzzleClient()
public
setGuzzleClient(Client $guzzleClient) : mixed
Parameters
- $guzzleClient : Client
_discoverRemote()
private
_discoverRemote() : array<string|int, CRM_Extension_Info>
Tags
Return values
array<string|int, CRM_Extension_Info>getCacheKey()
Returns a cache key based on the repository URL, which can be updated by admins in civicrm.settings.php or passed as a command-line option to cv.
private
getCacheKey() : mixed
grabCachedJson()
Loads the extensions data from the cache file. If it is empty or doesn't exist, try fetching from remote instead.
private
grabCachedJson() : string
Return values
stringgrabRemoteJson()
Connects to public server and grabs the list of publicly available extensions.
private
grabRemoteJson() : string