/** * Put an object on the cloud. * * @param $file_path * @param $bucket * @param $uriPath * @param $permissions * @return bool */ protected function _put_object($file_path, $bucket, $uriPath, $permissions) { $object = empty($file_path) ? '' : array('file' => $file_path); $headers = array(); $expires = !empty($this->_source_settings->cache_amount) && !empty($this->_source_settings->cache_period); $expires = $expires && is_numeric($this->_source_settings->cache_amount) && preg_match('/seconds|minutes|hours|days/', $this->_source_settings->cache_period); if ($expires) { $expire_time = new DateTime(); $now = new DateTime(); $expire_time->modify('+' . $this->_source_settings->cache_amount . $this->_source_settings->cache_period); $diff = $expire_time->format('U') - $now->format('U'); $headers['Cache-Control'] = 'max-age=' . $diff . ', must-revalidate'; } return $this->s3->putObject($object, $bucket, $uriPath, $permissions, array(), $headers); }