Documentation

CRM_Extension_Downloader
in package

This class handles downloads of remotely-provided extensions

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Properties

$container  : CRM_Extension_Container_Basic
$tmpDir  : string
$guzzleClient  : Client
$containerDir  : string
$manager  : CRM_Extension_Manager

Methods

__construct()  : mixed
checkRequirements()  : array<string|int, mixed>
Determine whether downloading is supported.
download()  : bool
Install or upgrade an extension from a remote URL.
extractFiles()  : string|false
Extract an extension from a zip file.
fetch()  : bool
Download the remote zipfile.
getGuzzleClient()  : Client
setGuzzleClient()  : mixed
validateFiles()  : bool
Validate that $extractedZipPath contains valid for extension $key

Properties

$tmpDir

public string $tmpDir

Local path to a temporary data directory

Methods

checkRequirements()

Determine whether downloading is supported.

public checkRequirements([CRM_Extension_Info $extensionInfo = NULL ]) : array<string|int, mixed>
Parameters
$extensionInfo : CRM_Extension_Info = NULL

Optional info for (updated) extension

Return values
array<string|int, mixed>

list of error messages; empty if OK

download()

Install or upgrade an extension from a remote URL.

public download(string $key, string $downloadUrl) : bool
Parameters
$key : string

The name of the extension being installed.

$downloadUrl : string

URL of a .zip file.

Tags
throws
CRM_Extension_Exception
Return values
bool

TRUE for success

extractFiles()

Extract an extension from a zip file.

public extractFiles(string $key, string $zipFile) : string|false
Parameters
$key : string

The name of the extension being installed; this usually matches the basedir in the .zip.

$zipFile : string

The local path to a .zip file.

Return values
string|false

zip file path

fetch()

Download the remote zipfile.

public fetch(string $remoteFile, string $localFile) : bool
Parameters
$remoteFile : string

URL of a .zip file.

$localFile : string

Path at which to store the .zip file.

Return values
bool

Whether the download was successful.

getGuzzleClient()

public getGuzzleClient() : Client
Return values
Client

setGuzzleClient()

public setGuzzleClient(Client $guzzleClient) : mixed
Parameters
$guzzleClient : Client

validateFiles()

Validate that $extractedZipPath contains valid for extension $key

public validateFiles(mixed $key, mixed $extractedZipPath) : bool
Parameters
$key : mixed
$extractedZipPath : mixed
Tags
throws
CRM_Core_Exception
Return values
bool

        
On this page

Search results