summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-07-10 14:27:47 +0200
committerJulius Härtl <jus@bitgrid.net>2018-07-11 12:08:37 +0200
commit6da2b7c4f6744baa5a14a2919790d034de4229bf (patch)
tree1b2d9a5fbf99b528878da366928fae6ef8e4f099 /lib
parentf1469e34aa8f29a8dbec8e1ae9260fb09777f82f (diff)
downloadnextcloud-server-6da2b7c4f6744baa5a14a2919790d034de4229bf.tar.gz
nextcloud-server-6da2b7c4f6744baa5a14a2919790d034de4229bf.zip
Separate fopen into read and write methods
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/SimpleFS/SimpleFile.php18
-rw-r--r--lib/public/Files/SimpleFS/ISimpleFile.php13
2 files changed, 26 insertions, 5 deletions
diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php
index 52b7819694c..7b83e9372f7 100644
--- a/lib/private/Files/SimpleFS/SimpleFile.php
+++ b/lib/private/Files/SimpleFS/SimpleFile.php
@@ -148,13 +148,25 @@ class SimpleFile implements ISimpleFile {
}
/**
- * Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
+ * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
*
* @return resource
* @throws \OCP\Files\NotPermittedException
* @since 14.0.0
*/
- public function fopen(string $mode) {
- return $this->file->fopen($mode);
+ public function read() {
+ return $this->file->fopen('r');
}
+
+ /**
+ * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
+ *
+ * @return resource
+ * @throws \OCP\Files\NotPermittedException
+ * @since 14.0.0
+ */
+ public function write() {
+ return $this->file->fopen('w');
+ }
+
}
diff --git a/lib/public/Files/SimpleFS/ISimpleFile.php b/lib/public/Files/SimpleFS/ISimpleFile.php
index c417db6354d..a3cd3245cc7 100644
--- a/lib/public/Files/SimpleFS/ISimpleFile.php
+++ b/lib/public/Files/SimpleFS/ISimpleFile.php
@@ -101,11 +101,20 @@ interface ISimpleFile {
public function getMimeType();
/**
- * Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
+ * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
*
* @return resource
* @throws \OCP\Files\NotPermittedException
* @since 14.0.0
*/
- public function fopen(string $mode);
+ public function read();
+
+ /**
+ * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
+ *
+ * @return resource
+ * @throws \OCP\Files\NotPermittedException
+ * @since 14.0.0
+ */
+ public function write();
}