Skip to content

Commit 5094e29

Browse files
authored
Merge pull request #24594 from kofemann/dcache
2 parents a5c5589 + 4f2dc18 commit 5094e29

File tree

11 files changed

+24
-20
lines changed

11 files changed

+24
-20
lines changed

lib/private/Files/ObjectStore/ObjectStoreStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ public function needsPartFile() {
439439

440440
public function file_put_contents($path, $data) {
441441
$handle = $this->fopen($path, 'w+');
442-
fwrite($handle, $data);
442+
$result = fwrite($handle, $data);
443443
fclose($handle);
444-
return true;
444+
return $result;
445445
}
446446

447447
public function writeStream(string $path, $stream, int $size = null): int {

lib/private/Files/Storage/DAV.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ public function touch($path, $mtime = null) {
486486

487487
/**
488488
* @param string $path
489-
* @param string $data
490-
* @return int
489+
* @param mixed $data
490+
* @return int|false
491491
*/
492492
public function file_put_contents($path, $data) {
493493
$path = $this->cleanPath($path);

lib/private/Files/Storage/Flysystem.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public function file_get_contents($path) {
7373
* {@inheritdoc}
7474
*/
7575
public function file_put_contents($path, $data) {
76-
return $this->flysystem->put($this->buildPath($path), $data);
76+
$result = $this->flysystem->put($this->buildPath($path), $data);
77+
if ($result === true) {
78+
return strlen($data);
79+
}
80+
return $result;
7781
}
7882

7983
/**

lib/private/Files/Storage/Local.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
557557
}
558558

559559
public function writeStream(string $path, $stream, int $size = null): int {
560-
$result = file_put_contents($this->getSourcePath($path), $stream);
560+
$result = $this->file_put_contents($path, $stream);
561561
if ($result === false) {
562562
throw new GenericFileException("Failed write steam to $path");
563563
} else {

lib/private/Files/Storage/Wrapper/Encoding.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ public function file_get_contents($path) {
309309
* see http://php.net/manual/en/function.file_put_contents.php
310310
*
311311
* @param string $path
312-
* @param string $data
313-
* @return bool
312+
* @param mixed $data
313+
* @return int|false
314314
*/
315315
public function file_put_contents($path, $data) {
316316
return $this->storage->file_put_contents($this->findPathToUse($path), $data);

lib/private/Files/Storage/Wrapper/Encryption.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ public function file_get_contents($path) {
234234
* see http://php.net/manual/en/function.file_put_contents.php
235235
*
236236
* @param string $path
237-
* @param string $data
238-
* @return bool
237+
* @param mixed $data
238+
* @return int|false
239239
*/
240240
public function file_put_contents($path, $data) {
241241
// file put content will always be translated to a stream write

lib/private/Files/Storage/Wrapper/Jail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public function file_get_contents($path) {
259259
* see http://php.net/manual/en/function.file_put_contents.php
260260
*
261261
* @param string $path
262-
* @param string $data
263-
* @return bool
262+
* @param mixed $data
263+
* @return int|false
264264
*/
265265
public function file_put_contents($path, $data) {
266266
return $this->getWrapperStorage()->file_put_contents($this->getUnjailedPath($path), $data);

lib/private/Files/Storage/Wrapper/Quota.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public function free_space($path) {
122122
* see http://php.net/manual/en/function.file_put_contents.php
123123
*
124124
* @param string $path
125-
* @param string $data
126-
* @return bool
125+
* @param mixed $data
126+
* @return int|false
127127
*/
128128
public function file_put_contents($path, $data) {
129129
$free = $this->free_space($path);

lib/private/Files/Storage/Wrapper/Wrapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ public function file_get_contents($path) {
250250
* see http://php.net/manual/en/function.file_put_contents.php
251251
*
252252
* @param string $path
253-
* @param string $data
254-
* @return bool
253+
* @param mixed $data
254+
* @return int|false
255255
*/
256256
public function file_put_contents($path, $data) {
257257
return $this->getWrapperStorage()->file_put_contents($path, $data);

lib/public/Files/Storage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ public function file_get_contents($path);
230230
* see http://php.net/manual/en/function.file_put_contents.php
231231
*
232232
* @param string $path
233-
* @param string $data
234-
* @return bool
233+
* @param mixed $data
234+
* @return int|false
235235
* @since 6.0.0
236236
*/
237237
public function file_put_contents($path, $data);

0 commit comments

Comments
 (0)