| @@ 281-295 (lines=15) @@ | ||
| 278 | case 'x': |
|
| 279 | case 'x+': |
|
| 280 | case 'c': |
|
| 281 | case 'c+': |
|
| 282 | if (strrpos($path, '.') !== false) { |
|
| 283 | $ext = substr($path, strrpos($path, '.')); |
|
| 284 | } else { |
|
| 285 | $ext = ''; |
|
| 286 | } |
|
| 287 | $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); |
|
| 288 | \OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack')); |
|
| 289 | if ($this->file_exists($path)) { |
|
| 290 | $source = $this->fopen($path, 'r'); |
|
| 291 | file_put_contents($tmpFile, $source); |
|
| 292 | } |
|
| 293 | self::$tmpFiles[$tmpFile] = $path; |
|
| 294 | ||
| 295 | return fopen('close://' . $tmpFile, $mode); |
|
| 296 | } |
|
| 297 | return false; |
|
| 298 | } |
|
| @@ 402-416 (lines=15) @@ | ||
| 399 | case 'x': |
|
| 400 | case 'x+': |
|
| 401 | case 'c': |
|
| 402 | case 'c+': |
|
| 403 | if (strrpos($path, '.') !== false) { |
|
| 404 | $ext = substr($path, strrpos($path, '.')); |
|
| 405 | } else { |
|
| 406 | $ext = ''; |
|
| 407 | } |
|
| 408 | $tmpFile = \OCP\Files::tmpFile($ext); |
|
| 409 | \OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack')); |
|
| 410 | if ($this->file_exists($path)) { |
|
| 411 | $source = $this->fopen($path, 'r'); |
|
| 412 | file_put_contents($tmpFile, $source); |
|
| 413 | } |
|
| 414 | self::$tmpFiles[$tmpFile] = $path; |
|
| 415 | ||
| 416 | return fopen('close://' . $tmpFile, $mode); |
|
| 417 | } |
|
| 418 | return false; |
|
| 419 | } |
|
| @@ 295-308 (lines=14) @@ | ||
| 292 | case 'x': |
|
| 293 | case 'x+': |
|
| 294 | case 'c': |
|
| 295 | case 'c+': |
|
| 296 | if (strrpos($path, '.') !== false) { |
|
| 297 | $ext = substr($path, strrpos($path, '.')); |
|
| 298 | } else { |
|
| 299 | $ext = ''; |
|
| 300 | } |
|
| 301 | $tmpFile = \OCP\Files::tmpFile($ext); |
|
| 302 | \OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack')); |
|
| 303 | if ($this->file_exists($path)) { |
|
| 304 | $source = $this->fopen($path, 'r'); |
|
| 305 | file_put_contents($tmpFile, $source); |
|
| 306 | } |
|
| 307 | self::$tempFiles[$tmpFile] = $path; |
|
| 308 | return fopen('close://'.$tmpFile, $mode); |
|
| 309 | } |
|
| 310 | return false; |
|
| 311 | } |
|
| @@ 119-132 (lines=14) @@ | ||
| 116 | case 'x': |
|
| 117 | case 'x+': |
|
| 118 | case 'c': |
|
| 119 | case 'c+': |
|
| 120 | //emulate these |
|
| 121 | if (strrpos($path, '.')!==false) { |
|
| 122 | $ext=substr($path, strrpos($path, '.')); |
|
| 123 | } else { |
|
| 124 | $ext=''; |
|
| 125 | } |
|
| 126 | $tmpFile=\OCP\Files::tmpFile($ext); |
|
| 127 | \OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack')); |
|
| 128 | if ($this->file_exists($path)) { |
|
| 129 | $this->getFile($path, $tmpFile); |
|
| 130 | } |
|
| 131 | self::$tempFiles[$tmpFile]=$path; |
|
| 132 | return fopen('close://'.$tmpFile, $mode); |
|
| 133 | } |
|
| 134 | return false; |
|
| 135 | } |
|