/** * Put an object into an S3 bucket. * * @param $filePath * @param $bucket * @param $uriPath * @param $permissions * * @return bool */ protected function putObject($filePath, $bucket, $uriPath, $permissions) { $object = empty($filePath) ? '' : array('file' => $filePath); $headers = array(); if (!empty($object) && !empty($this->getSettings()->expires) && DateTimeHelper::isValidIntervalString($this->getSettings()->expires)) { $expires = new DateTime(); $now = new DateTime(); $expires->modify('+' . $this->getSettings()->expires); $diff = $expires->format('U') - $now->format('U'); $headers['Cache-Control'] = 'max-age=' . $diff . ', must-revalidate'; } return $this->_googleCloud->putObject($object, $bucket, $uriPath, $permissions, array(), $headers); }
/** * Create a physical folder, return TRUE on success. * * @param AssetFolderModel $parentFolder * @param $folderName * @return boolean */ protected function _createSourceFolder(AssetFolderModel $parentFolder, $folderName) { $this->_prepareForRequests(); return $this->_googleCloud->putObject('', $this->getSettings()->bucket, $this->_getPathPrefix() . rtrim($parentFolder->fullPath . $folderName, '/') . '/', \GC::ACL_PUBLIC_READ); }