/** * {@inheritdoc} */ public function updateStream($path, $resource, Config $config) { $result = $this->adapter->updateStream($path, $resource, $config); if ($result !== false) { $contents = false; $this->cache->updateObject($path, $result + compact('path', 'contents'), true); } return $result; }
/** * {@inheritdoc} */ public function updateStream($path, $resource, Config $config) { if ($this->mainAdapter->has($path)) { return $this->mainAdapter->updateStream($path, $resource, $config); } else { // TODO: Review, is this necessary? return $this->mainAdapter->writeStream($path, $resource, $config); } }
/** * {@inheritdoc} */ public function updateStream($path, $resource, Config $config) { if (!$this->source->updateStream($path, $resource, $config)) { return false; } if ($this->replica->has($path)) { return $this->replica->updateStream($path, $resource, $config); } else { return $this->replica->writeStream($path, $resource, $config); } }
/** * Update a file on the source and replica * * @param string $path * @param resource $resource * @param mixed $config Config object or visibility setting * * @return false|array false on failure file meta data on success */ public function updateStream($path, $resource, $config = null) { if (!$this->source->updateStream($path, $resource, $config)) { return false; } return $this->replica->updateStream($path, $resource, $config); }
/** * {@inheritDoc} */ public function updateStream($path, $resource, Config $config) { $success = $this->adapter->updateStream($path, $resource, $config); if ($success) { $this->cache->delete($this->getCacheKey($path)); } return $success; }
public function it_should_ignore_failed_streamed_updates() { $path = 'path.txt'; $contents = tmpfile(); $config = new Config(); $this->adapter->updateStream($path, $contents, $config)->willReturn(false); $this->updateStream($path, $contents, $config)->shouldBe(false); fclose($contents); }
/** * Update a file with the contents of a stream. * * @param string $path * @param resource $resource * @param mixed $config Config object or visibility setting * * @throws InvalidArgumentException * * @return bool success boolean */ public function updateStream($path, $resource, array $config = array()) { if (!is_resource($resource)) { throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); } $path = Util::normalizePath($path); $config = $this->prepareConfig($config); $this->assertPresent($path); Util::rewindStream($resource); return (bool) $this->adapter->updateStream($path, $resource, $config); }
/** * {@inheritDoc} */ public function updateStream($pathOrUuid, $resource, Config $config) { $path = $this->convertToPath($pathOrUuid); $this->guardNoInvalidUuid($pathOrUuid, $path); $this->guardInUploadPath($path); if ($this->adapter->updateStream($path, $resource, $config)) { \Dbafs::addResource($path); return true; } return false; }
/** * Update a file with the contents of a stream * * @param string $path * @param resource $resource * @return bool success boolean * @throws InvalidArgumentException */ public function updateStream($path, $resource) { $path = Util::normalizePath($path); $this->assertPresent($path); if (!is_resource($resource)) { throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); } if (!($object = $this->adapter->updateStream($path, $resource))) { return false; } $this->cache->updateObject($path, $object, true); $this->cache->ensureParentDirectories($path); return true; }
/** * Update a file with the contents of a stream. * * @param string $path * @param resource $resource * @param mixed $config Config object or visibility setting * * @throws InvalidArgumentException * * @return bool success boolean */ public function updateStream($path, $resource, array $config = []) { if (!is_resource($resource)) { throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); } $path = Util::normalizePath($path); $config = $this->prepareConfig($config); $this->assertPresent($path); Util::rewindStream($resource); if (!($object = $this->adapter->updateStream($path, $resource, $config))) { return false; } $this->cache->updateObject($path, $object + ['contents' => false], true); return true; }
/** * {@inheritdoc} */ public function put(string $path, $contents, array $config = []) : bool { $config['visibility'] = $this->parseVisibility($config['visibility'] ?? null) ?: []; $flyConfig = new FlyConfig($config); if (is_resource($contents)) { if ($this->has($path)) { return (bool) $this->driver->updateStream($path, $resource, $flyConfig); } return (bool) $this->driver->writeStream($path, $resource, $flyConfig); } if ($this->has($path)) { return (bool) $this->driver->update($path, $contents, $flyConfig); } return (bool) $this->driver->write($path, $contents, $flyConfig); }
/** * Update a file with the contents of a stream * * @param string $path * @param resource $resource * @param mixed $config Config object or visibility setting * @return bool success boolean * @throws InvalidArgumentException */ public function updateStream($path, $resource, $config = null) { if (!is_resource($resource)) { throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); } $path = Util::normalizePath($path); $config = Util::ensureConfig($config); $config->setFallback($this->getConfig()); $this->assertPresent($path); Util::rewindStream($resource); if (!($object = $this->adapter->updateStream($path, $resource, $config))) { return false; } $this->cache->updateObject($path, $object, true); return true; }
/** * {@inheritdoc} */ public function updateStream($path, $resource, Config $config) { return $this->adapter->updateStream($this->getPath($path), $resource, $config); }