You are here

protected function AmazonS3StreamWrapper::getCF in AmazonS3 7

Get the CloudFront connection object.

Return value

AmazonCloudFront CloudFront connection object.

See also

http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#i=AmazonCloudFront

File

./AmazonS3StreamWrapper.inc, line 1113
Drupal stream wrapper implementation for Amazon S3

Class

AmazonS3StreamWrapper
@file Drupal stream wrapper implementation for Amazon S3

Code

protected function getCF() {
  if ($this->cf === NULL) {
    if (!libraries_load('awssdk')) {
      drupal_set_message(t('Unable to load the AWS SDK. Please check you have installed the library correctly and configured your CloudFront settings.'), 'error');
    }
    elseif (variable_get('amazons3_cname', 0) && variable_get('amazons3_domain', 0)) {
      try {
        $this->cf = new AmazonCloudFront();
      } catch (Exception $e) {
        drupal_set_message(t('There was a problem using CloudFront. @message', array(
          'message' => $e
            ->getMessage(),
        )), 'error');
      }
    }
  }
  return $this->cf;
}