Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Enabling empty file creation via Guzzle
Browse files Browse the repository at this point in the history
  • Loading branch information
ghecquet committed Nov 21, 2016
1 parent 7e857f4 commit 67c037a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Expand Up @@ -134,13 +134,19 @@ public function stat() {

CacheService::save(AJXP_CACHE_SERVICE_NS_NODES, $id, $stat);
}
} else if (isset($stats)) {
} else {
CacheService::save(AJXP_CACHE_SERVICE_NS_NODES, $this->cacheOptions["id"], $stats, $this->cacheOptions["timelimit"]);
}

return CacheService::fetch(AJXP_CACHE_SERVICE_NS_NODES, $this->cacheOptions["id"]);
}

public function write($string) {
CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, $this->cacheOptions["id"]);

return $this->stream->write($string);
}

public function rename($newNode) {
$parentNode = $this->node->getParent();

Expand Down
4 changes: 3 additions & 1 deletion core/src/plugins/core.access/src/Stream/StreamWrapper.php
Expand Up @@ -311,8 +311,10 @@ public static function createStream($path, $mode = "r+") {
if ($useAuthStream) $nodeStream = new AuthStream($nodeStream, $node);
if ($useOAuthStream) $nodeStream = new OAuthStream($nodeStream, $node);

if (strpos($mode, 'w') !== false) {
$nodeStream = new WriteBufferStream($nodeStream, $node);
}
$nodeStream = new MetadataCachingStream($nodeStream, $node);
$nodeStream = new WriteBufferStream($nodeStream, $node);

PydioStreamWrapper::getResource($nodeStream);

Expand Down
6 changes: 2 additions & 4 deletions core/src/plugins/core.access/src/Stream/WriteBufferStream.php
Expand Up @@ -56,12 +56,10 @@ public function getContents() {
}

public function close() {
if ($this->size > 0) {
$this->stream->write($this->bufferStream);
}
$this->stream->write($this->bufferStream);

$this->size = 0;
$this->stream->close();
return $this->stream->close();
}

/**
Expand Down

0 comments on commit 67c037a

Please sign in to comment.