| @@ 99-113 (lines=15) @@ | ||
| 96 | * |
|
| 97 | * @return array|bool |
|
| 98 | */ |
|
| 99 | public function writeStream($path, $resource, Config $config) |
|
| 100 | { |
|
| 101 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 102 | ||
| 103 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 104 | null, null, $config->get('insertOnly', 1)); |
|
| 105 | ||
| 106 | $response = $this->normalizeResponse($response); |
|
| 107 | ||
| 108 | if (false !== $response) { |
|
| 109 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 110 | } |
|
| 111 | ||
| 112 | return $response; |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * @param string $path |
|
| @@ 149-163 (lines=15) @@ | ||
| 146 | * |
|
| 147 | * @return array|bool |
|
| 148 | */ |
|
| 149 | public function updateStream($path, $resource, Config $config) |
|
| 150 | { |
|
| 151 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 152 | ||
| 153 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 154 | null, null, $config->get('insertOnly', 0)); |
|
| 155 | ||
| 156 | $response = $this->normalizeResponse($response); |
|
| 157 | ||
| 158 | if (false !== $response) { |
|
| 159 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 160 | } |
|
| 161 | ||
| 162 | return $response; |
|
| 163 | } |
|
| 164 | ||
| 165 | /** |
|
| 166 | * @param string $path |
|