| @@ 109-125 (lines=17) @@ | ||
| 106 | * |
|
| 107 | * @return array|bool |
|
| 108 | */ |
|
| 109 | public function writeStream($path, $resource, Config $config) |
|
| 110 | { |
|
| 111 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 112 | ||
| 113 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 114 | null, null, $config->get('insertOnly', 1)); |
|
| 115 | ||
| 116 | $response = $this->normalizeResponse($response); |
|
| 117 | ||
| 118 | if (false === $response) { |
|
| 119 | return false; |
|
| 120 | } |
|
| 121 | ||
| 122 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 123 | ||
| 124 | return $response; |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * @param string $path |
|
| @@ 171-187 (lines=17) @@ | ||
| 168 | * |
|
| 169 | * @return array|bool |
|
| 170 | */ |
|
| 171 | public function updateStream($path, $resource, Config $config) |
|
| 172 | { |
|
| 173 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 174 | ||
| 175 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 176 | null, null, $config->get('insertOnly', 0)); |
|
| 177 | ||
| 178 | $response = $this->normalizeResponse($response); |
|
| 179 | ||
| 180 | if (false === $response) { |
|
| 181 | return false; |
|
| 182 | } |
|
| 183 | ||
| 184 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 185 | ||
| 186 | return $response; |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|
| 190 | * @param string $path |
|