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