/** * {@inheritdoc} */ public function copy($path, $newpath) { if (!$this->source->copy($path, $newpath)) { return false; } return $this->replica->copy($path, $newpath); }
public function it_should_ignore_copy_fails() { $old = 'old.txt'; $new = 'new.txt'; $this->adapter->copy($old, $new)->willReturn(false); $this->copy($old, $new)->shouldBe(false); }
/** * Copy a file. * * @param string $path * @param string $newpath * * @return bool */ public function copy($path, $newpath) { $path = Util::normalizePath($path); $newpath = Util::normalizePath($newpath); $this->assertPresent($path); $this->assertAbsent($newpath); return $this->adapter->copy($path, $newpath); }
/** * {@inheritdoc} */ public function copy($path, $newpath) { $result = $this->adapter->copy($path, $newpath); if ($result !== false) { $this->cache->copy($path, $newpath); } return $result; }
/** * {@inheritdoc} */ public function copy($path, $newpath) { if ($this->mainAdapter->has($path)) { return $this->mainAdapter->copy($path, $newpath); } elseif ($this->fallback->has($path)) { return $this->portFromFallback($path, $newpath); } return false; }
/** * Copy a file. * * @param string $path * @param string $newpath * * @return bool */ public function copy($path, $newpath) { $path = Util::normalizePath($path); $newpath = Util::normalizePath($newpath); $this->assertPresent($path); $this->assertAbsent($newpath); if ($this->adapter->copy($path, $newpath) === false) { return false; } $this->cache->copy($path, $newpath); return true; }
/** * {@inheritDoc} */ public function copy($pathOrUuid, $newpath) { $path = $this->convertToPath($pathOrUuid); $this->guardNoInvalidUuid($pathOrUuid, $path); $this->guardInUploadPath($path); $this->guardInUploadPath($newpath); if ($this->adapter->copy($path, $newpath)) { \Dbafs::copyResource($path, $newpath); return true; } return false; }
/** * {@inheritdoc} */ public function copy($originFile, $targetFile, $override = false) { if (!$this->has($originFile)) { throw new FileNotFoundException($originFile); } $orginal = $this->driver->applyPathPrefix($originFile); $target = $this->driver->applyPathPrefix($targetFile); // https://bugs.php.net/bug.php?id=64634 if (@fopen($orginal, 'r') === false) { throw new ViserioIOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $orginal, $target), 0, null, $orginal); } // Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default if (@fopen($target, 'w', false, stream_context_create(['ftp' => ['overwrite' => true]])) === false) { throw new ViserioIOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $orginal, $target), 0, null, $orginal); } $this->driver->copy($originFile, $targetFile); if (!is_file($target)) { throw new ViserioIOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $target), 0, null, $originFile); } return true; }
/** * {@inheritdoc} */ public function copy($path, $newpath) { return $this->adapter->copy($this->getPath($path), $this->getPath($newpath)); }
/** * {@inheritDoc} */ public function copy($path, $newpath) { return $this->adapter->copy($path, $newpath); }