| @@ 95-109 (lines=15) @@ | ||
| 92 | * |
|
| 93 | * @return array|bool |
|
| 94 | */ |
|
| 95 | public function write($path, $contents, Config $config) |
|
| 96 | { |
|
| 97 | $temporaryPath = $this->createTemporaryFile($contents); |
|
| 98 | ||
| 99 | $response = $this->cosApi->upload($this->getBucket(), $temporaryPath, $path, |
|
| 100 | null, null, $config->get('insertOnly', 1)); |
|
| 101 | ||
| 102 | $response = $this->normalizeResponse($response); |
|
| 103 | ||
| 104 | if (false !== $response) { |
|
| 105 | $this->setContentType($path, $contents); |
|
| 106 | } |
|
| 107 | ||
| 108 | return $response; |
|
| 109 | } |
|
| 110 | ||
| 111 | /** |
|
| 112 | * @param string $path |
|
| @@ 145-159 (lines=15) @@ | ||
| 142 | * |
|
| 143 | * @return array|bool |
|
| 144 | */ |
|
| 145 | public function update($path, $contents, Config $config) |
|
| 146 | { |
|
| 147 | $temporaryPath = $this->createTemporaryFile($contents); |
|
| 148 | ||
| 149 | $response = $this->cosApi->upload($this->getBucket(), $temporaryPath, $path, |
|
| 150 | null, null, $config->get('insertOnly', 0)); |
|
| 151 | ||
| 152 | $response = $this->normalizeResponse($response); |
|
| 153 | ||
| 154 | if (false !== $response) { |
|
| 155 | $this->setContentType($path, $contents); |
|
| 156 | } |
|
| 157 | ||
| 158 | return $response; |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * @param string $path |
|