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