| @@ 113-129 (lines=17) @@ | ||
| 110 | * |
|
| 111 | * @return array|bool |
|
| 112 | */ |
|
| 113 | public function writeStream($path, $resource, Config $config) |
|
| 114 | { |
|
| 115 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 116 | ||
| 117 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 118 | null, null, $config->get('insertOnly', 1)); |
|
| 119 | ||
| 120 | $response = $this->normalizeResponse($response); |
|
| 121 | ||
| 122 | if (false === $response) { |
|
| 123 | return false; |
|
| 124 | } |
|
| 125 | ||
| 126 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 127 | ||
| 128 | return $response; |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * @param string $path |
|
| @@ 179-195 (lines=17) @@ | ||
| 176 | * |
|
| 177 | * @return array|bool |
|
| 178 | */ |
|
| 179 | public function updateStream($path, $resource, Config $config) |
|
| 180 | { |
|
| 181 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 182 | ||
| 183 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 184 | null, null, $config->get('insertOnly', 0)); |
|
| 185 | ||
| 186 | $response = $this->normalizeResponse($response); |
|
| 187 | ||
| 188 | if (false === $response) { |
|
| 189 | return false; |
|
| 190 | } |
|
| 191 | ||
| 192 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 193 | ||
| 194 | return $response; |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|
| 198 | * @param string $path |
|