Completed
Pull Request — master (#6805)
by Björn
16:52
created
lib/private/Files/Mount/ObjectHomeMountProvider.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 			return null;
65 65
 		}
66 66
 
67
-		return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader);
67
+		return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/'.$user->getUID(), $config['arguments'], $loader);
68 68
 	}
69 69
 
70 70
 	/**
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @param IUser $user
53 53
 	 * @param IStorageFactory $loader
54
-	 * @return \OCP\Files\Mount\IMountPoint
54
+	 * @return null|MountPoint
55 55
 	 */
56 56
 	public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
57 57
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 	/**
71 71
 	 * @param IUser $user
72
-	 * @return array|null
72
+	 * @return IStorageFactory|null
73 73
 	 */
74 74
 	private function getSingleBucketObjectStoreConfig(IUser $user) {
75 75
 		$config = $this->config->getSystemValue('objectstore');
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 	/**
95 95
 	 * @param IUser $user
96
-	 * @return array|null
96
+	 * @return IStorageFactory|null
97 97
 	 */
98 98
 	private function getMultiBucketObjectStoreConfig(IUser $user) {
99 99
 		$config = $this->config->getSystemValue('objectstore_multibucket');
Please login to merge, or discard this patch.
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -32,107 +32,107 @@
 block discarded – undo
32 32
  * Mount provider for object store home storages
33 33
  */
34 34
 class ObjectHomeMountProvider implements IHomeMountProvider {
35
-	/**
36
-	 * @var IConfig
37
-	 */
38
-	private $config;
39
-
40
-	/**
41
-	 * ObjectStoreHomeMountProvider constructor.
42
-	 *
43
-	 * @param IConfig $config
44
-	 */
45
-	public function __construct(IConfig $config) {
46
-		$this->config = $config;
47
-	}
48
-
49
-	/**
50
-	 * Get the cache mount for a user
51
-	 *
52
-	 * @param IUser $user
53
-	 * @param IStorageFactory $loader
54
-	 * @return \OCP\Files\Mount\IMountPoint
55
-	 */
56
-	public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
57
-
58
-		$config = $this->getMultiBucketObjectStoreConfig($user);
59
-		if ($config === null) {
60
-			$config = $this->getSingleBucketObjectStoreConfig($user);
61
-		}
62
-
63
-		if ($config === null) {
64
-			return null;
65
-		}
66
-
67
-		return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader);
68
-	}
69
-
70
-	/**
71
-	 * @param IUser $user
72
-	 * @return array|null
73
-	 */
74
-	private function getSingleBucketObjectStoreConfig(IUser $user) {
75
-		$config = $this->config->getSystemValue('objectstore');
76
-		if (!is_array($config)) {
77
-			return null;
78
-		}
79
-
80
-		// sanity checks
81
-		if (empty($config['class'])) {
82
-			\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
83
-		}
84
-		if (!isset($config['arguments'])) {
85
-			$config['arguments'] = [];
86
-		}
87
-		// instantiate object store implementation
88
-		$config['arguments']['objectstore'] = new $config['class']($config['arguments']);
89
-
90
-		$config['arguments']['user'] = $user;
91
-
92
-		return $config;
93
-	}
94
-
95
-	/**
96
-	 * @param IUser $user
97
-	 * @return array|null
98
-	 */
99
-	private function getMultiBucketObjectStoreConfig(IUser $user) {
100
-		$config = $this->config->getSystemValue('objectstore_multibucket');
101
-		if (!is_array($config)) {
102
-			return null;
103
-		}
104
-
105
-		// sanity checks
106
-		if (empty($config['class'])) {
107
-			\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
108
-		}
109
-		if (!isset($config['arguments'])) {
110
-			$config['arguments'] = [];
111
-		}
112
-		$config['arguments']['user'] = $user;
113
-
114
-		$bucket = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'bucket', null);
115
-
116
-		if ($bucket === null) {
117
-			/*
35
+    /**
36
+     * @var IConfig
37
+     */
38
+    private $config;
39
+
40
+    /**
41
+     * ObjectStoreHomeMountProvider constructor.
42
+     *
43
+     * @param IConfig $config
44
+     */
45
+    public function __construct(IConfig $config) {
46
+        $this->config = $config;
47
+    }
48
+
49
+    /**
50
+     * Get the cache mount for a user
51
+     *
52
+     * @param IUser $user
53
+     * @param IStorageFactory $loader
54
+     * @return \OCP\Files\Mount\IMountPoint
55
+     */
56
+    public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
57
+
58
+        $config = $this->getMultiBucketObjectStoreConfig($user);
59
+        if ($config === null) {
60
+            $config = $this->getSingleBucketObjectStoreConfig($user);
61
+        }
62
+
63
+        if ($config === null) {
64
+            return null;
65
+        }
66
+
67
+        return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader);
68
+    }
69
+
70
+    /**
71
+     * @param IUser $user
72
+     * @return array|null
73
+     */
74
+    private function getSingleBucketObjectStoreConfig(IUser $user) {
75
+        $config = $this->config->getSystemValue('objectstore');
76
+        if (!is_array($config)) {
77
+            return null;
78
+        }
79
+
80
+        // sanity checks
81
+        if (empty($config['class'])) {
82
+            \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
83
+        }
84
+        if (!isset($config['arguments'])) {
85
+            $config['arguments'] = [];
86
+        }
87
+        // instantiate object store implementation
88
+        $config['arguments']['objectstore'] = new $config['class']($config['arguments']);
89
+
90
+        $config['arguments']['user'] = $user;
91
+
92
+        return $config;
93
+    }
94
+
95
+    /**
96
+     * @param IUser $user
97
+     * @return array|null
98
+     */
99
+    private function getMultiBucketObjectStoreConfig(IUser $user) {
100
+        $config = $this->config->getSystemValue('objectstore_multibucket');
101
+        if (!is_array($config)) {
102
+            return null;
103
+        }
104
+
105
+        // sanity checks
106
+        if (empty($config['class'])) {
107
+            \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
108
+        }
109
+        if (!isset($config['arguments'])) {
110
+            $config['arguments'] = [];
111
+        }
112
+        $config['arguments']['user'] = $user;
113
+
114
+        $bucket = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'bucket', null);
115
+
116
+        if ($bucket === null) {
117
+            /*
118 118
 			 * Use any provided bucket argument as prefix
119 119
 			 * and add the mapping from username => bucket
120 120
 			 */
121
-			if (!isset($config['arguments']['bucket'])) {
122
-				$config['arguments']['bucket'] = '';
123
-			}
124
-			$mapper = new \OC\Files\ObjectStore\Mapper($user);
125
-			$numBuckets = isset($config['arguments']['num_buckets']) ? $config['arguments']['num_buckets'] : 64;
126
-			$config['arguments']['bucket'] .= $mapper->getBucket($numBuckets);
127
-
128
-			$this->config->setUserValue($user->getUID(), 'homeobjectstore', 'bucket', $config['arguments']['bucket']);
129
-		} else {
130
-			$config['arguments']['bucket'] = $bucket;
131
-		}
132
-
133
-		// instantiate object store implementation
134
-		$config['arguments']['objectstore'] = new $config['class']($config['arguments']);
135
-
136
-		return $config;
137
-	}
121
+            if (!isset($config['arguments']['bucket'])) {
122
+                $config['arguments']['bucket'] = '';
123
+            }
124
+            $mapper = new \OC\Files\ObjectStore\Mapper($user);
125
+            $numBuckets = isset($config['arguments']['num_buckets']) ? $config['arguments']['num_buckets'] : 64;
126
+            $config['arguments']['bucket'] .= $mapper->getBucket($numBuckets);
127
+
128
+            $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'bucket', $config['arguments']['bucket']);
129
+        } else {
130
+            $config['arguments']['bucket'] = $bucket;
131
+        }
132
+
133
+        // instantiate object store implementation
134
+        $config['arguments']['objectstore'] = new $config['class']($config['arguments']);
135
+
136
+        return $config;
137
+    }
138 138
 }
Please login to merge, or discard this patch.
lib/private/Files/Mount/MountPoint.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		} else {
106 106
 			// Update old classes to new namespace
107 107
 			if (strpos($storage, 'OC_Filestorage_') !== false) {
108
-				$storage = '\OC\Files\Storage\\' . substr($storage, 15);
108
+				$storage = '\OC\Files\Storage\\'.substr($storage, 15);
109 109
 			}
110 110
 			$this->class = $storage;
111 111
 			$this->arguments = $arguments;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 				return;
158 158
 			}
159 159
 		} else {
160
-			\OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR);
160
+			\OCP\Util::writeLog('core', 'storage backend '.$this->class.' not found', \OCP\Util::ERROR);
161 161
 			$this->invalidStorage = true;
162 162
 			return;
163 163
 		}
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public function getInternalPath($path) {
209 209
 		$path = Filesystem::normalizePath($path, true, false, true);
210
-		if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) {
210
+		if ($this->mountPoint === $path or $this->mountPoint.'/' === $path) {
211 211
 			$internalPath = '';
212 212
 		} else {
213 213
 			$internalPath = substr($path, strlen($this->mountPoint));
214 214
 		}
215 215
 		// substr returns false instead of an empty string, we always want a string
216
-		return (string)$internalPath;
216
+		return (string) $internalPath;
217 217
 	}
218 218
 
219 219
 	/**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	public function getStorageRootId() {
268 268
 		if (is_null($this->rootId)) {
269
-			$this->rootId = (int)$this->getStorage()->getCache()->getId('');
269
+			$this->rootId = (int) $this->getStorage()->getCache()->getId('');
270 270
 		}
271 271
 		return $this->rootId;
272 272
 	}
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -35,247 +35,247 @@
 block discarded – undo
35 35
 use OCP\Files\Mount\IMountPoint;
36 36
 
37 37
 class MountPoint implements IMountPoint {
38
-	/**
39
-	 * @var \OC\Files\Storage\Storage $storage
40
-	 */
41
-	protected $storage = null;
42
-	protected $class;
43
-	protected $storageId;
44
-	protected $rootId = null;
38
+    /**
39
+     * @var \OC\Files\Storage\Storage $storage
40
+     */
41
+    protected $storage = null;
42
+    protected $class;
43
+    protected $storageId;
44
+    protected $rootId = null;
45 45
 
46
-	/**
47
-	 * Configuration options for the storage backend
48
-	 *
49
-	 * @var array
50
-	 */
51
-	protected $arguments = array();
52
-	protected $mountPoint;
46
+    /**
47
+     * Configuration options for the storage backend
48
+     *
49
+     * @var array
50
+     */
51
+    protected $arguments = array();
52
+    protected $mountPoint;
53 53
 
54
-	/**
55
-	 * Mount specific options
56
-	 *
57
-	 * @var array
58
-	 */
59
-	protected $mountOptions = array();
54
+    /**
55
+     * Mount specific options
56
+     *
57
+     * @var array
58
+     */
59
+    protected $mountOptions = array();
60 60
 
61
-	/**
62
-	 * @var \OC\Files\Storage\StorageFactory $loader
63
-	 */
64
-	private $loader;
61
+    /**
62
+     * @var \OC\Files\Storage\StorageFactory $loader
63
+     */
64
+    private $loader;
65 65
 
66
-	/**
67
-	 * Specified whether the storage is invalid after failing to
68
-	 * instantiate it.
69
-	 *
70
-	 * @var bool
71
-	 */
72
-	private $invalidStorage = false;
66
+    /**
67
+     * Specified whether the storage is invalid after failing to
68
+     * instantiate it.
69
+     *
70
+     * @var bool
71
+     */
72
+    private $invalidStorage = false;
73 73
 
74
-	/** @var int|null */
75
-	protected $mountId;
74
+    /** @var int|null */
75
+    protected $mountId;
76 76
 
77
-	/**
78
-	 * @param string|\OC\Files\Storage\Storage $storage
79
-	 * @param string $mountpoint
80
-	 * @param array $arguments (optional) configuration for the storage backend
81
-	 * @param \OCP\Files\Storage\IStorageFactory $loader
82
-	 * @param array $mountOptions mount specific options
83
-	 * @param int|null $mountId
84
-	 * @throws \Exception
85
-	 */
86
-	public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null) {
87
-		if (is_null($arguments)) {
88
-			$arguments = array();
89
-		}
90
-		if (is_null($loader)) {
91
-			$this->loader = new StorageFactory();
92
-		} else {
93
-			$this->loader = $loader;
94
-		}
77
+    /**
78
+     * @param string|\OC\Files\Storage\Storage $storage
79
+     * @param string $mountpoint
80
+     * @param array $arguments (optional) configuration for the storage backend
81
+     * @param \OCP\Files\Storage\IStorageFactory $loader
82
+     * @param array $mountOptions mount specific options
83
+     * @param int|null $mountId
84
+     * @throws \Exception
85
+     */
86
+    public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null) {
87
+        if (is_null($arguments)) {
88
+            $arguments = array();
89
+        }
90
+        if (is_null($loader)) {
91
+            $this->loader = new StorageFactory();
92
+        } else {
93
+            $this->loader = $loader;
94
+        }
95 95
 
96
-		if (!is_null($mountOptions)) {
97
-			$this->mountOptions = $mountOptions;
98
-		}
96
+        if (!is_null($mountOptions)) {
97
+            $this->mountOptions = $mountOptions;
98
+        }
99 99
 
100
-		$mountpoint = $this->formatPath($mountpoint);
101
-		$this->mountPoint = $mountpoint;
102
-		if ($storage instanceof Storage) {
103
-			$this->class = get_class($storage);
104
-			$this->storage = $this->loader->wrap($this, $storage);
105
-		} else {
106
-			// Update old classes to new namespace
107
-			if (strpos($storage, 'OC_Filestorage_') !== false) {
108
-				$storage = '\OC\Files\Storage\\' . substr($storage, 15);
109
-			}
110
-			$this->class = $storage;
111
-			$this->arguments = $arguments;
112
-		}
113
-		$this->mountId = $mountId;
114
-	}
100
+        $mountpoint = $this->formatPath($mountpoint);
101
+        $this->mountPoint = $mountpoint;
102
+        if ($storage instanceof Storage) {
103
+            $this->class = get_class($storage);
104
+            $this->storage = $this->loader->wrap($this, $storage);
105
+        } else {
106
+            // Update old classes to new namespace
107
+            if (strpos($storage, 'OC_Filestorage_') !== false) {
108
+                $storage = '\OC\Files\Storage\\' . substr($storage, 15);
109
+            }
110
+            $this->class = $storage;
111
+            $this->arguments = $arguments;
112
+        }
113
+        $this->mountId = $mountId;
114
+    }
115 115
 
116
-	/**
117
-	 * get complete path to the mount point, relative to data/
118
-	 *
119
-	 * @return string
120
-	 */
121
-	public function getMountPoint() {
122
-		return $this->mountPoint;
123
-	}
116
+    /**
117
+     * get complete path to the mount point, relative to data/
118
+     *
119
+     * @return string
120
+     */
121
+    public function getMountPoint() {
122
+        return $this->mountPoint;
123
+    }
124 124
 
125
-	/**
126
-	 * Sets the mount point path, relative to data/
127
-	 *
128
-	 * @param string $mountPoint new mount point
129
-	 */
130
-	public function setMountPoint($mountPoint) {
131
-		$this->mountPoint = $this->formatPath($mountPoint);
132
-	}
125
+    /**
126
+     * Sets the mount point path, relative to data/
127
+     *
128
+     * @param string $mountPoint new mount point
129
+     */
130
+    public function setMountPoint($mountPoint) {
131
+        $this->mountPoint = $this->formatPath($mountPoint);
132
+    }
133 133
 
134
-	/**
135
-	 * create the storage that is mounted
136
-	 */
137
-	private function createStorage() {
138
-		if ($this->invalidStorage) {
139
-			return;
140
-		}
134
+    /**
135
+     * create the storage that is mounted
136
+     */
137
+    private function createStorage() {
138
+        if ($this->invalidStorage) {
139
+            return;
140
+        }
141 141
 
142
-		if (class_exists($this->class)) {
143
-			try {
144
-				$class = $this->class;
145
-				// prevent recursion by setting the storage before applying wrappers
146
-				$this->storage = new $class($this->arguments);
147
-				$this->storage = $this->loader->wrap($this, $this->storage);
148
-			} catch (\Exception $exception) {
149
-				$this->storage = null;
150
-				$this->invalidStorage = true;
151
-				if ($this->mountPoint === '/') {
152
-					// the root storage could not be initialized, show the user!
153
-					throw new \Exception('The root storage could not be initialized. Please contact your local administrator.', $exception->getCode(), $exception);
154
-				} else {
155
-					\OC::$server->getLogger()->logException($exception, ['level' => \OCP\Util::ERROR]);
156
-				}
157
-				return;
158
-			}
159
-		} else {
160
-			\OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR);
161
-			$this->invalidStorage = true;
162
-			return;
163
-		}
164
-	}
142
+        if (class_exists($this->class)) {
143
+            try {
144
+                $class = $this->class;
145
+                // prevent recursion by setting the storage before applying wrappers
146
+                $this->storage = new $class($this->arguments);
147
+                $this->storage = $this->loader->wrap($this, $this->storage);
148
+            } catch (\Exception $exception) {
149
+                $this->storage = null;
150
+                $this->invalidStorage = true;
151
+                if ($this->mountPoint === '/') {
152
+                    // the root storage could not be initialized, show the user!
153
+                    throw new \Exception('The root storage could not be initialized. Please contact your local administrator.', $exception->getCode(), $exception);
154
+                } else {
155
+                    \OC::$server->getLogger()->logException($exception, ['level' => \OCP\Util::ERROR]);
156
+                }
157
+                return;
158
+            }
159
+        } else {
160
+            \OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR);
161
+            $this->invalidStorage = true;
162
+            return;
163
+        }
164
+    }
165 165
 
166
-	/**
167
-	 * @return \OC\Files\Storage\Storage
168
-	 */
169
-	public function getStorage() {
170
-		if (is_null($this->storage)) {
171
-			$this->createStorage();
172
-		}
173
-		return $this->storage;
174
-	}
166
+    /**
167
+     * @return \OC\Files\Storage\Storage
168
+     */
169
+    public function getStorage() {
170
+        if (is_null($this->storage)) {
171
+            $this->createStorage();
172
+        }
173
+        return $this->storage;
174
+    }
175 175
 
176
-	/**
177
-	 * @return string
178
-	 */
179
-	public function getStorageId() {
180
-		if (!$this->storageId) {
181
-			if (is_null($this->storage)) {
182
-				$storage = $this->createStorage(); //FIXME: start using exceptions
183
-				if (is_null($storage)) {
184
-					return null;
185
-				}
176
+    /**
177
+     * @return string
178
+     */
179
+    public function getStorageId() {
180
+        if (!$this->storageId) {
181
+            if (is_null($this->storage)) {
182
+                $storage = $this->createStorage(); //FIXME: start using exceptions
183
+                if (is_null($storage)) {
184
+                    return null;
185
+                }
186 186
 
187
-				$this->storage = $storage;
188
-			}
189
-			$this->storageId = $this->storage->getId();
190
-			if (strlen($this->storageId) > 64) {
191
-				$this->storageId = md5($this->storageId);
192
-			}
193
-		}
194
-		return $this->storageId;
195
-	}
187
+                $this->storage = $storage;
188
+            }
189
+            $this->storageId = $this->storage->getId();
190
+            if (strlen($this->storageId) > 64) {
191
+                $this->storageId = md5($this->storageId);
192
+            }
193
+        }
194
+        return $this->storageId;
195
+    }
196 196
 
197
-	/**
198
-	 * @return int
199
-	 */
200
-	public function getNumericStorageId() {
201
-		return $this->getStorage()->getStorageCache()->getNumericId();
202
-	}
197
+    /**
198
+     * @return int
199
+     */
200
+    public function getNumericStorageId() {
201
+        return $this->getStorage()->getStorageCache()->getNumericId();
202
+    }
203 203
 
204
-	/**
205
-	 * @param string $path
206
-	 * @return string
207
-	 */
208
-	public function getInternalPath($path) {
209
-		$path = Filesystem::normalizePath($path, true, false, true);
210
-		if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) {
211
-			$internalPath = '';
212
-		} else {
213
-			$internalPath = substr($path, strlen($this->mountPoint));
214
-		}
215
-		// substr returns false instead of an empty string, we always want a string
216
-		return (string)$internalPath;
217
-	}
204
+    /**
205
+     * @param string $path
206
+     * @return string
207
+     */
208
+    public function getInternalPath($path) {
209
+        $path = Filesystem::normalizePath($path, true, false, true);
210
+        if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) {
211
+            $internalPath = '';
212
+        } else {
213
+            $internalPath = substr($path, strlen($this->mountPoint));
214
+        }
215
+        // substr returns false instead of an empty string, we always want a string
216
+        return (string)$internalPath;
217
+    }
218 218
 
219
-	/**
220
-	 * @param string $path
221
-	 * @return string
222
-	 */
223
-	private function formatPath($path) {
224
-		$path = Filesystem::normalizePath($path);
225
-		if (strlen($path) > 1) {
226
-			$path .= '/';
227
-		}
228
-		return $path;
229
-	}
219
+    /**
220
+     * @param string $path
221
+     * @return string
222
+     */
223
+    private function formatPath($path) {
224
+        $path = Filesystem::normalizePath($path);
225
+        if (strlen($path) > 1) {
226
+            $path .= '/';
227
+        }
228
+        return $path;
229
+    }
230 230
 
231
-	/**
232
-	 * @param callable $wrapper
233
-	 */
234
-	public function wrapStorage($wrapper) {
235
-		$storage = $this->getStorage();
236
-		// storage can be null if it couldn't be initialized
237
-		if ($storage != null) {
238
-			$this->storage = $wrapper($this->mountPoint, $storage, $this);
239
-		}
240
-	}
231
+    /**
232
+     * @param callable $wrapper
233
+     */
234
+    public function wrapStorage($wrapper) {
235
+        $storage = $this->getStorage();
236
+        // storage can be null if it couldn't be initialized
237
+        if ($storage != null) {
238
+            $this->storage = $wrapper($this->mountPoint, $storage, $this);
239
+        }
240
+    }
241 241
 
242
-	/**
243
-	 * Get a mount option
244
-	 *
245
-	 * @param string $name Name of the mount option to get
246
-	 * @param mixed $default Default value for the mount option
247
-	 * @return mixed
248
-	 */
249
-	public function getOption($name, $default) {
250
-		return isset($this->mountOptions[$name]) ? $this->mountOptions[$name] : $default;
251
-	}
242
+    /**
243
+     * Get a mount option
244
+     *
245
+     * @param string $name Name of the mount option to get
246
+     * @param mixed $default Default value for the mount option
247
+     * @return mixed
248
+     */
249
+    public function getOption($name, $default) {
250
+        return isset($this->mountOptions[$name]) ? $this->mountOptions[$name] : $default;
251
+    }
252 252
 
253
-	/**
254
-	 * Get all options for the mount
255
-	 *
256
-	 * @return array
257
-	 */
258
-	public function getOptions() {
259
-		return $this->mountOptions;
260
-	}
253
+    /**
254
+     * Get all options for the mount
255
+     *
256
+     * @return array
257
+     */
258
+    public function getOptions() {
259
+        return $this->mountOptions;
260
+    }
261 261
 
262
-	/**
263
-	 * Get the file id of the root of the storage
264
-	 *
265
-	 * @return int
266
-	 */
267
-	public function getStorageRootId() {
268
-		if (is_null($this->rootId)) {
269
-			$this->rootId = (int)$this->getStorage()->getCache()->getId('');
270
-		}
271
-		return $this->rootId;
272
-	}
262
+    /**
263
+     * Get the file id of the root of the storage
264
+     *
265
+     * @return int
266
+     */
267
+    public function getStorageRootId() {
268
+        if (is_null($this->rootId)) {
269
+            $this->rootId = (int)$this->getStorage()->getCache()->getId('');
270
+        }
271
+        return $this->rootId;
272
+    }
273 273
 
274
-	public function getMountId() {
275
-		return $this->mountId;
276
-	}
274
+    public function getMountId() {
275
+        return $this->mountId;
276
+    }
277 277
 
278
-	public function getMountType() {
279
-		return '';
280
-	}
278
+    public function getMountType() {
279
+        return '';
280
+    }
281 281
 }
Please login to merge, or discard this patch.
lib/private/Files/Mount/LocalHomeMountProvider.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
  * Mount provider for regular posix home folders
31 31
  */
32 32
 class LocalHomeMountProvider implements IHomeMountProvider {
33
-	/**
34
-	 * Get the cache mount for a user
35
-	 *
36
-	 * @param IUser $user
37
-	 * @param IStorageFactory $loader
38
-	 * @return \OCP\Files\Mount\IMountPoint[]
39
-	 */
40
-	public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
41
-		$arguments = ['user' => $user];
42
-		return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader);
43
-	}
33
+    /**
34
+     * Get the cache mount for a user
35
+     *
36
+     * @param IUser $user
37
+     * @param IStorageFactory $loader
38
+     * @return \OCP\Files\Mount\IMountPoint[]
39
+     */
40
+    public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
41
+        $arguments = ['user' => $user];
42
+        return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader);
43
+    }
44 44
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
 	 */
40 40
 	public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
41 41
 		$arguments = ['user' => $user];
42
-		return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader);
42
+		return new MountPoint('\OC\Files\Storage\Home', '/'.$user->getUID(), $arguments, $loader);
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
lib/private/Files/Mount/MoveableMount.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@
 block discarded – undo
27 27
  * Defines the mount point to be (re)moved by the user
28 28
  */
29 29
 interface MoveableMount {
30
-	/**
31
-	 * Move the mount point to $target
32
-	 *
33
-	 * @param string $target the target mount point
34
-	 * @return bool
35
-	 */
36
-	public function moveMount($target);
30
+    /**
31
+     * Move the mount point to $target
32
+     *
33
+     * @param string $target the target mount point
34
+     * @return bool
35
+     */
36
+    public function moveMount($target);
37 37
 
38
-	/**
39
-	 * Remove the mount points
40
-	 *
41
-	 * @return mixed
42
-	 * @return bool
43
-	 */
44
-	public function removeMount();
38
+    /**
39
+     * Remove the mount points
40
+     *
41
+     * @return mixed
42
+     * @return bool
43
+     */
44
+    public function removeMount();
45 45
 }
Please login to merge, or discard this patch.
lib/private/Files/Mount/Manager.php 2 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -30,137 +30,137 @@
 block discarded – undo
30 30
 use OCP\Files\Mount\IMountPoint;
31 31
 
32 32
 class Manager implements IMountManager {
33
-	/**
34
-	 * @var MountPoint[]
35
-	 */
36
-	private $mounts = array();
33
+    /**
34
+     * @var MountPoint[]
35
+     */
36
+    private $mounts = array();
37 37
 
38
-	/**
39
-	 * @param IMountPoint $mount
40
-	 */
41
-	public function addMount(IMountPoint $mount) {
42
-		$this->mounts[$mount->getMountPoint()] = $mount;
43
-	}
38
+    /**
39
+     * @param IMountPoint $mount
40
+     */
41
+    public function addMount(IMountPoint $mount) {
42
+        $this->mounts[$mount->getMountPoint()] = $mount;
43
+    }
44 44
 
45
-	/**
46
-	 * @param string $mountPoint
47
-	 */
48
-	public function removeMount($mountPoint) {
49
-		$mountPoint = Filesystem::normalizePath($mountPoint);
50
-		if (strlen($mountPoint) > 1) {
51
-			$mountPoint .= '/';
52
-		}
53
-		unset($this->mounts[$mountPoint]);
54
-	}
45
+    /**
46
+     * @param string $mountPoint
47
+     */
48
+    public function removeMount($mountPoint) {
49
+        $mountPoint = Filesystem::normalizePath($mountPoint);
50
+        if (strlen($mountPoint) > 1) {
51
+            $mountPoint .= '/';
52
+        }
53
+        unset($this->mounts[$mountPoint]);
54
+    }
55 55
 
56
-	/**
57
-	 * @param string $mountPoint
58
-	 * @param string $target
59
-	 */
60
-	public function moveMount($mountPoint, $target){
61
-		$this->mounts[$target] = $this->mounts[$mountPoint];
62
-		unset($this->mounts[$mountPoint]);
63
-	}
56
+    /**
57
+     * @param string $mountPoint
58
+     * @param string $target
59
+     */
60
+    public function moveMount($mountPoint, $target){
61
+        $this->mounts[$target] = $this->mounts[$mountPoint];
62
+        unset($this->mounts[$mountPoint]);
63
+    }
64 64
 
65
-	/**
66
-	 * Find the mount for $path
67
-	 *
68
-	 * @param string $path
69
-	 * @return MountPoint
70
-	 */
71
-	public function find($path) {
72
-		\OC_Util::setupFS();
73
-		$path = $this->formatPath($path);
74
-		if (isset($this->mounts[$path])) {
75
-			return $this->mounts[$path];
76
-		}
65
+    /**
66
+     * Find the mount for $path
67
+     *
68
+     * @param string $path
69
+     * @return MountPoint
70
+     */
71
+    public function find($path) {
72
+        \OC_Util::setupFS();
73
+        $path = $this->formatPath($path);
74
+        if (isset($this->mounts[$path])) {
75
+            return $this->mounts[$path];
76
+        }
77 77
 
78
-		\OC_Hook::emit('OC_Filesystem', 'get_mountpoint', array('path' => $path));
79
-		$foundMountPoint = '';
80
-		$mountPoints = array_keys($this->mounts);
81
-		foreach ($mountPoints as $mountpoint) {
82
-			if (strpos($path, $mountpoint) === 0 and strlen($mountpoint) > strlen($foundMountPoint)) {
83
-				$foundMountPoint = $mountpoint;
84
-			}
85
-		}
86
-		if (isset($this->mounts[$foundMountPoint])) {
87
-			return $this->mounts[$foundMountPoint];
88
-		} else {
89
-			return null;
90
-		}
91
-	}
78
+        \OC_Hook::emit('OC_Filesystem', 'get_mountpoint', array('path' => $path));
79
+        $foundMountPoint = '';
80
+        $mountPoints = array_keys($this->mounts);
81
+        foreach ($mountPoints as $mountpoint) {
82
+            if (strpos($path, $mountpoint) === 0 and strlen($mountpoint) > strlen($foundMountPoint)) {
83
+                $foundMountPoint = $mountpoint;
84
+            }
85
+        }
86
+        if (isset($this->mounts[$foundMountPoint])) {
87
+            return $this->mounts[$foundMountPoint];
88
+        } else {
89
+            return null;
90
+        }
91
+    }
92 92
 
93
-	/**
94
-	 * Find all mounts in $path
95
-	 *
96
-	 * @param string $path
97
-	 * @return MountPoint[]
98
-	 */
99
-	public function findIn($path) {
100
-		\OC_Util::setupFS();
101
-		$path = $this->formatPath($path);
102
-		$result = array();
103
-		$pathLength = strlen($path);
104
-		$mountPoints = array_keys($this->mounts);
105
-		foreach ($mountPoints as $mountPoint) {
106
-			if (substr($mountPoint, 0, $pathLength) === $path and strlen($mountPoint) > $pathLength) {
107
-				$result[] = $this->mounts[$mountPoint];
108
-			}
109
-		}
110
-		return $result;
111
-	}
93
+    /**
94
+     * Find all mounts in $path
95
+     *
96
+     * @param string $path
97
+     * @return MountPoint[]
98
+     */
99
+    public function findIn($path) {
100
+        \OC_Util::setupFS();
101
+        $path = $this->formatPath($path);
102
+        $result = array();
103
+        $pathLength = strlen($path);
104
+        $mountPoints = array_keys($this->mounts);
105
+        foreach ($mountPoints as $mountPoint) {
106
+            if (substr($mountPoint, 0, $pathLength) === $path and strlen($mountPoint) > $pathLength) {
107
+                $result[] = $this->mounts[$mountPoint];
108
+            }
109
+        }
110
+        return $result;
111
+    }
112 112
 
113
-	public function clear() {
114
-		$this->mounts = array();
115
-	}
113
+    public function clear() {
114
+        $this->mounts = array();
115
+    }
116 116
 
117
-	/**
118
-	 * Find mounts by storage id
119
-	 *
120
-	 * @param string $id
121
-	 * @return MountPoint[]
122
-	 */
123
-	public function findByStorageId($id) {
124
-		\OC_Util::setupFS();
125
-		if (strlen($id) > 64) {
126
-			$id = md5($id);
127
-		}
128
-		$result = array();
129
-		foreach ($this->mounts as $mount) {
130
-			if ($mount->getStorageId() === $id) {
131
-				$result[] = $mount;
132
-			}
133
-		}
134
-		return $result;
135
-	}
117
+    /**
118
+     * Find mounts by storage id
119
+     *
120
+     * @param string $id
121
+     * @return MountPoint[]
122
+     */
123
+    public function findByStorageId($id) {
124
+        \OC_Util::setupFS();
125
+        if (strlen($id) > 64) {
126
+            $id = md5($id);
127
+        }
128
+        $result = array();
129
+        foreach ($this->mounts as $mount) {
130
+            if ($mount->getStorageId() === $id) {
131
+                $result[] = $mount;
132
+            }
133
+        }
134
+        return $result;
135
+    }
136 136
 
137
-	/**
138
-	 * @return MountPoint[]
139
-	 */
140
-	public function getAll() {
141
-		return $this->mounts;
142
-	}
137
+    /**
138
+     * @return MountPoint[]
139
+     */
140
+    public function getAll() {
141
+        return $this->mounts;
142
+    }
143 143
 
144
-	/**
145
-	 * Find mounts by numeric storage id
146
-	 *
147
-	 * @param int $id
148
-	 * @return MountPoint[]
149
-	 */
150
-	public function findByNumericId($id) {
151
-		$storageId = \OC\Files\Cache\Storage::getStorageId($id);
152
-		return $this->findByStorageId($storageId);
153
-	}
144
+    /**
145
+     * Find mounts by numeric storage id
146
+     *
147
+     * @param int $id
148
+     * @return MountPoint[]
149
+     */
150
+    public function findByNumericId($id) {
151
+        $storageId = \OC\Files\Cache\Storage::getStorageId($id);
152
+        return $this->findByStorageId($storageId);
153
+    }
154 154
 
155
-	/**
156
-	 * @param string $path
157
-	 * @return string
158
-	 */
159
-	private function formatPath($path) {
160
-		$path = Filesystem::normalizePath($path);
161
-		if (strlen($path) > 1) {
162
-			$path .= '/';
163
-		}
164
-		return $path;
165
-	}
155
+    /**
156
+     * @param string $path
157
+     * @return string
158
+     */
159
+    private function formatPath($path) {
160
+        $path = Filesystem::normalizePath($path);
161
+        if (strlen($path) > 1) {
162
+            $path .= '/';
163
+        }
164
+        return $path;
165
+    }
166 166
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 	 * @param string $mountPoint
58 58
 	 * @param string $target
59 59
 	 */
60
-	public function moveMount($mountPoint, $target){
60
+	public function moveMount($mountPoint, $target) {
61 61
 		$this->mounts[$target] = $this->mounts[$mountPoint];
62 62
 		unset($this->mounts[$mountPoint]);
63 63
 	}
Please login to merge, or discard this patch.
lib/private/Files/AppData/Factory.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,24 +27,24 @@
 block discarded – undo
27 27
 
28 28
 class Factory {
29 29
 
30
-	/** @var IRootFolder */
31
-	private $rootFolder;
30
+    /** @var IRootFolder */
31
+    private $rootFolder;
32 32
 
33
-	/** @var SystemConfig */
34
-	private $config;
33
+    /** @var SystemConfig */
34
+    private $config;
35 35
 
36
-	public function __construct(IRootFolder $rootFolder,
37
-								SystemConfig $systemConfig) {
36
+    public function __construct(IRootFolder $rootFolder,
37
+                                SystemConfig $systemConfig) {
38 38
 
39
-		$this->rootFolder = $rootFolder;
40
-		$this->config = $systemConfig;
41
-	}
39
+        $this->rootFolder = $rootFolder;
40
+        $this->config = $systemConfig;
41
+    }
42 42
 
43
-	/**
44
-	 * @param string $appId
45
-	 * @return AppData
46
-	 */
47
-	public function get($appId) {
48
-		return new AppData($this->rootFolder, $this->config, $appId);
49
-	}
43
+    /**
44
+     * @param string $appId
45
+     * @return AppData
46
+     */
47
+    public function get($appId) {
48
+        return new AppData($this->rootFolder, $this->config, $appId);
49
+    }
50 50
 }
Please login to merge, or discard this patch.
lib/private/Files/AppData/AppData.php 2 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -34,98 +34,98 @@
 block discarded – undo
34 34
 
35 35
 class AppData implements IAppData {
36 36
 
37
-	/** @var IRootFolder */
38
-	private $rootFolder;
39
-
40
-	/** @var SystemConfig */
41
-	private $config;
42
-
43
-	/** @var string */
44
-	private $appId;
45
-
46
-	/** @var Folder */
47
-	private $folder;
48
-
49
-	/**
50
-	 * AppData constructor.
51
-	 *
52
-	 * @param IRootFolder $rootFolder
53
-	 * @param SystemConfig $systemConfig
54
-	 * @param string $appId
55
-	 */
56
-	public function __construct(IRootFolder $rootFolder,
57
-								SystemConfig $systemConfig,
58
-								$appId) {
59
-
60
-		$this->rootFolder = $rootFolder;
61
-		$this->config = $systemConfig;
62
-		$this->appId = $appId;
63
-	}
64
-
65
-	/**
66
-	 * @return Folder
67
-	 * @throws \RuntimeException
68
-	 */
69
-	private function getAppDataFolder() {
70
-		if ($this->folder === null) {
71
-			$instanceId = $this->config->getValue('instanceid', null);
72
-			if ($instanceId === null) {
73
-				throw new \RuntimeException('no instance id!');
74
-			}
75
-
76
-			$name = 'appdata_' . $instanceId;
77
-
78
-			try {
79
-				$appDataFolder = $this->rootFolder->get($name);
80
-			} catch (NotFoundException $e) {
81
-				try {
82
-					$appDataFolder = $this->rootFolder->newFolder($name);
83
-				} catch (NotPermittedException $e) {
84
-					throw new \RuntimeException('Could not get appdata folder');
85
-				}
86
-			}
87
-
88
-			try {
89
-				$appDataFolder = $appDataFolder->get($this->appId);
90
-			} catch (NotFoundException $e) {
91
-				try {
92
-					$appDataFolder = $appDataFolder->newFolder($this->appId);
93
-				} catch (NotPermittedException $e) {
94
-					throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
95
-				}
96
-			}
97
-
98
-			$this->folder = $appDataFolder;
99
-		}
100
-
101
-		return $this->folder;
102
-	}
103
-
104
-	public function getFolder($name) {
105
-		$node = $this->getAppDataFolder()->get($name);
106
-
107
-		/** @var Folder $node */
108
-		return new SimpleFolder($node);
109
-	}
110
-
111
-	public function newFolder($name) {
112
-		$folder = $this->getAppDataFolder()->newFolder($name);
113
-
114
-		return new SimpleFolder($folder);
115
-	}
116
-
117
-	public function getDirectoryListing() {
118
-		$listing = $this->getAppDataFolder()->getDirectoryListing();
119
-
120
-		$fileListing = array_map(function(Node $folder) {
121
-			if ($folder instanceof Folder) {
122
-				return new SimpleFolder($folder);
123
-			}
124
-			return null;
125
-		}, $listing);
126
-
127
-		$fileListing = array_filter($fileListing);
128
-
129
-		return array_values($fileListing);
130
-	}
37
+    /** @var IRootFolder */
38
+    private $rootFolder;
39
+
40
+    /** @var SystemConfig */
41
+    private $config;
42
+
43
+    /** @var string */
44
+    private $appId;
45
+
46
+    /** @var Folder */
47
+    private $folder;
48
+
49
+    /**
50
+     * AppData constructor.
51
+     *
52
+     * @param IRootFolder $rootFolder
53
+     * @param SystemConfig $systemConfig
54
+     * @param string $appId
55
+     */
56
+    public function __construct(IRootFolder $rootFolder,
57
+                                SystemConfig $systemConfig,
58
+                                $appId) {
59
+
60
+        $this->rootFolder = $rootFolder;
61
+        $this->config = $systemConfig;
62
+        $this->appId = $appId;
63
+    }
64
+
65
+    /**
66
+     * @return Folder
67
+     * @throws \RuntimeException
68
+     */
69
+    private function getAppDataFolder() {
70
+        if ($this->folder === null) {
71
+            $instanceId = $this->config->getValue('instanceid', null);
72
+            if ($instanceId === null) {
73
+                throw new \RuntimeException('no instance id!');
74
+            }
75
+
76
+            $name = 'appdata_' . $instanceId;
77
+
78
+            try {
79
+                $appDataFolder = $this->rootFolder->get($name);
80
+            } catch (NotFoundException $e) {
81
+                try {
82
+                    $appDataFolder = $this->rootFolder->newFolder($name);
83
+                } catch (NotPermittedException $e) {
84
+                    throw new \RuntimeException('Could not get appdata folder');
85
+                }
86
+            }
87
+
88
+            try {
89
+                $appDataFolder = $appDataFolder->get($this->appId);
90
+            } catch (NotFoundException $e) {
91
+                try {
92
+                    $appDataFolder = $appDataFolder->newFolder($this->appId);
93
+                } catch (NotPermittedException $e) {
94
+                    throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
95
+                }
96
+            }
97
+
98
+            $this->folder = $appDataFolder;
99
+        }
100
+
101
+        return $this->folder;
102
+    }
103
+
104
+    public function getFolder($name) {
105
+        $node = $this->getAppDataFolder()->get($name);
106
+
107
+        /** @var Folder $node */
108
+        return new SimpleFolder($node);
109
+    }
110
+
111
+    public function newFolder($name) {
112
+        $folder = $this->getAppDataFolder()->newFolder($name);
113
+
114
+        return new SimpleFolder($folder);
115
+    }
116
+
117
+    public function getDirectoryListing() {
118
+        $listing = $this->getAppDataFolder()->getDirectoryListing();
119
+
120
+        $fileListing = array_map(function(Node $folder) {
121
+            if ($folder instanceof Folder) {
122
+                return new SimpleFolder($folder);
123
+            }
124
+            return null;
125
+        }, $listing);
126
+
127
+        $fileListing = array_filter($fileListing);
128
+
129
+        return array_values($fileListing);
130
+    }
131 131
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 				throw new \RuntimeException('no instance id!');
74 74
 			}
75 75
 
76
-			$name = 'appdata_' . $instanceId;
76
+			$name = 'appdata_'.$instanceId;
77 77
 
78 78
 			try {
79 79
 				$appDataFolder = $this->rootFolder->get($name);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				try {
92 92
 					$appDataFolder = $appDataFolder->newFolder($this->appId);
93 93
 				} catch (NotPermittedException $e) {
94
-					throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
94
+					throw new \RuntimeException('Could not get appdata folder for '.$this->appId);
95 95
 				}
96 96
 			}
97 97
 
Please login to merge, or discard this patch.
lib/private/Files/Stream/Quota.php 3 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -33,71 +33,71 @@
 block discarded – undo
33 33
  * usage: resource \OC\Files\Stream\Quota::wrap($stream, $limit)
34 34
  */
35 35
 class Quota extends Wrapper {
36
-	/**
37
-	 * @var int $limit
38
-	 */
39
-	private $limit;
36
+    /**
37
+     * @var int $limit
38
+     */
39
+    private $limit;
40 40
 
41
-	/**
42
-	 * @param resource $stream
43
-	 * @param int $limit
44
-	 * @return resource
45
-	 */
46
-	static public function wrap($stream, $limit) {
47
-		$context = stream_context_create(array(
48
-			'quota' => array(
49
-				'source' => $stream,
50
-				'limit' => $limit
51
-			)
52
-		));
53
-		return Wrapper::wrapSource($stream, $context, 'quota', self::class);
54
-	}
41
+    /**
42
+     * @param resource $stream
43
+     * @param int $limit
44
+     * @return resource
45
+     */
46
+    static public function wrap($stream, $limit) {
47
+        $context = stream_context_create(array(
48
+            'quota' => array(
49
+                'source' => $stream,
50
+                'limit' => $limit
51
+            )
52
+        ));
53
+        return Wrapper::wrapSource($stream, $context, 'quota', self::class);
54
+    }
55 55
 
56
-	public function stream_open($path, $mode, $options, &$opened_path) {
57
-		$context = $this->loadContext('quota');
58
-		$this->source = $context['source'];
59
-		$this->limit = $context['limit'];
56
+    public function stream_open($path, $mode, $options, &$opened_path) {
57
+        $context = $this->loadContext('quota');
58
+        $this->source = $context['source'];
59
+        $this->limit = $context['limit'];
60 60
 
61
-		return true;
62
-	}
61
+        return true;
62
+    }
63 63
 
64
-	public function dir_opendir($path, $options) {
65
-		return false;
66
-	}
64
+    public function dir_opendir($path, $options) {
65
+        return false;
66
+    }
67 67
 
68
-	public function stream_seek($offset, $whence = SEEK_SET) {
69
-		if ($whence === SEEK_END){
70
-			// go to the end to find out last position's offset
71
-			$oldOffset = $this->stream_tell();
72
-			if (fseek($this->source, 0, $whence) !== 0){
73
-				return false;
74
-			}
75
-			$whence = SEEK_SET;
76
-			$offset = $this->stream_tell() + $offset;
77
-			$this->limit += $oldOffset - $offset;
78
-		}
79
-		else if ($whence === SEEK_SET) {
80
-			$this->limit += $this->stream_tell() - $offset;
81
-		} else {
82
-			$this->limit -= $offset;
83
-		}
84
-		// this wrapper needs to return "true" for success.
85
-		// the fseek call itself returns 0 on succeess
86
-		return fseek($this->source, $offset, $whence) === 0;
87
-	}
68
+    public function stream_seek($offset, $whence = SEEK_SET) {
69
+        if ($whence === SEEK_END){
70
+            // go to the end to find out last position's offset
71
+            $oldOffset = $this->stream_tell();
72
+            if (fseek($this->source, 0, $whence) !== 0){
73
+                return false;
74
+            }
75
+            $whence = SEEK_SET;
76
+            $offset = $this->stream_tell() + $offset;
77
+            $this->limit += $oldOffset - $offset;
78
+        }
79
+        else if ($whence === SEEK_SET) {
80
+            $this->limit += $this->stream_tell() - $offset;
81
+        } else {
82
+            $this->limit -= $offset;
83
+        }
84
+        // this wrapper needs to return "true" for success.
85
+        // the fseek call itself returns 0 on succeess
86
+        return fseek($this->source, $offset, $whence) === 0;
87
+    }
88 88
 
89
-	public function stream_read($count) {
90
-		$this->limit -= $count;
91
-		return fread($this->source, $count);
92
-	}
89
+    public function stream_read($count) {
90
+        $this->limit -= $count;
91
+        return fread($this->source, $count);
92
+    }
93 93
 
94
-	public function stream_write($data) {
95
-		$size = strlen($data);
96
-		if ($size > $this->limit) {
97
-			$data = substr($data, 0, $this->limit);
98
-			$size = $this->limit;
99
-		}
100
-		$this->limit -= $size;
101
-		return fwrite($this->source, $data);
102
-	}
94
+    public function stream_write($data) {
95
+        $size = strlen($data);
96
+        if ($size > $this->limit) {
97
+            $data = substr($data, 0, $this->limit);
98
+            $size = $this->limit;
99
+        }
100
+        $this->limit -= $size;
101
+        return fwrite($this->source, $data);
102
+    }
103 103
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,10 +66,10 @@
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public function stream_seek($offset, $whence = SEEK_SET) {
69
-		if ($whence === SEEK_END){
69
+		if ($whence === SEEK_END) {
70 70
 			// go to the end to find out last position's offset
71 71
 			$oldOffset = $this->stream_tell();
72
-			if (fseek($this->source, 0, $whence) !== 0){
72
+			if (fseek($this->source, 0, $whence) !== 0) {
73 73
 				return false;
74 74
 			}
75 75
 			$whence = SEEK_SET;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@
 block discarded – undo
75 75
 			$whence = SEEK_SET;
76 76
 			$offset = $this->stream_tell() + $offset;
77 77
 			$this->limit += $oldOffset - $offset;
78
-		}
79
-		else if ($whence === SEEK_SET) {
78
+		} else if ($whence === SEEK_SET) {
80 79
 			$this->limit += $this->stream_tell() - $offset;
81 80
 		} else {
82 81
 			$this->limit -= $offset;
Please login to merge, or discard this patch.
lib/private/Files/Config/LazyStorageMountInfo.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -29,60 +29,60 @@
 block discarded – undo
29 29
 use OCP\IUser;
30 30
 
31 31
 class LazyStorageMountInfo extends CachedMountInfo {
32
-	/** @var IMountPoint */
33
-	private $mount;
32
+    /** @var IMountPoint */
33
+    private $mount;
34 34
 
35
-	/**
36
-	 * CachedMountInfo constructor.
37
-	 *
38
-	 * @param IUser $user
39
-	 * @param IMountPoint $mount
40
-	 */
41
-	public function __construct(IUser $user, IMountPoint $mount) {
42
-		$this->user = $user;
43
-		$this->mount = $mount;
44
-	}
35
+    /**
36
+     * CachedMountInfo constructor.
37
+     *
38
+     * @param IUser $user
39
+     * @param IMountPoint $mount
40
+     */
41
+    public function __construct(IUser $user, IMountPoint $mount) {
42
+        $this->user = $user;
43
+        $this->mount = $mount;
44
+    }
45 45
 
46
-	/**
47
-	 * @return int the numeric storage id of the mount
48
-	 */
49
-	public function getStorageId() {
50
-		if (!$this->storageId) {
51
-			$this->storageId = $this->mount->getNumericStorageId();
52
-		}
53
-		return parent::getStorageId();
54
-	}
46
+    /**
47
+     * @return int the numeric storage id of the mount
48
+     */
49
+    public function getStorageId() {
50
+        if (!$this->storageId) {
51
+            $this->storageId = $this->mount->getNumericStorageId();
52
+        }
53
+        return parent::getStorageId();
54
+    }
55 55
 
56
-	/**
57
-	 * @return int the fileid of the root of the mount
58
-	 */
59
-	public function getRootId() {
60
-		if (!$this->rootId) {
61
-			$this->rootId = $this->mount->getStorageRootId();
62
-		}
63
-		return parent::getRootId();
64
-	}
56
+    /**
57
+     * @return int the fileid of the root of the mount
58
+     */
59
+    public function getRootId() {
60
+        if (!$this->rootId) {
61
+            $this->rootId = $this->mount->getStorageRootId();
62
+        }
63
+        return parent::getRootId();
64
+    }
65 65
 
66
-	/**
67
-	 * @return string the mount point of the mount for the user
68
-	 */
69
-	public function getMountPoint() {
70
-		if (!$this->mountPoint) {
71
-			$this->mountPoint = $this->mount->getMountPoint();
72
-		}
73
-		return parent::getMountPoint();
74
-	}
66
+    /**
67
+     * @return string the mount point of the mount for the user
68
+     */
69
+    public function getMountPoint() {
70
+        if (!$this->mountPoint) {
71
+            $this->mountPoint = $this->mount->getMountPoint();
72
+        }
73
+        return parent::getMountPoint();
74
+    }
75 75
 
76
-	public function getMountId() {
77
-		return $this->mount->getMountId();
78
-	}
76
+    public function getMountId() {
77
+        return $this->mount->getMountId();
78
+    }
79 79
 
80
-	/**
81
-	 * Get the internal path (within the storage) of the root of the mount
82
-	 *
83
-	 * @return string
84
-	 */
85
-	public function getRootInternalPath() {
86
-		return $this->mount->getInternalPath($this->mount->getMountPoint());
87
-	}
80
+    /**
81
+     * Get the internal path (within the storage) of the root of the mount
82
+     *
83
+     * @return string
84
+     */
85
+    public function getRootInternalPath() {
86
+        return $this->mount->getInternalPath($this->mount->getMountPoint());
87
+    }
88 88
 }
Please login to merge, or discard this patch.