Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function update($path, $contents, Config $config)
 {
     $result = $this->adapter->update($path, $contents, $config);
     if ($result !== false) {
         $this->cache->updateObject($path, $result + compact('path', 'contents'), true);
     }
     return $result;
 }
 /**
  * {@inheritDoc}
  */
 public function update($path, $contents, Config $config)
 {
     $success = $this->adapter->update($path, $contents, $config);
     if ($success) {
         $this->cache->delete($this->getCacheKey($path));
     }
     return $success;
 }
 /**
  * {@inheritdoc}
  */
 public function update($path, $contents, Config $config)
 {
     // This is done to allow "append" mode in the underlying main adapter
     if (!$this->mainAdapter->has($path) && $this->fallback->has($path)) {
         $this->portFromFallback($path, $path);
     }
     return $this->mainAdapter->update($path, $contents, $config);
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 public function update($path, $contents, Config $config)
 {
     if (!$this->source->update($path, $contents, $config)) {
         return false;
     }
     if ($this->replica->has($path)) {
         return $this->replica->update($path, $contents, $config);
     } else {
         return $this->replica->write($path, $contents, $config);
     }
 }
Пример #5
0
 /**
  * {@inheritDoc}
  */
 public function update($pathOrUuid, $contents, Config $config)
 {
     $path = $this->convertToPath($pathOrUuid);
     $this->guardNoInvalidUuid($pathOrUuid, $path);
     $this->guardInUploadPath($path);
     if ($this->adapter->update($path, $contents, $config)) {
         \Dbafs::addResource($path);
         return true;
     }
     return false;
 }
Пример #6
0
 /**
  * Update a file.
  *
  * @param string $path     path to file
  * @param string $contents file contents
  * @param mixed  $config   Config object or visibility setting
  *
  * @throws FileNotFoundException
  *
  * @return bool success boolean
  */
 public function update($path, $contents, array $config = array())
 {
     $path = Util::normalizePath($path);
     $config = $this->prepareConfig($config);
     $this->assertPresent($path);
     return (bool) $this->adapter->update($path, $contents, $config);
 }
Пример #7
0
 /**
  * Update a file on the source and replica
  *
  * @param   string $path
  * @param   string $contents
  * @param   mixed  $config Config object or visibility setting
  *
  * @return  false|array  false on failure file meta data on success
  */
 public function update($path, $contents, $config = null)
 {
     if (!$this->source->update($path, $contents, $config)) {
         return false;
     }
     return $this->replica->update($path, $contents, $config);
 }
 public function it_should_ignore_failed_updates()
 {
     $path = 'path.txt';
     $contents = 'contents';
     $config = new Config();
     $this->adapter->update($path, $contents, $config)->willReturn(false);
     $this->update($path, $contents, $config)->shouldBe(false);
 }
Пример #9
0
 /**
  * {@inheritdoc}
  */
 public function update(string $path, string $contents, array $config = []) : bool
 {
     if (!$this->has($path)) {
         throw new FileNotFoundException($path);
     }
     $flyConfig = new FlyConfig($config);
     $update = $this->driver->update($path, $contents, $flyConfig);
     return !$update ?: false;
 }
Пример #10
0
 /**
  * {@inheritdoc}
  */
 public function save()
 {
     $contents = $this->getForStorage();
     if ($this->adapter->has($this->file)) {
         $this->adapter->update($this->file, $contents);
     } else {
         $this->adapter->write($this->file, $contents);
     }
 }
Пример #11
0
 /**
  * Update a file
  *
  * @param  string                $path     path to file
  * @param  string                $contents file contents
  * @param  mixed                 $config   Config object or visibility setting
  * @throws FileNotFoundException
  * @return boolean               success boolean
  */
 public function update($path, $contents, $config = null)
 {
     $path = Util::normalizePath($path);
     $this->assertPresent($path);
     $object = $this->adapter->update($path, $contents, $config);
     if ($object === false) {
         return false;
     }
     $this->cache->updateObject($path, $object, true);
     return true;
 }
Пример #12
0
 /**
  * Update a file.
  *
  * @param string $path     path to file
  * @param string $contents file contents
  * @param mixed  $config   Config object or visibility setting
  *
  * @throws FileNotFoundException
  *
  * @return bool success boolean
  */
 public function update($path, $contents, array $config = [])
 {
     $path = Util::normalizePath($path);
     $config = $this->prepareConfig($config);
     $this->assertPresent($path);
     $object = $this->adapter->update($path, $contents, $config);
     if ($object === false) {
         return false;
     }
     $this->cache->updateObject($path, $object + compact('contents'), true);
     return true;
 }
Пример #13
0
 /**
  * {@inheritdoc}
  */
 public function update($path, $contents, Config $config)
 {
     return $this->adapter->update($this->getPath($path), $contents, $config);
 }