Passed
Push — master ( 50d522...35aa34 )
by Christoph
43:03 queued 07:41
created
lib/private/Files/SimpleFS/NewSimpleFile.php 1 patch
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -34,193 +34,193 @@
 block discarded – undo
34 34
 use OCP\Files\SimpleFS\ISimpleFile;
35 35
 
36 36
 class NewSimpleFile implements ISimpleFile {
37
-	private $parentFolder;
38
-	private $name;
39
-	/** @var File|null */
40
-	private $file = null;
41
-
42
-	/**
43
-	 * File constructor.
44
-	 *
45
-	 * @param File $file
46
-	 */
47
-	public function __construct(Folder $parentFolder, string $name) {
48
-		$this->parentFolder = $parentFolder;
49
-		$this->name = $name;
50
-	}
51
-
52
-	/**
53
-	 * Get the name
54
-	 *
55
-	 * @return string
56
-	 */
57
-	public function getName() {
58
-		return $this->name;
59
-	}
60
-
61
-	/**
62
-	 * Get the size in bytes
63
-	 *
64
-	 * @return int
65
-	 */
66
-	public function getSize() {
67
-		if ($this->file) {
68
-			return $this->file->getSize();
69
-		} else {
70
-			return 0;
71
-		}
72
-	}
73
-
74
-	/**
75
-	 * Get the ETag
76
-	 *
77
-	 * @return string
78
-	 */
79
-	public function getETag() {
80
-		if ($this->file) {
81
-			return $this->file->getEtag();
82
-		} else {
83
-			return '';
84
-		}
85
-	}
86
-
87
-	/**
88
-	 * Get the last modification time
89
-	 *
90
-	 * @return int
91
-	 */
92
-	public function getMTime() {
93
-		if ($this->file) {
94
-			return $this->file->getMTime();
95
-		} else {
96
-			return time();
97
-		}
98
-	}
99
-
100
-	/**
101
-	 * Get the content
102
-	 *
103
-	 * @return string
104
-	 * @throws NotFoundException
105
-	 * @throws NotPermittedException
106
-	 */
107
-	public function getContent() {
108
-		if ($this->file) {
109
-			$result = $this->file->getContent();
110
-
111
-			if ($result === false) {
112
-				$this->checkFile();
113
-			}
114
-
115
-			return $result;
116
-		} else {
117
-			return '';
118
-		}
119
-	}
120
-
121
-	/**
122
-	 * Overwrite the file
123
-	 *
124
-	 * @param string|resource $data
125
-	 * @throws NotPermittedException
126
-	 * @throws NotFoundException
127
-	 */
128
-	public function putContent($data) {
129
-		try {
130
-			if ($this->file) {
131
-				$this->file->putContent($data);
132
-			} else {
133
-				$this->file = $this->parentFolder->newFile($this->name, $data);
134
-			}
135
-		} catch (NotFoundException $e) {
136
-			$this->checkFile();
137
-		}
138
-	}
139
-
140
-	/**
141
-	 * Sometimes there are some issues with the AppData. Most of them are from
142
-	 * user error. But we should handle them gracefull anyway.
143
-	 *
144
-	 * If for some reason the current file can't be found. We remove it.
145
-	 * Then traverse up and check all folders if they exists. This so that the
146
-	 * next request will have a valid appdata structure again.
147
-	 *
148
-	 * @throws NotFoundException
149
-	 */
150
-	private function checkFile() {
151
-		$cur = $this->file;
152
-
153
-		while ($cur->stat() === false) {
154
-			$parent = $cur->getParent();
155
-			try {
156
-				$cur->delete();
157
-			} catch (NotFoundException $e) {
158
-				// Just continue then
159
-			}
160
-			$cur = $parent;
161
-		}
162
-
163
-		if ($cur !== $this->file) {
164
-			throw new NotFoundException('File does not exist');
165
-		}
166
-	}
167
-
168
-
169
-	/**
170
-	 * Delete the file
171
-	 *
172
-	 * @throws NotPermittedException
173
-	 */
174
-	public function delete() {
175
-		if ($this->file) {
176
-			$this->file->delete();
177
-		}
178
-	}
179
-
180
-	/**
181
-	 * Get the MimeType
182
-	 *
183
-	 * @return string
184
-	 */
185
-	public function getMimeType() {
186
-		if ($this->file) {
187
-			return $this->file->getMimeType();
188
-		} else {
189
-			return 'text/plain';
190
-		}
191
-	}
192
-
193
-	/**
194
-	 * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
195
-	 *
196
-	 * @return resource
197
-	 * @throws \OCP\Files\NotPermittedException
198
-	 * @since 14.0.0
199
-	 */
200
-	public function read() {
201
-		if ($this->file) {
202
-			return $this->file->fopen('r');
203
-		} else {
204
-			return fopen('php://temp', 'r');
205
-		}
206
-	}
207
-
208
-	/**
209
-	 * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
210
-	 *
211
-	 * @return resource|bool
212
-	 * @throws \OCP\Files\NotPermittedException
213
-	 * @since 14.0.0
214
-	 */
215
-	public function write() {
216
-		if ($this->file) {
217
-			return $this->file->fopen('w');
218
-		} else {
219
-			$source = fopen('php://temp', 'w+');
220
-			return CallbackWrapper::wrap($source, null, null, null, null, function () use ($source) {
221
-				rewind($source);
222
-				$this->putContent($source);
223
-			});
224
-		}
225
-	}
37
+    private $parentFolder;
38
+    private $name;
39
+    /** @var File|null */
40
+    private $file = null;
41
+
42
+    /**
43
+     * File constructor.
44
+     *
45
+     * @param File $file
46
+     */
47
+    public function __construct(Folder $parentFolder, string $name) {
48
+        $this->parentFolder = $parentFolder;
49
+        $this->name = $name;
50
+    }
51
+
52
+    /**
53
+     * Get the name
54
+     *
55
+     * @return string
56
+     */
57
+    public function getName() {
58
+        return $this->name;
59
+    }
60
+
61
+    /**
62
+     * Get the size in bytes
63
+     *
64
+     * @return int
65
+     */
66
+    public function getSize() {
67
+        if ($this->file) {
68
+            return $this->file->getSize();
69
+        } else {
70
+            return 0;
71
+        }
72
+    }
73
+
74
+    /**
75
+     * Get the ETag
76
+     *
77
+     * @return string
78
+     */
79
+    public function getETag() {
80
+        if ($this->file) {
81
+            return $this->file->getEtag();
82
+        } else {
83
+            return '';
84
+        }
85
+    }
86
+
87
+    /**
88
+     * Get the last modification time
89
+     *
90
+     * @return int
91
+     */
92
+    public function getMTime() {
93
+        if ($this->file) {
94
+            return $this->file->getMTime();
95
+        } else {
96
+            return time();
97
+        }
98
+    }
99
+
100
+    /**
101
+     * Get the content
102
+     *
103
+     * @return string
104
+     * @throws NotFoundException
105
+     * @throws NotPermittedException
106
+     */
107
+    public function getContent() {
108
+        if ($this->file) {
109
+            $result = $this->file->getContent();
110
+
111
+            if ($result === false) {
112
+                $this->checkFile();
113
+            }
114
+
115
+            return $result;
116
+        } else {
117
+            return '';
118
+        }
119
+    }
120
+
121
+    /**
122
+     * Overwrite the file
123
+     *
124
+     * @param string|resource $data
125
+     * @throws NotPermittedException
126
+     * @throws NotFoundException
127
+     */
128
+    public function putContent($data) {
129
+        try {
130
+            if ($this->file) {
131
+                $this->file->putContent($data);
132
+            } else {
133
+                $this->file = $this->parentFolder->newFile($this->name, $data);
134
+            }
135
+        } catch (NotFoundException $e) {
136
+            $this->checkFile();
137
+        }
138
+    }
139
+
140
+    /**
141
+     * Sometimes there are some issues with the AppData. Most of them are from
142
+     * user error. But we should handle them gracefull anyway.
143
+     *
144
+     * If for some reason the current file can't be found. We remove it.
145
+     * Then traverse up and check all folders if they exists. This so that the
146
+     * next request will have a valid appdata structure again.
147
+     *
148
+     * @throws NotFoundException
149
+     */
150
+    private function checkFile() {
151
+        $cur = $this->file;
152
+
153
+        while ($cur->stat() === false) {
154
+            $parent = $cur->getParent();
155
+            try {
156
+                $cur->delete();
157
+            } catch (NotFoundException $e) {
158
+                // Just continue then
159
+            }
160
+            $cur = $parent;
161
+        }
162
+
163
+        if ($cur !== $this->file) {
164
+            throw new NotFoundException('File does not exist');
165
+        }
166
+    }
167
+
168
+
169
+    /**
170
+     * Delete the file
171
+     *
172
+     * @throws NotPermittedException
173
+     */
174
+    public function delete() {
175
+        if ($this->file) {
176
+            $this->file->delete();
177
+        }
178
+    }
179
+
180
+    /**
181
+     * Get the MimeType
182
+     *
183
+     * @return string
184
+     */
185
+    public function getMimeType() {
186
+        if ($this->file) {
187
+            return $this->file->getMimeType();
188
+        } else {
189
+            return 'text/plain';
190
+        }
191
+    }
192
+
193
+    /**
194
+     * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
195
+     *
196
+     * @return resource
197
+     * @throws \OCP\Files\NotPermittedException
198
+     * @since 14.0.0
199
+     */
200
+    public function read() {
201
+        if ($this->file) {
202
+            return $this->file->fopen('r');
203
+        } else {
204
+            return fopen('php://temp', 'r');
205
+        }
206
+    }
207
+
208
+    /**
209
+     * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
210
+     *
211
+     * @return resource|bool
212
+     * @throws \OCP\Files\NotPermittedException
213
+     * @since 14.0.0
214
+     */
215
+    public function write() {
216
+        if ($this->file) {
217
+            return $this->file->fopen('w');
218
+        } else {
219
+            $source = fopen('php://temp', 'w+');
220
+            return CallbackWrapper::wrap($source, null, null, null, null, function () use ($source) {
221
+                rewind($source);
222
+                $this->putContent($source);
223
+            });
224
+        }
225
+    }
226 226
 }
Please login to merge, or discard this patch.
lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -34,82 +34,82 @@
 block discarded – undo
34 34
 
35 35
 class MoveAvatarsBackgroundJob extends QueuedJob {
36 36
 
37
-	/** @var IUserManager */
38
-	private $userManager;
37
+    /** @var IUserManager */
38
+    private $userManager;
39 39
 
40
-	/** @var LoggerInterface */
41
-	private $logger;
40
+    /** @var LoggerInterface */
41
+    private $logger;
42 42
 
43
-	/** @var IAvatarManager */
44
-	private $avatarManager;
43
+    /** @var IAvatarManager */
44
+    private $avatarManager;
45 45
 
46
-	/** @var Storage */
47
-	private $owncloudAvatarStorage;
46
+    /** @var Storage */
47
+    private $owncloudAvatarStorage;
48 48
 
49
-	public function __construct(IUserManager $userManager, LoggerInterface $logger, IAvatarManager $avatarManager, IRootFolder $rootFolder) {
50
-		$this->userManager = $userManager;
51
-		$this->logger = $logger;
52
-		$this->avatarManager = $avatarManager;
53
-		try {
54
-			$this->owncloudAvatarStorage = $rootFolder->get('avatars')->getStorage();
55
-		} catch (\Exception $e) {
56
-		}
57
-	}
49
+    public function __construct(IUserManager $userManager, LoggerInterface $logger, IAvatarManager $avatarManager, IRootFolder $rootFolder) {
50
+        $this->userManager = $userManager;
51
+        $this->logger = $logger;
52
+        $this->avatarManager = $avatarManager;
53
+        try {
54
+            $this->owncloudAvatarStorage = $rootFolder->get('avatars')->getStorage();
55
+        } catch (\Exception $e) {
56
+        }
57
+    }
58 58
 
59
-	public function run($arguments) {
60
-		$this->logger->info('Started migrating avatars to AppData folder');
61
-		$this->moveAvatars();
62
-		$this->logger->info('All avatars migrated to AppData folder');
63
-	}
59
+    public function run($arguments) {
60
+        $this->logger->info('Started migrating avatars to AppData folder');
61
+        $this->moveAvatars();
62
+        $this->logger->info('All avatars migrated to AppData folder');
63
+    }
64 64
 
65
-	private function moveAvatars(): void {
66
-		if (!$this->owncloudAvatarStorage) {
67
-			$this->logger->info('No legacy avatars available, skipping migration');
68
-			return;
69
-		}
65
+    private function moveAvatars(): void {
66
+        if (!$this->owncloudAvatarStorage) {
67
+            $this->logger->info('No legacy avatars available, skipping migration');
68
+            return;
69
+        }
70 70
 
71
-		$counter = 0;
72
-		$this->userManager->callForSeenUsers(function (IUser $user) use ($counter) {
73
-			$uid = $user->getUID();
71
+        $counter = 0;
72
+        $this->userManager->callForSeenUsers(function (IUser $user) use ($counter) {
73
+            $uid = $user->getUID();
74 74
 
75
-			$path = 'avatars/' . $this->buildOwnCloudAvatarPath($uid);
76
-			$avatar = $this->avatarManager->getAvatar($uid);
77
-			try {
78
-				$avatarPath = $path . '/avatar.' . $this->getExtension($path);
79
-				$resource = $this->owncloudAvatarStorage->fopen($avatarPath, 'r');
80
-				if (is_resource($resource)) {
81
-					$avatar->set($resource);
82
-					fclose($resource);
83
-				} else {
84
-					throw new \Exception('Failed to open old avatar file for reading');
85
-				}
86
-			} catch (NotFoundException $e) {
87
-				// In case there is no avatar we can just skip
88
-			} catch (\Throwable $e) {
89
-				$this->logger->error('Failed to migrate avatar for user ' . $uid, ['exception' => $e]);
90
-			}
75
+            $path = 'avatars/' . $this->buildOwnCloudAvatarPath($uid);
76
+            $avatar = $this->avatarManager->getAvatar($uid);
77
+            try {
78
+                $avatarPath = $path . '/avatar.' . $this->getExtension($path);
79
+                $resource = $this->owncloudAvatarStorage->fopen($avatarPath, 'r');
80
+                if (is_resource($resource)) {
81
+                    $avatar->set($resource);
82
+                    fclose($resource);
83
+                } else {
84
+                    throw new \Exception('Failed to open old avatar file for reading');
85
+                }
86
+            } catch (NotFoundException $e) {
87
+                // In case there is no avatar we can just skip
88
+            } catch (\Throwable $e) {
89
+                $this->logger->error('Failed to migrate avatar for user ' . $uid, ['exception' => $e]);
90
+            }
91 91
 
92
-			$counter++;
93
-			if ($counter % 100 === 0) {
94
-				$this->logger->info('{amount} avatars migrated', ['amount' => $counter]);
95
-			}
96
-		});
97
-	}
92
+            $counter++;
93
+            if ($counter % 100 === 0) {
94
+                $this->logger->info('{amount} avatars migrated', ['amount' => $counter]);
95
+            }
96
+        });
97
+    }
98 98
 
99
-	/**
100
-	 * @throws NotFoundException
101
-	 */
102
-	private function getExtension(string $path): string {
103
-		if ($this->owncloudAvatarStorage->file_exists("{$path}/avatar.jpg")) {
104
-			return 'jpg';
105
-		}
106
-		if ($this->owncloudAvatarStorage->file_exists("{$path}/avatar.png")) {
107
-			return 'png';
108
-		}
109
-		throw new NotFoundException("{$path}/avatar.jpg|png");
110
-	}
99
+    /**
100
+     * @throws NotFoundException
101
+     */
102
+    private function getExtension(string $path): string {
103
+        if ($this->owncloudAvatarStorage->file_exists("{$path}/avatar.jpg")) {
104
+            return 'jpg';
105
+        }
106
+        if ($this->owncloudAvatarStorage->file_exists("{$path}/avatar.png")) {
107
+            return 'png';
108
+        }
109
+        throw new NotFoundException("{$path}/avatar.jpg|png");
110
+    }
111 111
 
112
-	protected function buildOwnCloudAvatarPath(string $userId): string {
113
-		return substr_replace(substr_replace(md5($userId), '/', 4, 0), '/', 2, 0);
114
-	}
112
+    protected function buildOwnCloudAvatarPath(string $userId): string {
113
+        return substr_replace(substr_replace(md5($userId), '/', 4, 0), '/', 2, 0);
114
+    }
115 115
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 
71 71
 		$counter = 0;
72
-		$this->userManager->callForSeenUsers(function (IUser $user) use ($counter) {
72
+		$this->userManager->callForSeenUsers(function(IUser $user) use ($counter) {
73 73
 			$uid = $user->getUID();
74 74
 
75
-			$path = 'avatars/' . $this->buildOwnCloudAvatarPath($uid);
75
+			$path = 'avatars/'.$this->buildOwnCloudAvatarPath($uid);
76 76
 			$avatar = $this->avatarManager->getAvatar($uid);
77 77
 			try {
78
-				$avatarPath = $path . '/avatar.' . $this->getExtension($path);
78
+				$avatarPath = $path.'/avatar.'.$this->getExtension($path);
79 79
 				$resource = $this->owncloudAvatarStorage->fopen($avatarPath, 'r');
80 80
 				if (is_resource($resource)) {
81 81
 					$avatar->set($resource);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			} catch (NotFoundException $e) {
87 87
 				// In case there is no avatar we can just skip
88 88
 			} catch (\Throwable $e) {
89
-				$this->logger->error('Failed to migrate avatar for user ' . $uid, ['exception' => $e]);
89
+				$this->logger->error('Failed to migrate avatar for user '.$uid, ['exception' => $e]);
90 90
 			}
91 91
 
92 92
 			$counter++;
Please login to merge, or discard this patch.
lib/public/Files/Storage/IStorage.php 1 patch
Indentation   +411 added lines, -411 removed lines patch added patch discarded remove patch
@@ -47,415 +47,415 @@
 block discarded – undo
47 47
  * @since 9.0.0
48 48
  */
49 49
 interface IStorage {
50
-	/**
51
-	 * $parameters is a free form array with the configuration options needed to construct the storage
52
-	 *
53
-	 * @param array $parameters
54
-	 * @since 9.0.0
55
-	 */
56
-	public function __construct($parameters);
57
-
58
-	/**
59
-	 * Get the identifier for the storage,
60
-	 * the returned id should be the same for every storage object that is created with the same parameters
61
-	 * and two storage objects with the same id should refer to two storages that display the same files.
62
-	 *
63
-	 * @return string
64
-	 * @since 9.0.0
65
-	 */
66
-	public function getId();
67
-
68
-	/**
69
-	 * see https://www.php.net/manual/en/function.mkdir.php
70
-	 * implementations need to implement a recursive mkdir
71
-	 *
72
-	 * @param string $path
73
-	 * @return bool
74
-	 * @since 9.0.0
75
-	 */
76
-	public function mkdir($path);
77
-
78
-	/**
79
-	 * see https://www.php.net/manual/en/function.rmdir.php
80
-	 *
81
-	 * @param string $path
82
-	 * @return bool
83
-	 * @since 9.0.0
84
-	 */
85
-	public function rmdir($path);
86
-
87
-	/**
88
-	 * see https://www.php.net/manual/en/function.opendir.php
89
-	 *
90
-	 * @param string $path
91
-	 * @return resource|bool
92
-	 * @since 9.0.0
93
-	 */
94
-	public function opendir($path);
95
-
96
-	/**
97
-	 * see https://www.php.net/manual/en/function.is-dir.php
98
-	 *
99
-	 * @param string $path
100
-	 * @return bool
101
-	 * @since 9.0.0
102
-	 */
103
-	public function is_dir($path);
104
-
105
-	/**
106
-	 * see https://www.php.net/manual/en/function.is-file.php
107
-	 *
108
-	 * @param string $path
109
-	 * @return bool
110
-	 * @since 9.0.0
111
-	 */
112
-	public function is_file($path);
113
-
114
-	/**
115
-	 * see https://www.php.net/manual/en/function.stat.php
116
-	 * only the following keys are required in the result: size and mtime
117
-	 *
118
-	 * @param string $path
119
-	 * @return array|bool
120
-	 * @since 9.0.0
121
-	 */
122
-	public function stat($path);
123
-
124
-	/**
125
-	 * see https://www.php.net/manual/en/function.filetype.php
126
-	 *
127
-	 * @param string $path
128
-	 * @return string|bool
129
-	 * @since 9.0.0
130
-	 */
131
-	public function filetype($path);
132
-
133
-	/**
134
-	 * see https://www.php.net/manual/en/function.filesize.php
135
-	 * The result for filesize when called on a folder is required to be 0
136
-	 *
137
-	 * @param string $path
138
-	 * @return int|bool
139
-	 * @since 9.0.0
140
-	 */
141
-	public function filesize($path);
142
-
143
-	/**
144
-	 * check if a file can be created in $path
145
-	 *
146
-	 * @param string $path
147
-	 * @return bool
148
-	 * @since 9.0.0
149
-	 */
150
-	public function isCreatable($path);
151
-
152
-	/**
153
-	 * check if a file can be read
154
-	 *
155
-	 * @param string $path
156
-	 * @return bool
157
-	 * @since 9.0.0
158
-	 */
159
-	public function isReadable($path);
160
-
161
-	/**
162
-	 * check if a file can be written to
163
-	 *
164
-	 * @param string $path
165
-	 * @return bool
166
-	 * @since 9.0.0
167
-	 */
168
-	public function isUpdatable($path);
169
-
170
-	/**
171
-	 * check if a file can be deleted
172
-	 *
173
-	 * @param string $path
174
-	 * @return bool
175
-	 * @since 9.0.0
176
-	 */
177
-	public function isDeletable($path);
178
-
179
-	/**
180
-	 * check if a file can be shared
181
-	 *
182
-	 * @param string $path
183
-	 * @return bool
184
-	 * @since 9.0.0
185
-	 */
186
-	public function isSharable($path);
187
-
188
-	/**
189
-	 * get the full permissions of a path.
190
-	 * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
191
-	 *
192
-	 * @param string $path
193
-	 * @return int
194
-	 * @since 9.0.0
195
-	 */
196
-	public function getPermissions($path);
197
-
198
-	/**
199
-	 * see https://www.php.net/manual/en/function.file_exists.php
200
-	 *
201
-	 * @param string $path
202
-	 * @return bool
203
-	 * @since 9.0.0
204
-	 */
205
-	public function file_exists($path);
206
-
207
-	/**
208
-	 * see https://www.php.net/manual/en/function.filemtime.php
209
-	 *
210
-	 * @param string $path
211
-	 * @return int|bool
212
-	 * @since 9.0.0
213
-	 */
214
-	public function filemtime($path);
215
-
216
-	/**
217
-	 * see https://www.php.net/manual/en/function.file_get_contents.php
218
-	 *
219
-	 * @param string $path
220
-	 * @return string|bool
221
-	 * @since 9.0.0
222
-	 */
223
-	public function file_get_contents($path);
224
-
225
-	/**
226
-	 * see https://www.php.net/manual/en/function.file_put_contents.php
227
-	 *
228
-	 * @param string $path
229
-	 * @param mixed $data
230
-	 * @return int|false
231
-	 * @since 9.0.0
232
-	 */
233
-	public function file_put_contents($path, $data);
234
-
235
-	/**
236
-	 * see https://www.php.net/manual/en/function.unlink.php
237
-	 *
238
-	 * @param string $path
239
-	 * @return bool
240
-	 * @since 9.0.0
241
-	 */
242
-	public function unlink($path);
243
-
244
-	/**
245
-	 * see https://www.php.net/manual/en/function.rename.php
246
-	 *
247
-	 * @param string $path1
248
-	 * @param string $path2
249
-	 * @return bool
250
-	 * @since 9.0.0
251
-	 */
252
-	public function rename($path1, $path2);
253
-
254
-	/**
255
-	 * see https://www.php.net/manual/en/function.copy.php
256
-	 *
257
-	 * @param string $path1
258
-	 * @param string $path2
259
-	 * @return bool
260
-	 * @since 9.0.0
261
-	 */
262
-	public function copy($path1, $path2);
263
-
264
-	/**
265
-	 * see https://www.php.net/manual/en/function.fopen.php
266
-	 *
267
-	 * @param string $path
268
-	 * @param string $mode
269
-	 * @return resource|bool
270
-	 * @since 9.0.0
271
-	 */
272
-	public function fopen($path, $mode);
273
-
274
-	/**
275
-	 * get the mimetype for a file or folder
276
-	 * The mimetype for a folder is required to be "httpd/unix-directory"
277
-	 *
278
-	 * @param string $path
279
-	 * @return string|bool
280
-	 * @since 9.0.0
281
-	 */
282
-	public function getMimeType($path);
283
-
284
-	/**
285
-	 * see https://www.php.net/manual/en/function.hash-file.php
286
-	 *
287
-	 * @param string $type
288
-	 * @param string $path
289
-	 * @param bool $raw
290
-	 * @return string|bool
291
-	 * @since 9.0.0
292
-	 */
293
-	public function hash($type, $path, $raw = false);
294
-
295
-	/**
296
-	 * see https://www.php.net/manual/en/function.free_space.php
297
-	 *
298
-	 * @param string $path
299
-	 * @return int|bool
300
-	 * @since 9.0.0
301
-	 */
302
-	public function free_space($path);
303
-
304
-	/**
305
-	 * see https://www.php.net/manual/en/function.touch.php
306
-	 * If the backend does not support the operation, false should be returned
307
-	 *
308
-	 * @param string $path
309
-	 * @param int $mtime
310
-	 * @return bool
311
-	 * @since 9.0.0
312
-	 */
313
-	public function touch($path, $mtime = null);
314
-
315
-	/**
316
-	 * get the path to a local version of the file.
317
-	 * The local version of the file can be temporary and doesn't have to be persistent across requests
318
-	 *
319
-	 * @param string $path
320
-	 * @return string|bool
321
-	 * @since 9.0.0
322
-	 */
323
-	public function getLocalFile($path);
324
-
325
-	/**
326
-	 * check if a file or folder has been updated since $time
327
-	 *
328
-	 * @param string $path
329
-	 * @param int $time
330
-	 * @return bool
331
-	 * @since 9.0.0
332
-	 *
333
-	 * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
334
-	 * returning true for other changes in the folder is optional
335
-	 */
336
-	public function hasUpdated($path, $time);
337
-
338
-	/**
339
-	 * get the ETag for a file or folder
340
-	 *
341
-	 * @param string $path
342
-	 * @return string|bool
343
-	 * @since 9.0.0
344
-	 */
345
-	public function getETag($path);
346
-
347
-	/**
348
-	 * Returns whether the storage is local, which means that files
349
-	 * are stored on the local filesystem instead of remotely.
350
-	 * Calling getLocalFile() for local storages should always
351
-	 * return the local files, whereas for non-local storages
352
-	 * it might return a temporary file.
353
-	 *
354
-	 * @return bool true if the files are stored locally, false otherwise
355
-	 * @since 9.0.0
356
-	 */
357
-	public function isLocal();
358
-
359
-	/**
360
-	 * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
361
-	 *
362
-	 * @param string $class
363
-	 * @return bool
364
-	 * @since 9.0.0
365
-	 */
366
-	public function instanceOfStorage($class);
367
-
368
-	/**
369
-	 * A custom storage implementation can return an url for direct download of a give file.
370
-	 *
371
-	 * For now the returned array can hold the parameter url - in future more attributes might follow.
372
-	 *
373
-	 * @param string $path
374
-	 * @return array|bool
375
-	 * @since 9.0.0
376
-	 */
377
-	public function getDirectDownload($path);
378
-
379
-	/**
380
-	 * @param string $path the path of the target folder
381
-	 * @param string $fileName the name of the file itself
382
-	 * @return void
383
-	 * @throws InvalidPathException
384
-	 * @since 9.0.0
385
-	 */
386
-	public function verifyPath($path, $fileName);
387
-
388
-	/**
389
-	 * @param IStorage $sourceStorage
390
-	 * @param string $sourceInternalPath
391
-	 * @param string $targetInternalPath
392
-	 * @return bool
393
-	 * @since 9.0.0
394
-	 */
395
-	public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
396
-
397
-	/**
398
-	 * @param IStorage $sourceStorage
399
-	 * @param string $sourceInternalPath
400
-	 * @param string $targetInternalPath
401
-	 * @return bool
402
-	 * @since 9.0.0
403
-	 */
404
-	public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
405
-
406
-	/**
407
-	 * Test a storage for availability
408
-	 *
409
-	 * @since 9.0.0
410
-	 * @return bool
411
-	 */
412
-	public function test();
413
-
414
-	/**
415
-	 * @since 9.0.0
416
-	 * @return array [ available, last_checked ]
417
-	 */
418
-	public function getAvailability();
419
-
420
-	/**
421
-	 * @since 9.0.0
422
-	 * @param bool $isAvailable
423
-	 */
424
-	public function setAvailability($isAvailable);
425
-
426
-	/**
427
-	 * @param string $path path for which to retrieve the owner
428
-	 * @since 9.0.0
429
-	 */
430
-	public function getOwner($path);
431
-
432
-	/**
433
-	 * @return ICache
434
-	 * @since 9.0.0
435
-	 */
436
-	public function getCache();
437
-
438
-	/**
439
-	 * @return IPropagator
440
-	 * @since 9.0.0
441
-	 */
442
-	public function getPropagator();
443
-
444
-	/**
445
-	 * @return IScanner
446
-	 * @since 9.0.0
447
-	 */
448
-	public function getScanner();
449
-
450
-	/**
451
-	 * @return IUpdater
452
-	 * @since 9.0.0
453
-	 */
454
-	public function getUpdater();
455
-
456
-	/**
457
-	 * @return IWatcher
458
-	 * @since 9.0.0
459
-	 */
460
-	public function getWatcher();
50
+    /**
51
+     * $parameters is a free form array with the configuration options needed to construct the storage
52
+     *
53
+     * @param array $parameters
54
+     * @since 9.0.0
55
+     */
56
+    public function __construct($parameters);
57
+
58
+    /**
59
+     * Get the identifier for the storage,
60
+     * the returned id should be the same for every storage object that is created with the same parameters
61
+     * and two storage objects with the same id should refer to two storages that display the same files.
62
+     *
63
+     * @return string
64
+     * @since 9.0.0
65
+     */
66
+    public function getId();
67
+
68
+    /**
69
+     * see https://www.php.net/manual/en/function.mkdir.php
70
+     * implementations need to implement a recursive mkdir
71
+     *
72
+     * @param string $path
73
+     * @return bool
74
+     * @since 9.0.0
75
+     */
76
+    public function mkdir($path);
77
+
78
+    /**
79
+     * see https://www.php.net/manual/en/function.rmdir.php
80
+     *
81
+     * @param string $path
82
+     * @return bool
83
+     * @since 9.0.0
84
+     */
85
+    public function rmdir($path);
86
+
87
+    /**
88
+     * see https://www.php.net/manual/en/function.opendir.php
89
+     *
90
+     * @param string $path
91
+     * @return resource|bool
92
+     * @since 9.0.0
93
+     */
94
+    public function opendir($path);
95
+
96
+    /**
97
+     * see https://www.php.net/manual/en/function.is-dir.php
98
+     *
99
+     * @param string $path
100
+     * @return bool
101
+     * @since 9.0.0
102
+     */
103
+    public function is_dir($path);
104
+
105
+    /**
106
+     * see https://www.php.net/manual/en/function.is-file.php
107
+     *
108
+     * @param string $path
109
+     * @return bool
110
+     * @since 9.0.0
111
+     */
112
+    public function is_file($path);
113
+
114
+    /**
115
+     * see https://www.php.net/manual/en/function.stat.php
116
+     * only the following keys are required in the result: size and mtime
117
+     *
118
+     * @param string $path
119
+     * @return array|bool
120
+     * @since 9.0.0
121
+     */
122
+    public function stat($path);
123
+
124
+    /**
125
+     * see https://www.php.net/manual/en/function.filetype.php
126
+     *
127
+     * @param string $path
128
+     * @return string|bool
129
+     * @since 9.0.0
130
+     */
131
+    public function filetype($path);
132
+
133
+    /**
134
+     * see https://www.php.net/manual/en/function.filesize.php
135
+     * The result for filesize when called on a folder is required to be 0
136
+     *
137
+     * @param string $path
138
+     * @return int|bool
139
+     * @since 9.0.0
140
+     */
141
+    public function filesize($path);
142
+
143
+    /**
144
+     * check if a file can be created in $path
145
+     *
146
+     * @param string $path
147
+     * @return bool
148
+     * @since 9.0.0
149
+     */
150
+    public function isCreatable($path);
151
+
152
+    /**
153
+     * check if a file can be read
154
+     *
155
+     * @param string $path
156
+     * @return bool
157
+     * @since 9.0.0
158
+     */
159
+    public function isReadable($path);
160
+
161
+    /**
162
+     * check if a file can be written to
163
+     *
164
+     * @param string $path
165
+     * @return bool
166
+     * @since 9.0.0
167
+     */
168
+    public function isUpdatable($path);
169
+
170
+    /**
171
+     * check if a file can be deleted
172
+     *
173
+     * @param string $path
174
+     * @return bool
175
+     * @since 9.0.0
176
+     */
177
+    public function isDeletable($path);
178
+
179
+    /**
180
+     * check if a file can be shared
181
+     *
182
+     * @param string $path
183
+     * @return bool
184
+     * @since 9.0.0
185
+     */
186
+    public function isSharable($path);
187
+
188
+    /**
189
+     * get the full permissions of a path.
190
+     * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
191
+     *
192
+     * @param string $path
193
+     * @return int
194
+     * @since 9.0.0
195
+     */
196
+    public function getPermissions($path);
197
+
198
+    /**
199
+     * see https://www.php.net/manual/en/function.file_exists.php
200
+     *
201
+     * @param string $path
202
+     * @return bool
203
+     * @since 9.0.0
204
+     */
205
+    public function file_exists($path);
206
+
207
+    /**
208
+     * see https://www.php.net/manual/en/function.filemtime.php
209
+     *
210
+     * @param string $path
211
+     * @return int|bool
212
+     * @since 9.0.0
213
+     */
214
+    public function filemtime($path);
215
+
216
+    /**
217
+     * see https://www.php.net/manual/en/function.file_get_contents.php
218
+     *
219
+     * @param string $path
220
+     * @return string|bool
221
+     * @since 9.0.0
222
+     */
223
+    public function file_get_contents($path);
224
+
225
+    /**
226
+     * see https://www.php.net/manual/en/function.file_put_contents.php
227
+     *
228
+     * @param string $path
229
+     * @param mixed $data
230
+     * @return int|false
231
+     * @since 9.0.0
232
+     */
233
+    public function file_put_contents($path, $data);
234
+
235
+    /**
236
+     * see https://www.php.net/manual/en/function.unlink.php
237
+     *
238
+     * @param string $path
239
+     * @return bool
240
+     * @since 9.0.0
241
+     */
242
+    public function unlink($path);
243
+
244
+    /**
245
+     * see https://www.php.net/manual/en/function.rename.php
246
+     *
247
+     * @param string $path1
248
+     * @param string $path2
249
+     * @return bool
250
+     * @since 9.0.0
251
+     */
252
+    public function rename($path1, $path2);
253
+
254
+    /**
255
+     * see https://www.php.net/manual/en/function.copy.php
256
+     *
257
+     * @param string $path1
258
+     * @param string $path2
259
+     * @return bool
260
+     * @since 9.0.0
261
+     */
262
+    public function copy($path1, $path2);
263
+
264
+    /**
265
+     * see https://www.php.net/manual/en/function.fopen.php
266
+     *
267
+     * @param string $path
268
+     * @param string $mode
269
+     * @return resource|bool
270
+     * @since 9.0.0
271
+     */
272
+    public function fopen($path, $mode);
273
+
274
+    /**
275
+     * get the mimetype for a file or folder
276
+     * The mimetype for a folder is required to be "httpd/unix-directory"
277
+     *
278
+     * @param string $path
279
+     * @return string|bool
280
+     * @since 9.0.0
281
+     */
282
+    public function getMimeType($path);
283
+
284
+    /**
285
+     * see https://www.php.net/manual/en/function.hash-file.php
286
+     *
287
+     * @param string $type
288
+     * @param string $path
289
+     * @param bool $raw
290
+     * @return string|bool
291
+     * @since 9.0.0
292
+     */
293
+    public function hash($type, $path, $raw = false);
294
+
295
+    /**
296
+     * see https://www.php.net/manual/en/function.free_space.php
297
+     *
298
+     * @param string $path
299
+     * @return int|bool
300
+     * @since 9.0.0
301
+     */
302
+    public function free_space($path);
303
+
304
+    /**
305
+     * see https://www.php.net/manual/en/function.touch.php
306
+     * If the backend does not support the operation, false should be returned
307
+     *
308
+     * @param string $path
309
+     * @param int $mtime
310
+     * @return bool
311
+     * @since 9.0.0
312
+     */
313
+    public function touch($path, $mtime = null);
314
+
315
+    /**
316
+     * get the path to a local version of the file.
317
+     * The local version of the file can be temporary and doesn't have to be persistent across requests
318
+     *
319
+     * @param string $path
320
+     * @return string|bool
321
+     * @since 9.0.0
322
+     */
323
+    public function getLocalFile($path);
324
+
325
+    /**
326
+     * check if a file or folder has been updated since $time
327
+     *
328
+     * @param string $path
329
+     * @param int $time
330
+     * @return bool
331
+     * @since 9.0.0
332
+     *
333
+     * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
334
+     * returning true for other changes in the folder is optional
335
+     */
336
+    public function hasUpdated($path, $time);
337
+
338
+    /**
339
+     * get the ETag for a file or folder
340
+     *
341
+     * @param string $path
342
+     * @return string|bool
343
+     * @since 9.0.0
344
+     */
345
+    public function getETag($path);
346
+
347
+    /**
348
+     * Returns whether the storage is local, which means that files
349
+     * are stored on the local filesystem instead of remotely.
350
+     * Calling getLocalFile() for local storages should always
351
+     * return the local files, whereas for non-local storages
352
+     * it might return a temporary file.
353
+     *
354
+     * @return bool true if the files are stored locally, false otherwise
355
+     * @since 9.0.0
356
+     */
357
+    public function isLocal();
358
+
359
+    /**
360
+     * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
361
+     *
362
+     * @param string $class
363
+     * @return bool
364
+     * @since 9.0.0
365
+     */
366
+    public function instanceOfStorage($class);
367
+
368
+    /**
369
+     * A custom storage implementation can return an url for direct download of a give file.
370
+     *
371
+     * For now the returned array can hold the parameter url - in future more attributes might follow.
372
+     *
373
+     * @param string $path
374
+     * @return array|bool
375
+     * @since 9.0.0
376
+     */
377
+    public function getDirectDownload($path);
378
+
379
+    /**
380
+     * @param string $path the path of the target folder
381
+     * @param string $fileName the name of the file itself
382
+     * @return void
383
+     * @throws InvalidPathException
384
+     * @since 9.0.0
385
+     */
386
+    public function verifyPath($path, $fileName);
387
+
388
+    /**
389
+     * @param IStorage $sourceStorage
390
+     * @param string $sourceInternalPath
391
+     * @param string $targetInternalPath
392
+     * @return bool
393
+     * @since 9.0.0
394
+     */
395
+    public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
396
+
397
+    /**
398
+     * @param IStorage $sourceStorage
399
+     * @param string $sourceInternalPath
400
+     * @param string $targetInternalPath
401
+     * @return bool
402
+     * @since 9.0.0
403
+     */
404
+    public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
405
+
406
+    /**
407
+     * Test a storage for availability
408
+     *
409
+     * @since 9.0.0
410
+     * @return bool
411
+     */
412
+    public function test();
413
+
414
+    /**
415
+     * @since 9.0.0
416
+     * @return array [ available, last_checked ]
417
+     */
418
+    public function getAvailability();
419
+
420
+    /**
421
+     * @since 9.0.0
422
+     * @param bool $isAvailable
423
+     */
424
+    public function setAvailability($isAvailable);
425
+
426
+    /**
427
+     * @param string $path path for which to retrieve the owner
428
+     * @since 9.0.0
429
+     */
430
+    public function getOwner($path);
431
+
432
+    /**
433
+     * @return ICache
434
+     * @since 9.0.0
435
+     */
436
+    public function getCache();
437
+
438
+    /**
439
+     * @return IPropagator
440
+     * @since 9.0.0
441
+     */
442
+    public function getPropagator();
443
+
444
+    /**
445
+     * @return IScanner
446
+     * @since 9.0.0
447
+     */
448
+    public function getScanner();
449
+
450
+    /**
451
+     * @return IUpdater
452
+     * @since 9.0.0
453
+     */
454
+    public function getUpdater();
455
+
456
+    /**
457
+     * @return IWatcher
458
+     * @since 9.0.0
459
+     */
460
+    public function getWatcher();
461 461
 }
Please login to merge, or discard this patch.
lib/public/Files/SimpleFS/ISimpleFile.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -34,89 +34,89 @@
 block discarded – undo
34 34
  */
35 35
 interface ISimpleFile {
36 36
 
37
-	/**
38
-	 * Get the name
39
-	 *
40
-	 * @return string
41
-	 * @since 11.0.0
42
-	 */
43
-	public function getName();
37
+    /**
38
+     * Get the name
39
+     *
40
+     * @return string
41
+     * @since 11.0.0
42
+     */
43
+    public function getName();
44 44
 
45
-	/**
46
-	 * Get the size in bytes
47
-	 *
48
-	 * @return int
49
-	 * @since 11.0.0
50
-	 */
51
-	public function getSize();
45
+    /**
46
+     * Get the size in bytes
47
+     *
48
+     * @return int
49
+     * @since 11.0.0
50
+     */
51
+    public function getSize();
52 52
 
53
-	/**
54
-	 * Get the ETag
55
-	 *
56
-	 * @return string
57
-	 * @since 11.0.0
58
-	 */
59
-	public function getETag();
53
+    /**
54
+     * Get the ETag
55
+     *
56
+     * @return string
57
+     * @since 11.0.0
58
+     */
59
+    public function getETag();
60 60
 
61
-	/**
62
-	 * Get the last modification time
63
-	 *
64
-	 * @return int
65
-	 * @since 11.0.0
66
-	 */
67
-	public function getMTime();
61
+    /**
62
+     * Get the last modification time
63
+     *
64
+     * @return int
65
+     * @since 11.0.0
66
+     */
67
+    public function getMTime();
68 68
 
69
-	/**
70
-	 * Get the content
71
-	 *
72
-	 * @throws NotPermittedException
73
-	 * @throws NotFoundException
74
-	 * @return string
75
-	 * @since 11.0.0
76
-	 */
77
-	public function getContent();
69
+    /**
70
+     * Get the content
71
+     *
72
+     * @throws NotPermittedException
73
+     * @throws NotFoundException
74
+     * @return string
75
+     * @since 11.0.0
76
+     */
77
+    public function getContent();
78 78
 
79
-	/**
80
-	 * Overwrite the file
81
-	 *
82
-	 * @param string|resource $data
83
-	 * @throws NotPermittedException
84
-	 * @throws NotFoundException
85
-	 * @since 11.0.0
86
-	 */
87
-	public function putContent($data);
79
+    /**
80
+     * Overwrite the file
81
+     *
82
+     * @param string|resource $data
83
+     * @throws NotPermittedException
84
+     * @throws NotFoundException
85
+     * @since 11.0.0
86
+     */
87
+    public function putContent($data);
88 88
 
89
-	/**
90
-	 * Delete the file
91
-	 *
92
-	 * @throws NotPermittedException
93
-	 * @since 11.0.0
94
-	 */
95
-	public function delete();
89
+    /**
90
+     * Delete the file
91
+     *
92
+     * @throws NotPermittedException
93
+     * @since 11.0.0
94
+     */
95
+    public function delete();
96 96
 
97
-	/**
98
-	 * Get the MimeType
99
-	 *
100
-	 * @return string
101
-	 * @since 11.0.0
102
-	 */
103
-	public function getMimeType();
97
+    /**
98
+     * Get the MimeType
99
+     *
100
+     * @return string
101
+     * @since 11.0.0
102
+     */
103
+    public function getMimeType();
104 104
 
105
-	/**
106
-	 * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
107
-	 *
108
-	 * @return resource
109
-	 * @throws \OCP\Files\NotPermittedException
110
-	 * @since 14.0.0
111
-	 */
112
-	public function read();
105
+    /**
106
+     * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
107
+     *
108
+     * @return resource
109
+     * @throws \OCP\Files\NotPermittedException
110
+     * @since 14.0.0
111
+     */
112
+    public function read();
113 113
 
114
-	/**
115
-	 * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
116
-	 *
117
-	 * @return resource|bool
118
-	 * @throws \OCP\Files\NotPermittedException
119
-	 * @since 14.0.0
120
-	 */
121
-	public function write();
114
+    /**
115
+     * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
116
+     *
117
+     * @return resource|bool
118
+     * @throws \OCP\Files\NotPermittedException
119
+     * @since 14.0.0
120
+     */
121
+    public function write();
122 122
 }
Please login to merge, or discard this patch.
lib/public/Files/Storage.php 1 patch
Indentation   +413 added lines, -413 removed lines patch added patch discarded remove patch
@@ -51,417 +51,417 @@
 block discarded – undo
51 51
  * @deprecated 9.0.0 use \OCP\Files\Storage\IStorage instead
52 52
  */
53 53
 interface Storage extends IStorage {
54
-	/**
55
-	 * $parameters is a free form array with the configuration options needed to construct the storage
56
-	 *
57
-	 * @param array $parameters
58
-	 * @since 6.0.0
59
-	 */
60
-	public function __construct($parameters);
61
-
62
-	/**
63
-	 * Get the identifier for the storage,
64
-	 * the returned id should be the same for every storage object that is created with the same parameters
65
-	 * and two storage objects with the same id should refer to two storages that display the same files.
66
-	 *
67
-	 * @return string
68
-	 * @since 6.0.0
69
-	 */
70
-	public function getId();
71
-
72
-	/**
73
-	 * see https://www.php.net/manual/en/function.mkdir.php
74
-	 * implementations need to implement a recursive mkdir
75
-	 *
76
-	 * @param string $path
77
-	 * @return bool
78
-	 * @since 6.0.0
79
-	 */
80
-	public function mkdir($path);
81
-
82
-	/**
83
-	 * see https://www.php.net/manual/en/function.rmdir.php
84
-	 *
85
-	 * @param string $path
86
-	 * @return bool
87
-	 * @since 6.0.0
88
-	 */
89
-	public function rmdir($path);
90
-
91
-	/**
92
-	 * see https://www.php.net/manual/en/function.opendir.php
93
-	 *
94
-	 * @param string $path
95
-	 * @return resource|bool
96
-	 * @since 6.0.0
97
-	 */
98
-	public function opendir($path);
99
-
100
-	/**
101
-	 * see https://www.php.net/manual/en/function.is-dir.php
102
-	 *
103
-	 * @param string $path
104
-	 * @return bool
105
-	 * @since 6.0.0
106
-	 */
107
-	public function is_dir($path);
108
-
109
-	/**
110
-	 * see https://www.php.net/manual/en/function.is-file.php
111
-	 *
112
-	 * @param string $path
113
-	 * @return bool
114
-	 * @since 6.0.0
115
-	 */
116
-	public function is_file($path);
117
-
118
-	/**
119
-	 * see https://www.php.net/manual/en/function.stat.php
120
-	 * only the following keys are required in the result: size and mtime
121
-	 *
122
-	 * @param string $path
123
-	 * @return array|bool
124
-	 * @since 6.0.0
125
-	 */
126
-	public function stat($path);
127
-
128
-	/**
129
-	 * see https://www.php.net/manual/en/function.filetype.php
130
-	 *
131
-	 * @param string $path
132
-	 * @return string|bool
133
-	 * @since 6.0.0
134
-	 */
135
-	public function filetype($path);
136
-
137
-	/**
138
-	 * see https://www.php.net/manual/en/function.filesize.php
139
-	 * The result for filesize when called on a folder is required to be 0
140
-	 *
141
-	 * @param string $path
142
-	 * @return int|bool
143
-	 * @since 6.0.0
144
-	 */
145
-	public function filesize($path);
146
-
147
-	/**
148
-	 * check if a file can be created in $path
149
-	 *
150
-	 * @param string $path
151
-	 * @return bool
152
-	 * @since 6.0.0
153
-	 */
154
-	public function isCreatable($path);
155
-
156
-	/**
157
-	 * check if a file can be read
158
-	 *
159
-	 * @param string $path
160
-	 * @return bool
161
-	 * @since 6.0.0
162
-	 */
163
-	public function isReadable($path);
164
-
165
-	/**
166
-	 * check if a file can be written to
167
-	 *
168
-	 * @param string $path
169
-	 * @return bool
170
-	 * @since 6.0.0
171
-	 */
172
-	public function isUpdatable($path);
173
-
174
-	/**
175
-	 * check if a file can be deleted
176
-	 *
177
-	 * @param string $path
178
-	 * @return bool
179
-	 * @since 6.0.0
180
-	 */
181
-	public function isDeletable($path);
182
-
183
-	/**
184
-	 * check if a file can be shared
185
-	 *
186
-	 * @param string $path
187
-	 * @return bool
188
-	 * @since 6.0.0
189
-	 */
190
-	public function isSharable($path);
191
-
192
-	/**
193
-	 * get the full permissions of a path.
194
-	 * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
195
-	 *
196
-	 * @param string $path
197
-	 * @return int
198
-	 * @since 6.0.0
199
-	 */
200
-	public function getPermissions($path);
201
-
202
-	/**
203
-	 * see https://www.php.net/manual/en/function.file_exists.php
204
-	 *
205
-	 * @param string $path
206
-	 * @return bool
207
-	 * @since 6.0.0
208
-	 */
209
-	public function file_exists($path);
210
-
211
-	/**
212
-	 * see https://www.php.net/manual/en/function.filemtime.php
213
-	 *
214
-	 * @param string $path
215
-	 * @return int|bool
216
-	 * @since 6.0.0
217
-	 */
218
-	public function filemtime($path);
219
-
220
-	/**
221
-	 * see https://www.php.net/manual/en/function.file_get_contents.php
222
-	 *
223
-	 * @param string $path
224
-	 * @return string|bool
225
-	 * @since 6.0.0
226
-	 */
227
-	public function file_get_contents($path);
228
-
229
-	/**
230
-	 * see https://www.php.net/manual/en/function.file_put_contents.php
231
-	 *
232
-	 * @param string $path
233
-	 * @param mixed $data
234
-	 * @return int|false
235
-	 * @since 6.0.0
236
-	 */
237
-	public function file_put_contents($path, $data);
238
-
239
-	/**
240
-	 * see https://www.php.net/manual/en/function.unlink.php
241
-	 *
242
-	 * @param string $path
243
-	 * @return bool
244
-	 * @since 6.0.0
245
-	 */
246
-	public function unlink($path);
247
-
248
-	/**
249
-	 * see https://www.php.net/manual/en/function.rename.php
250
-	 *
251
-	 * @param string $path1
252
-	 * @param string $path2
253
-	 * @return bool
254
-	 * @since 6.0.0
255
-	 */
256
-	public function rename($path1, $path2);
257
-
258
-	/**
259
-	 * see https://www.php.net/manual/en/function.copy.php
260
-	 *
261
-	 * @param string $path1
262
-	 * @param string $path2
263
-	 * @return bool
264
-	 * @since 6.0.0
265
-	 */
266
-	public function copy($path1, $path2);
267
-
268
-	/**
269
-	 * see https://www.php.net/manual/en/function.fopen.php
270
-	 *
271
-	 * @param string $path
272
-	 * @param string $mode
273
-	 * @return resource|bool
274
-	 * @since 6.0.0
275
-	 */
276
-	public function fopen($path, $mode);
277
-
278
-	/**
279
-	 * get the mimetype for a file or folder
280
-	 * The mimetype for a folder is required to be "httpd/unix-directory"
281
-	 *
282
-	 * @param string $path
283
-	 * @return string|bool
284
-	 * @since 6.0.0
285
-	 */
286
-	public function getMimeType($path);
287
-
288
-	/**
289
-	 * see https://www.php.net/manual/en/function.hash-file.php
290
-	 *
291
-	 * @param string $type
292
-	 * @param string $path
293
-	 * @param bool $raw
294
-	 * @return string|bool
295
-	 * @since 6.0.0
296
-	 */
297
-	public function hash($type, $path, $raw = false);
298
-
299
-	/**
300
-	 * see https://www.php.net/manual/en/function.free_space.php
301
-	 *
302
-	 * @param string $path
303
-	 * @return int|bool
304
-	 * @since 6.0.0
305
-	 */
306
-	public function free_space($path);
307
-
308
-	/**
309
-	 * search for occurrences of $query in file names
310
-	 *
311
-	 * @param string $query
312
-	 * @return array|bool
313
-	 * @since 6.0.0
314
-	 */
315
-	public function search($query);
316
-
317
-	/**
318
-	 * see https://www.php.net/manual/en/function.touch.php
319
-	 * If the backend does not support the operation, false should be returned
320
-	 *
321
-	 * @param string $path
322
-	 * @param int $mtime
323
-	 * @return bool
324
-	 * @since 6.0.0
325
-	 */
326
-	public function touch($path, $mtime = null);
327
-
328
-	/**
329
-	 * get the path to a local version of the file.
330
-	 * The local version of the file can be temporary and doesn't have to be persistent across requests
331
-	 *
332
-	 * @param string $path
333
-	 * @return string|bool
334
-	 * @since 6.0.0
335
-	 */
336
-	public function getLocalFile($path);
337
-
338
-	/**
339
-	 * check if a file or folder has been updated since $time
340
-	 *
341
-	 * @param string $path
342
-	 * @param int $time
343
-	 * @return bool
344
-	 * @since 6.0.0
345
-	 *
346
-	 * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
347
-	 * returning true for other changes in the folder is optional
348
-	 */
349
-	public function hasUpdated($path, $time);
350
-
351
-	/**
352
-	 * get the ETag for a file or folder
353
-	 *
354
-	 * @param string $path
355
-	 * @return string|bool
356
-	 * @since 6.0.0
357
-	 */
358
-	public function getETag($path);
359
-
360
-	/**
361
-	 * Returns whether the storage is local, which means that files
362
-	 * are stored on the local filesystem instead of remotely.
363
-	 * Calling getLocalFile() for local storages should always
364
-	 * return the local files, whereas for non-local storages
365
-	 * it might return a temporary file.
366
-	 *
367
-	 * @return bool true if the files are stored locally, false otherwise
368
-	 * @since 7.0.0
369
-	 */
370
-	public function isLocal();
371
-
372
-	/**
373
-	 * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
374
-	 *
375
-	 * @param string $class
376
-	 * @return bool
377
-	 * @since 7.0.0
378
-	 */
379
-	public function instanceOfStorage($class);
380
-
381
-	/**
382
-	 * A custom storage implementation can return an url for direct download of a give file.
383
-	 *
384
-	 * For now the returned array can hold the parameter url - in future more attributes might follow.
385
-	 *
386
-	 * @param string $path
387
-	 * @return array|bool
388
-	 * @since 8.0.0
389
-	 */
390
-	public function getDirectDownload($path);
391
-
392
-	/**
393
-	 * @param string $path the path of the target folder
394
-	 * @param string $fileName the name of the file itself
395
-	 * @return void
396
-	 * @throws InvalidPathException
397
-	 * @since 8.1.0
398
-	 */
399
-	public function verifyPath($path, $fileName);
400
-
401
-	/**
402
-	 * @param IStorage $sourceStorage
403
-	 * @param string $sourceInternalPath
404
-	 * @param string $targetInternalPath
405
-	 * @return bool
406
-	 * @since 8.1.0
407
-	 */
408
-	public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
409
-
410
-	/**
411
-	 * @param IStorage $sourceStorage
412
-	 * @param string $sourceInternalPath
413
-	 * @param string $targetInternalPath
414
-	 * @return bool
415
-	 * @since 8.1.0
416
-	 */
417
-	public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
418
-
419
-	/**
420
-	 * @param string $path The path of the file to acquire the lock for
421
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
422
-	 * @param \OCP\Lock\ILockingProvider $provider
423
-	 * @throws \OCP\Lock\LockedException
424
-	 * @since 8.1.0
425
-	 */
426
-	public function acquireLock($path, $type, ILockingProvider $provider);
427
-
428
-	/**
429
-	 * @param string $path The path of the file to acquire the lock for
430
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
431
-	 * @param \OCP\Lock\ILockingProvider $provider
432
-	 * @throws \OCP\Lock\LockedException
433
-	 * @since 8.1.0
434
-	 */
435
-	public function releaseLock($path, $type, ILockingProvider $provider);
436
-
437
-	/**
438
-	 * @param string $path The path of the file to change the lock for
439
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
440
-	 * @param \OCP\Lock\ILockingProvider $provider
441
-	 * @throws \OCP\Lock\LockedException
442
-	 * @since 8.1.0
443
-	 */
444
-	public function changeLock($path, $type, ILockingProvider $provider);
445
-
446
-	/**
447
-	 * Test a storage for availability
448
-	 *
449
-	 * @since 8.2.0
450
-	 * @return bool
451
-	 */
452
-	public function test();
453
-
454
-	/**
455
-	 * @since 8.2.0
456
-	 * @return array [ available, last_checked ]
457
-	 */
458
-	public function getAvailability();
459
-
460
-	/**
461
-	 * @since 8.2.0
462
-	 * @param bool $isAvailable
463
-	 */
464
-	public function setAvailability($isAvailable);
465
-
466
-	public function needsPartFile();
54
+    /**
55
+     * $parameters is a free form array with the configuration options needed to construct the storage
56
+     *
57
+     * @param array $parameters
58
+     * @since 6.0.0
59
+     */
60
+    public function __construct($parameters);
61
+
62
+    /**
63
+     * Get the identifier for the storage,
64
+     * the returned id should be the same for every storage object that is created with the same parameters
65
+     * and two storage objects with the same id should refer to two storages that display the same files.
66
+     *
67
+     * @return string
68
+     * @since 6.0.0
69
+     */
70
+    public function getId();
71
+
72
+    /**
73
+     * see https://www.php.net/manual/en/function.mkdir.php
74
+     * implementations need to implement a recursive mkdir
75
+     *
76
+     * @param string $path
77
+     * @return bool
78
+     * @since 6.0.0
79
+     */
80
+    public function mkdir($path);
81
+
82
+    /**
83
+     * see https://www.php.net/manual/en/function.rmdir.php
84
+     *
85
+     * @param string $path
86
+     * @return bool
87
+     * @since 6.0.0
88
+     */
89
+    public function rmdir($path);
90
+
91
+    /**
92
+     * see https://www.php.net/manual/en/function.opendir.php
93
+     *
94
+     * @param string $path
95
+     * @return resource|bool
96
+     * @since 6.0.0
97
+     */
98
+    public function opendir($path);
99
+
100
+    /**
101
+     * see https://www.php.net/manual/en/function.is-dir.php
102
+     *
103
+     * @param string $path
104
+     * @return bool
105
+     * @since 6.0.0
106
+     */
107
+    public function is_dir($path);
108
+
109
+    /**
110
+     * see https://www.php.net/manual/en/function.is-file.php
111
+     *
112
+     * @param string $path
113
+     * @return bool
114
+     * @since 6.0.0
115
+     */
116
+    public function is_file($path);
117
+
118
+    /**
119
+     * see https://www.php.net/manual/en/function.stat.php
120
+     * only the following keys are required in the result: size and mtime
121
+     *
122
+     * @param string $path
123
+     * @return array|bool
124
+     * @since 6.0.0
125
+     */
126
+    public function stat($path);
127
+
128
+    /**
129
+     * see https://www.php.net/manual/en/function.filetype.php
130
+     *
131
+     * @param string $path
132
+     * @return string|bool
133
+     * @since 6.0.0
134
+     */
135
+    public function filetype($path);
136
+
137
+    /**
138
+     * see https://www.php.net/manual/en/function.filesize.php
139
+     * The result for filesize when called on a folder is required to be 0
140
+     *
141
+     * @param string $path
142
+     * @return int|bool
143
+     * @since 6.0.0
144
+     */
145
+    public function filesize($path);
146
+
147
+    /**
148
+     * check if a file can be created in $path
149
+     *
150
+     * @param string $path
151
+     * @return bool
152
+     * @since 6.0.0
153
+     */
154
+    public function isCreatable($path);
155
+
156
+    /**
157
+     * check if a file can be read
158
+     *
159
+     * @param string $path
160
+     * @return bool
161
+     * @since 6.0.0
162
+     */
163
+    public function isReadable($path);
164
+
165
+    /**
166
+     * check if a file can be written to
167
+     *
168
+     * @param string $path
169
+     * @return bool
170
+     * @since 6.0.0
171
+     */
172
+    public function isUpdatable($path);
173
+
174
+    /**
175
+     * check if a file can be deleted
176
+     *
177
+     * @param string $path
178
+     * @return bool
179
+     * @since 6.0.0
180
+     */
181
+    public function isDeletable($path);
182
+
183
+    /**
184
+     * check if a file can be shared
185
+     *
186
+     * @param string $path
187
+     * @return bool
188
+     * @since 6.0.0
189
+     */
190
+    public function isSharable($path);
191
+
192
+    /**
193
+     * get the full permissions of a path.
194
+     * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
195
+     *
196
+     * @param string $path
197
+     * @return int
198
+     * @since 6.0.0
199
+     */
200
+    public function getPermissions($path);
201
+
202
+    /**
203
+     * see https://www.php.net/manual/en/function.file_exists.php
204
+     *
205
+     * @param string $path
206
+     * @return bool
207
+     * @since 6.0.0
208
+     */
209
+    public function file_exists($path);
210
+
211
+    /**
212
+     * see https://www.php.net/manual/en/function.filemtime.php
213
+     *
214
+     * @param string $path
215
+     * @return int|bool
216
+     * @since 6.0.0
217
+     */
218
+    public function filemtime($path);
219
+
220
+    /**
221
+     * see https://www.php.net/manual/en/function.file_get_contents.php
222
+     *
223
+     * @param string $path
224
+     * @return string|bool
225
+     * @since 6.0.0
226
+     */
227
+    public function file_get_contents($path);
228
+
229
+    /**
230
+     * see https://www.php.net/manual/en/function.file_put_contents.php
231
+     *
232
+     * @param string $path
233
+     * @param mixed $data
234
+     * @return int|false
235
+     * @since 6.0.0
236
+     */
237
+    public function file_put_contents($path, $data);
238
+
239
+    /**
240
+     * see https://www.php.net/manual/en/function.unlink.php
241
+     *
242
+     * @param string $path
243
+     * @return bool
244
+     * @since 6.0.0
245
+     */
246
+    public function unlink($path);
247
+
248
+    /**
249
+     * see https://www.php.net/manual/en/function.rename.php
250
+     *
251
+     * @param string $path1
252
+     * @param string $path2
253
+     * @return bool
254
+     * @since 6.0.0
255
+     */
256
+    public function rename($path1, $path2);
257
+
258
+    /**
259
+     * see https://www.php.net/manual/en/function.copy.php
260
+     *
261
+     * @param string $path1
262
+     * @param string $path2
263
+     * @return bool
264
+     * @since 6.0.0
265
+     */
266
+    public function copy($path1, $path2);
267
+
268
+    /**
269
+     * see https://www.php.net/manual/en/function.fopen.php
270
+     *
271
+     * @param string $path
272
+     * @param string $mode
273
+     * @return resource|bool
274
+     * @since 6.0.0
275
+     */
276
+    public function fopen($path, $mode);
277
+
278
+    /**
279
+     * get the mimetype for a file or folder
280
+     * The mimetype for a folder is required to be "httpd/unix-directory"
281
+     *
282
+     * @param string $path
283
+     * @return string|bool
284
+     * @since 6.0.0
285
+     */
286
+    public function getMimeType($path);
287
+
288
+    /**
289
+     * see https://www.php.net/manual/en/function.hash-file.php
290
+     *
291
+     * @param string $type
292
+     * @param string $path
293
+     * @param bool $raw
294
+     * @return string|bool
295
+     * @since 6.0.0
296
+     */
297
+    public function hash($type, $path, $raw = false);
298
+
299
+    /**
300
+     * see https://www.php.net/manual/en/function.free_space.php
301
+     *
302
+     * @param string $path
303
+     * @return int|bool
304
+     * @since 6.0.0
305
+     */
306
+    public function free_space($path);
307
+
308
+    /**
309
+     * search for occurrences of $query in file names
310
+     *
311
+     * @param string $query
312
+     * @return array|bool
313
+     * @since 6.0.0
314
+     */
315
+    public function search($query);
316
+
317
+    /**
318
+     * see https://www.php.net/manual/en/function.touch.php
319
+     * If the backend does not support the operation, false should be returned
320
+     *
321
+     * @param string $path
322
+     * @param int $mtime
323
+     * @return bool
324
+     * @since 6.0.0
325
+     */
326
+    public function touch($path, $mtime = null);
327
+
328
+    /**
329
+     * get the path to a local version of the file.
330
+     * The local version of the file can be temporary and doesn't have to be persistent across requests
331
+     *
332
+     * @param string $path
333
+     * @return string|bool
334
+     * @since 6.0.0
335
+     */
336
+    public function getLocalFile($path);
337
+
338
+    /**
339
+     * check if a file or folder has been updated since $time
340
+     *
341
+     * @param string $path
342
+     * @param int $time
343
+     * @return bool
344
+     * @since 6.0.0
345
+     *
346
+     * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
347
+     * returning true for other changes in the folder is optional
348
+     */
349
+    public function hasUpdated($path, $time);
350
+
351
+    /**
352
+     * get the ETag for a file or folder
353
+     *
354
+     * @param string $path
355
+     * @return string|bool
356
+     * @since 6.0.0
357
+     */
358
+    public function getETag($path);
359
+
360
+    /**
361
+     * Returns whether the storage is local, which means that files
362
+     * are stored on the local filesystem instead of remotely.
363
+     * Calling getLocalFile() for local storages should always
364
+     * return the local files, whereas for non-local storages
365
+     * it might return a temporary file.
366
+     *
367
+     * @return bool true if the files are stored locally, false otherwise
368
+     * @since 7.0.0
369
+     */
370
+    public function isLocal();
371
+
372
+    /**
373
+     * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
374
+     *
375
+     * @param string $class
376
+     * @return bool
377
+     * @since 7.0.0
378
+     */
379
+    public function instanceOfStorage($class);
380
+
381
+    /**
382
+     * A custom storage implementation can return an url for direct download of a give file.
383
+     *
384
+     * For now the returned array can hold the parameter url - in future more attributes might follow.
385
+     *
386
+     * @param string $path
387
+     * @return array|bool
388
+     * @since 8.0.0
389
+     */
390
+    public function getDirectDownload($path);
391
+
392
+    /**
393
+     * @param string $path the path of the target folder
394
+     * @param string $fileName the name of the file itself
395
+     * @return void
396
+     * @throws InvalidPathException
397
+     * @since 8.1.0
398
+     */
399
+    public function verifyPath($path, $fileName);
400
+
401
+    /**
402
+     * @param IStorage $sourceStorage
403
+     * @param string $sourceInternalPath
404
+     * @param string $targetInternalPath
405
+     * @return bool
406
+     * @since 8.1.0
407
+     */
408
+    public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
409
+
410
+    /**
411
+     * @param IStorage $sourceStorage
412
+     * @param string $sourceInternalPath
413
+     * @param string $targetInternalPath
414
+     * @return bool
415
+     * @since 8.1.0
416
+     */
417
+    public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath);
418
+
419
+    /**
420
+     * @param string $path The path of the file to acquire the lock for
421
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
422
+     * @param \OCP\Lock\ILockingProvider $provider
423
+     * @throws \OCP\Lock\LockedException
424
+     * @since 8.1.0
425
+     */
426
+    public function acquireLock($path, $type, ILockingProvider $provider);
427
+
428
+    /**
429
+     * @param string $path The path of the file to acquire the lock for
430
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
431
+     * @param \OCP\Lock\ILockingProvider $provider
432
+     * @throws \OCP\Lock\LockedException
433
+     * @since 8.1.0
434
+     */
435
+    public function releaseLock($path, $type, ILockingProvider $provider);
436
+
437
+    /**
438
+     * @param string $path The path of the file to change the lock for
439
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
440
+     * @param \OCP\Lock\ILockingProvider $provider
441
+     * @throws \OCP\Lock\LockedException
442
+     * @since 8.1.0
443
+     */
444
+    public function changeLock($path, $type, ILockingProvider $provider);
445
+
446
+    /**
447
+     * Test a storage for availability
448
+     *
449
+     * @since 8.2.0
450
+     * @return bool
451
+     */
452
+    public function test();
453
+
454
+    /**
455
+     * @since 8.2.0
456
+     * @return array [ available, last_checked ]
457
+     */
458
+    public function getAvailability();
459
+
460
+    /**
461
+     * @since 8.2.0
462
+     * @param bool $isAvailable
463
+     */
464
+    public function setAvailability($isAvailable);
465
+
466
+    public function needsPartFile();
467 467
 }
Please login to merge, or discard this patch.