Documentation

DataFileDownloader
in package

Downloads the data file from a provided URL.

Table of Contents

XMSG_DOWNLOAD_ERROR  = "Error downloading data file due to: %s. Please check if the licence key and data file url is valid and correct respectively."
XMSG_DOWNLOAD_URL_ERROR  = "Please check data file url is a valid url."
XMSG_ERROR_SAVING_DATA_FILE  = "Error saving data file. Please check you have write permissions to: %s"
XMSG_MD5_VALIDATION_FAILED  = "Data file MD5 validation failed. Header validated was: %s."
XMSG_UNSUPPORTED_CONTENT_TYPE  = "Content type %s is not supported. The following content types are supported: %s. Note: Zip content type supported only when zip extension is installed."
$dataFile  : mixed
__construct()  : mixed
downloadDataFile()  : bool
Downloads the data file and performs MD5 validation if configured to do so.
decompressDataStream()  : bool
Decompress the data if necessary.
getHttpOptions()  : array<string|int, array<string|int, mixed>>
Prepare the http context options.
parseHeaders()  : array<string|int, mixed>
Parse response header.
saveDataFile()  : bool
Saves the data file to a temporary file path. This file will be persisted to a permanent location if it is loaded into the API successfully.
validateMd5()  : mixed
Validate the response 'content-md5' header with the downloaded stream md5

Constants

XMSG_DOWNLOAD_ERROR

public mixed XMSG_DOWNLOAD_ERROR = "Error downloading data file due to: %s. Please check if the licence key and data file url is valid and correct respectively."

XMSG_DOWNLOAD_URL_ERROR

public mixed XMSG_DOWNLOAD_URL_ERROR = "Please check data file url is a valid url."

XMSG_ERROR_SAVING_DATA_FILE

public mixed XMSG_ERROR_SAVING_DATA_FILE = "Error saving data file. Please check you have write permissions to: %s"

XMSG_MD5_VALIDATION_FAILED

public mixed XMSG_MD5_VALIDATION_FAILED = "Data file MD5 validation failed. Header validated was: %s."

XMSG_UNSUPPORTED_CONTENT_TYPE

public mixed XMSG_UNSUPPORTED_CONTENT_TYPE = "Content type %s is not supported. The following content types are supported: %s. Note: Zip content type supported only when zip extension is installed."

Properties

Methods

__construct()

public __construct(mixed $dataFile) : mixed
Parameters
$dataFile : mixed
Return values
mixed

getHttpOptions()

Prepare the http context options.

private getHttpOptions() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>>

parseHeaders()

Parse response header.

private parseHeaders( $headers) : array<string|int, mixed>
Parameters
$headers :
Return values
array<string|int, mixed>

saveDataFile()

Saves the data file to a temporary file path. This file will be persisted to a permanent location if it is loaded into the API successfully.

private saveDataFile( $inputStream,  $content_type) : bool
Parameters
$inputStream :
$content_type :
Tags
throws
Mobi_Mtld_DA_Exception_DataFileException
Return values
bool

validateMd5()

Validate the response 'content-md5' header with the downloaded stream md5

private validateMd5( $headerMd5,  $inputStream) : mixed
Parameters
$headerMd5 :
$inputStream :
Tags
throws
Mobi_Mtld_DA_Exception_DataFileException

if validation fails.

Return values
mixed

Search results