| @@ 363-378 (lines=16) @@ | ||
| 360 | case 'x': |
|
| 361 | case 'x+': |
|
| 362 | case 'c': |
|
| 363 | case 'c+': |
|
| 364 | if (strrpos($path, '.') !== false) { |
|
| 365 | $ext = substr($path, strrpos($path, '.')); |
|
| 366 | } else { |
|
| 367 | $ext = ''; |
|
| 368 | } |
|
| 369 | $tmpFile = \OCP\Files::tmpFile($ext); |
|
| 370 | if ($this->file_exists($path)) { |
|
| 371 | $source = $this->fopen($path, 'r'); |
|
| 372 | file_put_contents($tmpFile, $source); |
|
| 373 | } |
|
| 374 | ||
| 375 | $handle = fopen($tmpFile, $mode); |
|
| 376 | return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
| 377 | $this->writeBack($tmpFile, $path); |
|
| 378 | }); |
|
| 379 | } |
|
| 380 | return false; |
|
| 381 | } |
|
| @@ 300-314 (lines=15) @@ | ||
| 297 | case 'x': |
|
| 298 | case 'x+': |
|
| 299 | case 'c': |
|
| 300 | case 'c+': |
|
| 301 | if (strrpos($path, '.') !== false) { |
|
| 302 | $ext = substr($path, strrpos($path, '.')); |
|
| 303 | } else { |
|
| 304 | $ext = ''; |
|
| 305 | } |
|
| 306 | $tmpFile = \OCP\Files::tmpFile($ext); |
|
| 307 | if ($this->file_exists($path)) { |
|
| 308 | $source = $this->fopen($path, 'r'); |
|
| 309 | file_put_contents($tmpFile, $source); |
|
| 310 | } |
|
| 311 | $handle = fopen($tmpFile, $mode); |
|
| 312 | return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
| 313 | $this->writeBack($tmpFile, $path); |
|
| 314 | }); |
|
| 315 | } |
|
| 316 | return false; |
|
| 317 | } |
|
| @@ 123-137 (lines=15) @@ | ||
| 120 | case 'x': |
|
| 121 | case 'x+': |
|
| 122 | case 'c': |
|
| 123 | case 'c+': |
|
| 124 | //emulate these |
|
| 125 | if (strrpos($path, '.')!==false) { |
|
| 126 | $ext=substr($path, strrpos($path, '.')); |
|
| 127 | } else { |
|
| 128 | $ext=''; |
|
| 129 | } |
|
| 130 | $tmpFile=\OCP\Files::tmpFile($ext); |
|
| 131 | if ($this->file_exists($path)) { |
|
| 132 | $this->getFile($path, $tmpFile); |
|
| 133 | } |
|
| 134 | $handle = fopen($tmpFile, $mode); |
|
| 135 | return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
| 136 | $this->writeBack($tmpFile, $path); |
|
| 137 | }); |
|
| 138 | } |
|
| 139 | return false; |
|
| 140 | } |
|
| @@ 293-307 (lines=15) @@ | ||
| 290 | case 'x': |
|
| 291 | case 'x+': |
|
| 292 | case 'c': |
|
| 293 | case 'c+': |
|
| 294 | if (strrpos($path, '.') !== false) { |
|
| 295 | $ext = substr($path, strrpos($path, '.')); |
|
| 296 | } else { |
|
| 297 | $ext = ''; |
|
| 298 | } |
|
| 299 | $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); |
|
| 300 | if ($this->file_exists($path)) { |
|
| 301 | $source = $this->fopen($path, 'r'); |
|
| 302 | file_put_contents($tmpFile, $source); |
|
| 303 | } |
|
| 304 | $handle = fopen($tmpFile, $mode); |
|
| 305 | return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
| 306 | $this->writeBack($tmpFile, $path); |
|
| 307 | }); |
|
| 308 | } |
|
| 309 | return false; |
|
| 310 | } |
|