Passed
Push — master ( 963d96...2d5047 )
by Morris
13:06
created
apps/files_sharing/lib/Controller/RemoteController.php 1 patch
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -34,156 +34,156 @@
 block discarded – undo
34 34
 
35 35
 class RemoteController extends OCSController {
36 36
 
37
-	/** @var Manager */
38
-	private $externalManager;
39
-
40
-	/** @var ILogger */
41
-	private $logger;
42
-
43
-	/**
44
-	 * @NoAdminRequired
45
-	 *
46
-	 * Remote constructor.
47
-	 *
48
-	 * @param string $appName
49
-	 * @param IRequest $request
50
-	 * @param Manager $externalManager
51
-	 */
52
-	public function __construct($appName,
53
-								IRequest $request,
54
-								Manager $externalManager,
55
-								ILogger $logger) {
56
-		parent::__construct($appName, $request);
57
-
58
-		$this->externalManager = $externalManager;
59
-		$this->logger = $logger;
60
-	}
61
-
62
-	/**
63
-	 * @NoAdminRequired
64
-	 *
65
-	 * Get list of pending remote shares
66
-	 *
67
-	 * @return DataResponse
68
-	 */
69
-	public function getOpenShares() {
70
-		return new DataResponse($this->externalManager->getOpenShares());
71
-	}
72
-
73
-	/**
74
-	 * @NoAdminRequired
75
-	 *
76
-	 * Accept a remote share
77
-	 *
78
-	 * @param int $id
79
-	 * @return DataResponse
80
-	 * @throws OCSNotFoundException
81
-	 */
82
-	public function acceptShare($id) {
83
-		if ($this->externalManager->acceptShare($id)) {
84
-			return new DataResponse();
85
-		}
86
-
87
-		$this->logger->error('Could not accept federated share with id: ' . $id,
88
-			['app' => 'files_sharing']);
89
-
90
-		throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
91
-	}
92
-
93
-	/**
94
-	 * @NoAdminRequired
95
-	 *
96
-	 * Decline a remote share
97
-	 *
98
-	 * @param int $id
99
-	 * @return DataResponse
100
-	 * @throws OCSNotFoundException
101
-	 */
102
-	public function declineShare($id) {
103
-		if ($this->externalManager->declineShare($id)) {
104
-			return new DataResponse();
105
-		}
106
-
107
-		// Make sure the user has no notification for something that does not exist anymore.
108
-		$this->externalManager->processNotification($id);
109
-
110
-		throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
111
-	}
112
-
113
-	/**
114
-	 * @param array $share Share with info from the share_external table
115
-	 * @return array enriched share info with data from the filecache
116
-	 */
117
-	private static function extendShareInfo($share) {
118
-		$view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/');
119
-		$info = $view->getFileInfo($share['mountpoint']);
120
-
121
-		$share['mimetype'] = $info->getMimetype();
122
-		$share['mtime'] = $info->getMTime();
123
-		$share['permissions'] = $info->getPermissions();
124
-		$share['type'] = $info->getType();
125
-		$share['file_id'] = $info->getId();
126
-
127
-		return $share;
128
-	}
129
-
130
-	/**
131
-	 * @NoAdminRequired
132
-	 *
133
-	 * List accepted remote shares
134
-	 *
135
-	 * @return DataResponse
136
-	 */
137
-	public function getShares() {
138
-		$shares = $this->externalManager->getAcceptedShares();
139
-		$shares = array_map('self::extendShareInfo', $shares);
140
-
141
-		return new DataResponse($shares);
142
-	}
143
-
144
-	/**
145
-	 * @NoAdminRequired
146
-	 *
147
-	 * Get info of a remote share
148
-	 *
149
-	 * @param int $id
150
-	 * @return DataResponse
151
-	 * @throws OCSNotFoundException
152
-	 */
153
-	public function getShare($id) {
154
-		$shareInfo = $this->externalManager->getShare($id);
155
-
156
-		if ($shareInfo === false) {
157
-			throw new OCSNotFoundException('share does not exist');
158
-		} else {
159
-			$shareInfo = self::extendShareInfo($shareInfo);
160
-			return new DataResponse($shareInfo);
161
-		}
162
-	}
163
-
164
-	/**
165
-	 * @NoAdminRequired
166
-	 *
167
-	 * Unshare a remote share
168
-	 *
169
-	 * @param int $id
170
-	 * @return DataResponse
171
-	 * @throws OCSNotFoundException
172
-	 * @throws OCSForbiddenException
173
-	 */
174
-	public function unshare($id) {
175
-		$shareInfo = $this->externalManager->getShare($id);
176
-
177
-		if ($shareInfo === false) {
178
-			throw new OCSNotFoundException('Share does not exist');
179
-		}
180
-
181
-		$mountPoint = '/' . \OC_User::getUser() . '/files' . $shareInfo['mountpoint'];
182
-
183
-		if ($this->externalManager->removeShare($mountPoint) === true) {
184
-			return new DataResponse();
185
-		} else {
186
-			throw new OCSForbiddenException('Could not unshare');
187
-		}
188
-	}
37
+    /** @var Manager */
38
+    private $externalManager;
39
+
40
+    /** @var ILogger */
41
+    private $logger;
42
+
43
+    /**
44
+     * @NoAdminRequired
45
+     *
46
+     * Remote constructor.
47
+     *
48
+     * @param string $appName
49
+     * @param IRequest $request
50
+     * @param Manager $externalManager
51
+     */
52
+    public function __construct($appName,
53
+                                IRequest $request,
54
+                                Manager $externalManager,
55
+                                ILogger $logger) {
56
+        parent::__construct($appName, $request);
57
+
58
+        $this->externalManager = $externalManager;
59
+        $this->logger = $logger;
60
+    }
61
+
62
+    /**
63
+     * @NoAdminRequired
64
+     *
65
+     * Get list of pending remote shares
66
+     *
67
+     * @return DataResponse
68
+     */
69
+    public function getOpenShares() {
70
+        return new DataResponse($this->externalManager->getOpenShares());
71
+    }
72
+
73
+    /**
74
+     * @NoAdminRequired
75
+     *
76
+     * Accept a remote share
77
+     *
78
+     * @param int $id
79
+     * @return DataResponse
80
+     * @throws OCSNotFoundException
81
+     */
82
+    public function acceptShare($id) {
83
+        if ($this->externalManager->acceptShare($id)) {
84
+            return new DataResponse();
85
+        }
86
+
87
+        $this->logger->error('Could not accept federated share with id: ' . $id,
88
+            ['app' => 'files_sharing']);
89
+
90
+        throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
91
+    }
92
+
93
+    /**
94
+     * @NoAdminRequired
95
+     *
96
+     * Decline a remote share
97
+     *
98
+     * @param int $id
99
+     * @return DataResponse
100
+     * @throws OCSNotFoundException
101
+     */
102
+    public function declineShare($id) {
103
+        if ($this->externalManager->declineShare($id)) {
104
+            return new DataResponse();
105
+        }
106
+
107
+        // Make sure the user has no notification for something that does not exist anymore.
108
+        $this->externalManager->processNotification($id);
109
+
110
+        throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
111
+    }
112
+
113
+    /**
114
+     * @param array $share Share with info from the share_external table
115
+     * @return array enriched share info with data from the filecache
116
+     */
117
+    private static function extendShareInfo($share) {
118
+        $view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/');
119
+        $info = $view->getFileInfo($share['mountpoint']);
120
+
121
+        $share['mimetype'] = $info->getMimetype();
122
+        $share['mtime'] = $info->getMTime();
123
+        $share['permissions'] = $info->getPermissions();
124
+        $share['type'] = $info->getType();
125
+        $share['file_id'] = $info->getId();
126
+
127
+        return $share;
128
+    }
129
+
130
+    /**
131
+     * @NoAdminRequired
132
+     *
133
+     * List accepted remote shares
134
+     *
135
+     * @return DataResponse
136
+     */
137
+    public function getShares() {
138
+        $shares = $this->externalManager->getAcceptedShares();
139
+        $shares = array_map('self::extendShareInfo', $shares);
140
+
141
+        return new DataResponse($shares);
142
+    }
143
+
144
+    /**
145
+     * @NoAdminRequired
146
+     *
147
+     * Get info of a remote share
148
+     *
149
+     * @param int $id
150
+     * @return DataResponse
151
+     * @throws OCSNotFoundException
152
+     */
153
+    public function getShare($id) {
154
+        $shareInfo = $this->externalManager->getShare($id);
155
+
156
+        if ($shareInfo === false) {
157
+            throw new OCSNotFoundException('share does not exist');
158
+        } else {
159
+            $shareInfo = self::extendShareInfo($shareInfo);
160
+            return new DataResponse($shareInfo);
161
+        }
162
+    }
163
+
164
+    /**
165
+     * @NoAdminRequired
166
+     *
167
+     * Unshare a remote share
168
+     *
169
+     * @param int $id
170
+     * @return DataResponse
171
+     * @throws OCSNotFoundException
172
+     * @throws OCSForbiddenException
173
+     */
174
+    public function unshare($id) {
175
+        $shareInfo = $this->externalManager->getShare($id);
176
+
177
+        if ($shareInfo === false) {
178
+            throw new OCSNotFoundException('Share does not exist');
179
+        }
180
+
181
+        $mountPoint = '/' . \OC_User::getUser() . '/files' . $shareInfo['mountpoint'];
182
+
183
+        if ($this->externalManager->removeShare($mountPoint) === true) {
184
+            return new DataResponse();
185
+        } else {
186
+            throw new OCSForbiddenException('Could not unshare');
187
+        }
188
+    }
189 189
 }
Please login to merge, or discard this patch.
apps/testing/lib/AppInfo/Application.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@
 block discarded – undo
25 25
 use OCA\Testing\AlternativeHomeUserBackend;
26 26
 
27 27
 class Application extends App {
28
-	public function __construct (array $urlParams = array()) {
29
-		$appName = 'testing';
30
-		parent::__construct($appName, $urlParams);
28
+    public function __construct (array $urlParams = array()) {
29
+        $appName = 'testing';
30
+        parent::__construct($appName, $urlParams);
31 31
 
32
-		$c = $this->getContainer();
33
-		$config = $c->getServer()->getConfig();
34
-		if ($config->getAppValue($appName, 'enable_alt_user_backend', 'no') === 'yes') {
35
-			$userManager = $c->getServer()->getUserManager();
32
+        $c = $this->getContainer();
33
+        $config = $c->getServer()->getConfig();
34
+        if ($config->getAppValue($appName, 'enable_alt_user_backend', 'no') === 'yes') {
35
+            $userManager = $c->getServer()->getUserManager();
36 36
 
37
-			// replace all user backends with this one
38
-			$userManager->clearBackends();
39
-			$userManager->registerBackend($c->query(AlternativeHomeUserBackend::class));
40
-		}
41
-	}
37
+            // replace all user backends with this one
38
+            $userManager->clearBackends();
39
+            $userManager->registerBackend($c->query(AlternativeHomeUserBackend::class));
40
+        }
41
+    }
42 42
 }
Please login to merge, or discard this patch.
apps/testing/lib/Controller/ConfigController.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,39 +29,39 @@
 block discarded – undo
29 29
 
30 30
 class ConfigController extends OCSController {
31 31
 
32
-	/** @var IConfig */
33
-	private $config;
32
+    /** @var IConfig */
33
+    private $config;
34 34
 
35
-	/**
36
-	 * @param string $appName
37
-	 * @param IRequest $request
38
-	 * @param IConfig $config
39
-	 */
40
-	public function __construct($appName,
41
-								IRequest $request,
42
-								IConfig $config) {
43
-		parent::__construct($appName, $request);
44
-		$this->config = $config;
45
-	}
35
+    /**
36
+     * @param string $appName
37
+     * @param IRequest $request
38
+     * @param IConfig $config
39
+     */
40
+    public function __construct($appName,
41
+                                IRequest $request,
42
+                                IConfig $config) {
43
+        parent::__construct($appName, $request);
44
+        $this->config = $config;
45
+    }
46 46
 
47
-	/**
48
-	 * @param string $appid
49
-	 * @param string $configkey
50
-	 * @param string $value
51
-	 * @return DataResponse
52
-	 */
53
-	public function setAppValue($appid, $configkey, $value) {
54
-		$this->config->setAppValue($appid, $configkey, $value);
55
-		return new DataResponse();
56
-	}
47
+    /**
48
+     * @param string $appid
49
+     * @param string $configkey
50
+     * @param string $value
51
+     * @return DataResponse
52
+     */
53
+    public function setAppValue($appid, $configkey, $value) {
54
+        $this->config->setAppValue($appid, $configkey, $value);
55
+        return new DataResponse();
56
+    }
57 57
 
58
-	/**
59
-	 * @param string $appid
60
-	 * @param string $configkey
61
-	 * @return DataResponse
62
-	 */
63
-	public function deleteAppValue($appid, $configkey) {
64
-		$this->config->deleteAppValue($appid, $configkey);
65
-		return new DataResponse();
66
-	}
58
+    /**
59
+     * @param string $appid
60
+     * @param string $configkey
61
+     * @return DataResponse
62
+     */
63
+    public function deleteAppValue($appid, $configkey) {
64
+        $this->config->deleteAppValue($appid, $configkey);
65
+        return new DataResponse();
66
+    }
67 67
 }
Please login to merge, or discard this patch.
apps/testing/lib/Controller/LockingController.php 1 patch
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -39,208 +39,208 @@
 block discarded – undo
39 39
 
40 40
 class LockingController extends OCSController {
41 41
 
42
-	/** @var ILockingProvider */
43
-	protected $lockingProvider;
44
-
45
-	/** @var FakeDBLockingProvider */
46
-	protected $fakeDBLockingProvider;
47
-
48
-	/** @var IDBConnection */
49
-	protected $connection;
50
-
51
-	/** @var IConfig */
52
-	protected $config;
53
-
54
-	/** @var IRootFolder */
55
-	protected $rootFolder;
56
-
57
-	/**
58
-	 * @param string $appName
59
-	 * @param IRequest $request
60
-	 * @param ILockingProvider $lockingProvider
61
-	 * @param FakeDBLockingProvider $fakeDBLockingProvider
62
-	 * @param IDBConnection $connection
63
-	 * @param IConfig $config
64
-	 * @param IRootFolder $rootFolder
65
-	 */
66
-	public function __construct($appName,
67
-								IRequest $request,
68
-								ILockingProvider $lockingProvider,
69
-								FakeDBLockingProvider $fakeDBLockingProvider,
70
-								IDBConnection $connection,
71
-								IConfig $config,
72
-								IRootFolder $rootFolder) {
73
-		parent::__construct($appName, $request);
74
-
75
-		$this->lockingProvider = $lockingProvider;
76
-		$this->fakeDBLockingProvider = $fakeDBLockingProvider;
77
-		$this->connection = $connection;
78
-		$this->config = $config;
79
-		$this->rootFolder = $rootFolder;
80
-	}
81
-
82
-	/**
83
-	 * @return ILockingProvider
84
-	 * @throws \RuntimeException
85
-	 */
86
-	protected function getLockingProvider() {
87
-		if ($this->lockingProvider instanceof DBLockingProvider) {
88
-			return $this->fakeDBLockingProvider;
89
-		}
90
-		throw new \RuntimeException('Lock provisioning is only possible using the DBLockingProvider');
91
-	}
92
-
93
-	/**
94
-	 * @param string $user
95
-	 * @param string $path
96
-	 * @return string
97
-	 * @throws NotFoundException
98
-	 */
99
-	protected function getPath($user, $path) {
100
-		$node = $this->rootFolder->getUserFolder($user)->get($path);
101
-		return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/'));
102
-	}
103
-
104
-	/**
105
-	 * @return DataResponse
106
-	 * @throws OCSException
107
-	 */
108
-	public function isLockingEnabled() {
109
-		try {
110
-			$this->getLockingProvider();
111
-			return new DataResponse();
112
-		} catch (\RuntimeException $e) {
113
-			throw new OCSException($e->getMessage(), Http::STATUS_NOT_IMPLEMENTED, $e);
114
-		}
115
-	}
116
-
117
-	/**
118
-	 * @param int $type
119
-	 * @param string $user
120
-	 * @param string $path
121
-	 * @return DataResponse
122
-	 * @throws OCSException
123
-	 */
124
-	public function acquireLock($type, $user, $path) {
125
-		try {
126
-			$path = $this->getPath($user, $path);
127
-		} catch (NoUserException $e) {
128
-			throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
129
-		} catch (NotFoundException $e) {
130
-			throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
131
-		}
132
-
133
-		$lockingProvider = $this->getLockingProvider();
134
-
135
-		try {
136
-			$lockingProvider->acquireLock($path, $type);
137
-			$this->config->setAppValue('testing', 'locking_' . $path, $type);
138
-			return new DataResponse();
139
-		} catch (LockedException $e) {
140
-			throw new OCSException('', Http::STATUS_LOCKED, $e);
141
-		}
142
-	}
143
-
144
-	/**
145
-	 * @param int $type
146
-	 * @param string $user
147
-	 * @param string $path
148
-	 * @return DataResponse
149
-	 * @throws OCSException
150
-	 */
151
-	public function changeLock($type, $user, $path) {
152
-		try {
153
-			$path = $this->getPath($user, $path);
154
-		} catch (NoUserException $e) {
155
-			throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
156
-		} catch (NotFoundException $e) {
157
-			throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
158
-		}
159
-
160
-		$lockingProvider = $this->getLockingProvider();
161
-
162
-		try {
163
-			$lockingProvider->changeLock($path, $type);
164
-			$this->config->setAppValue('testing', 'locking_' . $path, $type);
165
-			return new DataResponse();
166
-		} catch (LockedException $e) {
167
-			throw new OCSException('', Http::STATUS_LOCKED, $e);
168
-		}
169
-	}
170
-
171
-	/**
172
-	 * @param int $type
173
-	 * @param string $user
174
-	 * @param string $path
175
-	 * @return DataResponse
176
-	 * @throws OCSException
177
-	 */
178
-	public function releaseLock($type, $user, $path) {
179
-		try {
180
-			$path = $this->getPath($user, $path);
181
-		} catch (NoUserException $e) {
182
-			throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
183
-		} catch (NotFoundException $e) {
184
-			throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
185
-		}
186
-
187
-		$lockingProvider = $this->getLockingProvider();
188
-
189
-		try {
190
-			$lockingProvider->releaseLock($path, $type);
191
-			$this->config->deleteAppValue('testing', 'locking_' . $path);
192
-			return new DataResponse();
193
-		} catch (LockedException $e) {
194
-			throw new OCSException('', Http::STATUS_LOCKED, $e);
195
-		}
196
-	}
197
-
198
-	/**
199
-	 * @param int $type
200
-	 * @param string $user
201
-	 * @param string $path
202
-	 * @return DataResponse
203
-	 * @throws OCSException
204
-	 */
205
-	public function isLocked($type, $user, $path) {
206
-		try {
207
-			$path = $this->getPath($user, $path);
208
-		} catch (NoUserException $e) {
209
-			throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
210
-		} catch (NotFoundException $e) {
211
-			throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
212
-		}
213
-
214
-		$lockingProvider = $this->getLockingProvider();
215
-
216
-		if ($lockingProvider->isLocked($path, $type)) {
217
-			return new DataResponse();
218
-		}
219
-
220
-		throw new OCSException('', Http::STATUS_LOCKED);
221
-	}
222
-
223
-	/**
224
-	 * @param int $type
225
-	 * @return DataResponse
226
-	 */
227
-	public function releaseAll($type = null) {
228
-		$lockingProvider = $this->getLockingProvider();
229
-
230
-		foreach ($this->config->getAppKeys('testing') as $lock) {
231
-			if (strpos($lock, 'locking_') === 0) {
232
-				$path = substr($lock, strlen('locking_'));
233
-
234
-				if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) {
235
-					$lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
236
-				} else if ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) {
237
-					$lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
238
-				} else {
239
-					$lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
240
-				}
241
-			}
242
-		}
243
-
244
-		return new DataResponse();
245
-	}
42
+    /** @var ILockingProvider */
43
+    protected $lockingProvider;
44
+
45
+    /** @var FakeDBLockingProvider */
46
+    protected $fakeDBLockingProvider;
47
+
48
+    /** @var IDBConnection */
49
+    protected $connection;
50
+
51
+    /** @var IConfig */
52
+    protected $config;
53
+
54
+    /** @var IRootFolder */
55
+    protected $rootFolder;
56
+
57
+    /**
58
+     * @param string $appName
59
+     * @param IRequest $request
60
+     * @param ILockingProvider $lockingProvider
61
+     * @param FakeDBLockingProvider $fakeDBLockingProvider
62
+     * @param IDBConnection $connection
63
+     * @param IConfig $config
64
+     * @param IRootFolder $rootFolder
65
+     */
66
+    public function __construct($appName,
67
+                                IRequest $request,
68
+                                ILockingProvider $lockingProvider,
69
+                                FakeDBLockingProvider $fakeDBLockingProvider,
70
+                                IDBConnection $connection,
71
+                                IConfig $config,
72
+                                IRootFolder $rootFolder) {
73
+        parent::__construct($appName, $request);
74
+
75
+        $this->lockingProvider = $lockingProvider;
76
+        $this->fakeDBLockingProvider = $fakeDBLockingProvider;
77
+        $this->connection = $connection;
78
+        $this->config = $config;
79
+        $this->rootFolder = $rootFolder;
80
+    }
81
+
82
+    /**
83
+     * @return ILockingProvider
84
+     * @throws \RuntimeException
85
+     */
86
+    protected function getLockingProvider() {
87
+        if ($this->lockingProvider instanceof DBLockingProvider) {
88
+            return $this->fakeDBLockingProvider;
89
+        }
90
+        throw new \RuntimeException('Lock provisioning is only possible using the DBLockingProvider');
91
+    }
92
+
93
+    /**
94
+     * @param string $user
95
+     * @param string $path
96
+     * @return string
97
+     * @throws NotFoundException
98
+     */
99
+    protected function getPath($user, $path) {
100
+        $node = $this->rootFolder->getUserFolder($user)->get($path);
101
+        return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/'));
102
+    }
103
+
104
+    /**
105
+     * @return DataResponse
106
+     * @throws OCSException
107
+     */
108
+    public function isLockingEnabled() {
109
+        try {
110
+            $this->getLockingProvider();
111
+            return new DataResponse();
112
+        } catch (\RuntimeException $e) {
113
+            throw new OCSException($e->getMessage(), Http::STATUS_NOT_IMPLEMENTED, $e);
114
+        }
115
+    }
116
+
117
+    /**
118
+     * @param int $type
119
+     * @param string $user
120
+     * @param string $path
121
+     * @return DataResponse
122
+     * @throws OCSException
123
+     */
124
+    public function acquireLock($type, $user, $path) {
125
+        try {
126
+            $path = $this->getPath($user, $path);
127
+        } catch (NoUserException $e) {
128
+            throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
129
+        } catch (NotFoundException $e) {
130
+            throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
131
+        }
132
+
133
+        $lockingProvider = $this->getLockingProvider();
134
+
135
+        try {
136
+            $lockingProvider->acquireLock($path, $type);
137
+            $this->config->setAppValue('testing', 'locking_' . $path, $type);
138
+            return new DataResponse();
139
+        } catch (LockedException $e) {
140
+            throw new OCSException('', Http::STATUS_LOCKED, $e);
141
+        }
142
+    }
143
+
144
+    /**
145
+     * @param int $type
146
+     * @param string $user
147
+     * @param string $path
148
+     * @return DataResponse
149
+     * @throws OCSException
150
+     */
151
+    public function changeLock($type, $user, $path) {
152
+        try {
153
+            $path = $this->getPath($user, $path);
154
+        } catch (NoUserException $e) {
155
+            throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
156
+        } catch (NotFoundException $e) {
157
+            throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
158
+        }
159
+
160
+        $lockingProvider = $this->getLockingProvider();
161
+
162
+        try {
163
+            $lockingProvider->changeLock($path, $type);
164
+            $this->config->setAppValue('testing', 'locking_' . $path, $type);
165
+            return new DataResponse();
166
+        } catch (LockedException $e) {
167
+            throw new OCSException('', Http::STATUS_LOCKED, $e);
168
+        }
169
+    }
170
+
171
+    /**
172
+     * @param int $type
173
+     * @param string $user
174
+     * @param string $path
175
+     * @return DataResponse
176
+     * @throws OCSException
177
+     */
178
+    public function releaseLock($type, $user, $path) {
179
+        try {
180
+            $path = $this->getPath($user, $path);
181
+        } catch (NoUserException $e) {
182
+            throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
183
+        } catch (NotFoundException $e) {
184
+            throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
185
+        }
186
+
187
+        $lockingProvider = $this->getLockingProvider();
188
+
189
+        try {
190
+            $lockingProvider->releaseLock($path, $type);
191
+            $this->config->deleteAppValue('testing', 'locking_' . $path);
192
+            return new DataResponse();
193
+        } catch (LockedException $e) {
194
+            throw new OCSException('', Http::STATUS_LOCKED, $e);
195
+        }
196
+    }
197
+
198
+    /**
199
+     * @param int $type
200
+     * @param string $user
201
+     * @param string $path
202
+     * @return DataResponse
203
+     * @throws OCSException
204
+     */
205
+    public function isLocked($type, $user, $path) {
206
+        try {
207
+            $path = $this->getPath($user, $path);
208
+        } catch (NoUserException $e) {
209
+            throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
210
+        } catch (NotFoundException $e) {
211
+            throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
212
+        }
213
+
214
+        $lockingProvider = $this->getLockingProvider();
215
+
216
+        if ($lockingProvider->isLocked($path, $type)) {
217
+            return new DataResponse();
218
+        }
219
+
220
+        throw new OCSException('', Http::STATUS_LOCKED);
221
+    }
222
+
223
+    /**
224
+     * @param int $type
225
+     * @return DataResponse
226
+     */
227
+    public function releaseAll($type = null) {
228
+        $lockingProvider = $this->getLockingProvider();
229
+
230
+        foreach ($this->config->getAppKeys('testing') as $lock) {
231
+            if (strpos($lock, 'locking_') === 0) {
232
+                $path = substr($lock, strlen('locking_'));
233
+
234
+                if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) {
235
+                    $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
236
+                } else if ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) {
237
+                    $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
238
+                } else {
239
+                    $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
240
+                }
241
+            }
242
+        }
243
+
244
+        return new DataResponse();
245
+    }
246 246
 }
Please login to merge, or discard this patch.
lib/public/Files/ObjectStore/IObjectStore.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -30,33 +30,33 @@
 block discarded – undo
30 30
  */
31 31
 interface IObjectStore {
32 32
 
33
-	/**
34
-	 * @return string the container or bucket name where objects are stored
35
-	 * @since 7.0.0
36
-	 */
37
-	public function getStorageId();
33
+    /**
34
+     * @return string the container or bucket name where objects are stored
35
+     * @since 7.0.0
36
+     */
37
+    public function getStorageId();
38 38
 
39
-	/**
40
-	 * @param string $urn the unified resource name used to identify the object
41
-	 * @return resource stream with the read data
42
-	 * @throws \Exception when something goes wrong, message will be logged
43
-	 * @since 7.0.0
44
-	 */
45
-	public function readObject($urn);
39
+    /**
40
+     * @param string $urn the unified resource name used to identify the object
41
+     * @return resource stream with the read data
42
+     * @throws \Exception when something goes wrong, message will be logged
43
+     * @since 7.0.0
44
+     */
45
+    public function readObject($urn);
46 46
 
47
-	/**
48
-	 * @param string $urn the unified resource name used to identify the object
49
-	 * @param resource $stream stream with the data to write
50
-	 * @throws \Exception when something goes wrong, message will be logged
51
-	 * @since 7.0.0
52
-	 */
53
-	public function writeObject($urn, $stream);
47
+    /**
48
+     * @param string $urn the unified resource name used to identify the object
49
+     * @param resource $stream stream with the data to write
50
+     * @throws \Exception when something goes wrong, message will be logged
51
+     * @since 7.0.0
52
+     */
53
+    public function writeObject($urn, $stream);
54 54
 
55
-	/**
56
-	 * @param string $urn the unified resource name used to identify the object
57
-	 * @return void
58
-	 * @throws \Exception when something goes wrong, message will be logged
59
-	 * @since 7.0.0
60
-	 */
61
-	public function deleteObject($urn);
55
+    /**
56
+     * @param string $urn the unified resource name used to identify the object
57
+     * @return void
58
+     * @throws \Exception when something goes wrong, message will be logged
59
+     * @since 7.0.0
60
+     */
61
+    public function deleteObject($urn);
62 62
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/Http/ICallbackResponse.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
33 33
  */
34 34
 interface ICallbackResponse {
35 35
 
36
-	/**
37
-	 * Outputs the content that should be printed
38
-	 *
39
-	 * @param IOutput $output a small wrapper that handles output
40
-	 * @since 8.1.0
41
-	 */
42
-	public function callback(IOutput $output);
36
+    /**
37
+     * Outputs the content that should be printed
38
+     *
39
+     * @param IOutput $output a small wrapper that handles output
40
+     * @since 8.1.0
41
+     */
42
+    public function callback(IOutput $output);
43 43
 
44 44
 }
Please login to merge, or discard this patch.
lib/public/Contacts/IManager.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -52,119 +52,119 @@
 block discarded – undo
52 52
  */
53 53
 interface IManager {
54 54
 
55
-	/**
56
-	 * This function is used to search and find contacts within the users address books.
57
-	 * In case $pattern is empty all contacts will be returned.
58
-	 *
59
-	 * Example:
60
-	 *  Following function shows how to search for contacts for the name and the email address.
61
-	 *
62
-	 *		public static function getMatchingRecipient($term) {
63
-	 *			$cm = \OC::$server->getContactsManager();
64
-	 *			// The API is not active -> nothing to do
65
-	 *			if (!$cm->isEnabled()) {
66
-	 *				return array();
67
-	 *			}
68
-	 *
69
-	 *			$result = $cm->search($term, array('FN', 'EMAIL'));
70
-	 *			$receivers = array();
71
-	 *			foreach ($result as $r) {
72
-	 *				$id = $r['id'];
73
-	 *				$fn = $r['FN'];
74
-	 *				$email = $r['EMAIL'];
75
-	 *				if (!is_array($email)) {
76
-	 *					$email = array($email);
77
-	 *				}
78
-	 *
79
-	 *				// loop through all email addresses of this contact
80
-	 *				foreach ($email as $e) {
81
-	 *				$displayName = $fn . " <$e>";
82
-	 *				$receivers[] = array(
83
-	 *					'id'    => $id,
84
-	 *					'label' => $displayName,
85
-	 *					'value' => $displayName);
86
-	 *				}
87
-	 *			}
88
-	 *
89
-	 *			return $receivers;
90
-	 *		}
91
-	 *
92
-	 *
93
-	 * @param string $pattern which should match within the $searchProperties
94
-	 * @param array $searchProperties defines the properties within the query pattern should match
95
-	 * @param array $options - for future use. One should always have options!
96
-	 * @return array an array of contacts which are arrays of key-value-pairs
97
-	 * @since 6.0.0
98
-	 */
99
-	public function search($pattern, $searchProperties = array(), $options = array());
55
+    /**
56
+     * This function is used to search and find contacts within the users address books.
57
+     * In case $pattern is empty all contacts will be returned.
58
+     *
59
+     * Example:
60
+     *  Following function shows how to search for contacts for the name and the email address.
61
+     *
62
+     *		public static function getMatchingRecipient($term) {
63
+     *			$cm = \OC::$server->getContactsManager();
64
+     *			// The API is not active -> nothing to do
65
+     *			if (!$cm->isEnabled()) {
66
+     *				return array();
67
+     *			}
68
+     *
69
+     *			$result = $cm->search($term, array('FN', 'EMAIL'));
70
+     *			$receivers = array();
71
+     *			foreach ($result as $r) {
72
+     *				$id = $r['id'];
73
+     *				$fn = $r['FN'];
74
+     *				$email = $r['EMAIL'];
75
+     *				if (!is_array($email)) {
76
+     *					$email = array($email);
77
+     *				}
78
+     *
79
+     *				// loop through all email addresses of this contact
80
+     *				foreach ($email as $e) {
81
+     *				$displayName = $fn . " <$e>";
82
+     *				$receivers[] = array(
83
+     *					'id'    => $id,
84
+     *					'label' => $displayName,
85
+     *					'value' => $displayName);
86
+     *				}
87
+     *			}
88
+     *
89
+     *			return $receivers;
90
+     *		}
91
+     *
92
+     *
93
+     * @param string $pattern which should match within the $searchProperties
94
+     * @param array $searchProperties defines the properties within the query pattern should match
95
+     * @param array $options - for future use. One should always have options!
96
+     * @return array an array of contacts which are arrays of key-value-pairs
97
+     * @since 6.0.0
98
+     */
99
+    public function search($pattern, $searchProperties = array(), $options = array());
100 100
 
101
-	/**
102
-	 * This function can be used to delete the contact identified by the given id
103
-	 *
104
-	 * @param object $id the unique identifier to a contact
105
-	 * @param string $address_book_key identifier of the address book in which the contact shall be deleted
106
-	 * @return bool successful or not
107
-	 * @since 6.0.0
108
-	 */
109
-	public function delete($id, $address_book_key);
101
+    /**
102
+     * This function can be used to delete the contact identified by the given id
103
+     *
104
+     * @param object $id the unique identifier to a contact
105
+     * @param string $address_book_key identifier of the address book in which the contact shall be deleted
106
+     * @return bool successful or not
107
+     * @since 6.0.0
108
+     */
109
+    public function delete($id, $address_book_key);
110 110
 
111
-	/**
112
-	 * This function is used to create a new contact if 'id' is not given or not present.
113
-	 * Otherwise the contact will be updated by replacing the entire data set.
114
-	 *
115
-	 * @param array $properties this array if key-value-pairs defines a contact
116
-	 * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
117
-	 * @return array an array representing the contact just created or updated
118
-	 * @since 6.0.0
119
-	 */
120
-	public function createOrUpdate($properties, $address_book_key);
111
+    /**
112
+     * This function is used to create a new contact if 'id' is not given or not present.
113
+     * Otherwise the contact will be updated by replacing the entire data set.
114
+     *
115
+     * @param array $properties this array if key-value-pairs defines a contact
116
+     * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
117
+     * @return array an array representing the contact just created or updated
118
+     * @since 6.0.0
119
+     */
120
+    public function createOrUpdate($properties, $address_book_key);
121 121
 
122
-	/**
123
-	 * Check if contacts are available (e.g. contacts app enabled)
124
-	 *
125
-	 * @return bool true if enabled, false if not
126
-	 * @since 6.0.0
127
-	 */
128
-	public function isEnabled();
122
+    /**
123
+     * Check if contacts are available (e.g. contacts app enabled)
124
+     *
125
+     * @return bool true if enabled, false if not
126
+     * @since 6.0.0
127
+     */
128
+    public function isEnabled();
129 129
 
130
-	/**
131
-	 * Registers an address book
132
-	 *
133
-	 * @param \OCP\IAddressBook $address_book
134
-	 * @return void
135
-	 * @since 6.0.0
136
-	 */
137
-	public function registerAddressBook(\OCP\IAddressBook $address_book);
130
+    /**
131
+     * Registers an address book
132
+     *
133
+     * @param \OCP\IAddressBook $address_book
134
+     * @return void
135
+     * @since 6.0.0
136
+     */
137
+    public function registerAddressBook(\OCP\IAddressBook $address_book);
138 138
 
139
-	/**
140
-	 * Unregisters an address book
141
-	 *
142
-	 * @param \OCP\IAddressBook $address_book
143
-	 * @return void
144
-	 * @since 6.0.0
145
-	 */
146
-	public function unregisterAddressBook(\OCP\IAddressBook $address_book);
139
+    /**
140
+     * Unregisters an address book
141
+     *
142
+     * @param \OCP\IAddressBook $address_book
143
+     * @return void
144
+     * @since 6.0.0
145
+     */
146
+    public function unregisterAddressBook(\OCP\IAddressBook $address_book);
147 147
 
148
-	/**
149
-	 * In order to improve lazy loading a closure can be registered which will be called in case
150
-	 * address books are actually requested
151
-	 *
152
-	 * @param \Closure $callable
153
-	 * @return void
154
-	 * @since 6.0.0
155
-	 */
156
-	public function register(\Closure $callable);
148
+    /**
149
+     * In order to improve lazy loading a closure can be registered which will be called in case
150
+     * address books are actually requested
151
+     *
152
+     * @param \Closure $callable
153
+     * @return void
154
+     * @since 6.0.0
155
+     */
156
+    public function register(\Closure $callable);
157 157
 
158
-	/**
159
-	 * @return array
160
-	 * @since 6.0.0
161
-	 */
162
-	public function getAddressBooks();
158
+    /**
159
+     * @return array
160
+     * @since 6.0.0
161
+     */
162
+    public function getAddressBooks();
163 163
 
164
-	/**
165
-	 * removes all registered address book instances
166
-	 * @return void
167
-	 * @since 6.0.0
168
-	 */
169
-	public function clear();
164
+    /**
165
+     * removes all registered address book instances
166
+     * @return void
167
+     * @since 6.0.0
168
+     */
169
+    public function clear();
170 170
 }
Please login to merge, or discard this patch.
lib/private/Archive/Archive.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -33,111 +33,111 @@
 block discarded – undo
33 33
 namespace OC\Archive;
34 34
 
35 35
 abstract class Archive {
36
-	/**
37
-	 * @param $source
38
-	 */
39
-	public abstract function __construct($source);
40
-	/**
41
-	 * add an empty folder to the archive
42
-	 * @param string $path
43
-	 * @return bool
44
-	 */
45
-	public abstract function addFolder($path);
46
-	/**
47
-	 * add a file to the archive
48
-	 * @param string $path
49
-	 * @param string $source either a local file or string data
50
-	 * @return bool
51
-	 */
52
-	public abstract function addFile($path, $source='');
53
-	/**
54
-	 * rename a file or folder in the archive
55
-	 * @param string $source
56
-	 * @param string $dest
57
-	 * @return bool
58
-	 */
59
-	public abstract function rename($source, $dest);
60
-	/**
61
-	 * get the uncompressed size of a file in the archive
62
-	 * @param string $path
63
-	 * @return int
64
-	 */
65
-	public abstract function filesize($path);
66
-	/**
67
-	 * get the last modified time of a file in the archive
68
-	 * @param string $path
69
-	 * @return int
70
-	 */
71
-	public abstract function mtime($path);
72
-	/**
73
-	 * get the files in a folder
74
-	 * @param string $path
75
-	 * @return array
76
-	 */
77
-	public abstract function getFolder($path);
78
-	/**
79
-	 * get all files in the archive
80
-	 * @return array
81
-	 */
82
-	public abstract function getFiles();
83
-	/**
84
-	 * get the content of a file
85
-	 * @param string $path
86
-	 * @return string
87
-	 */
88
-	public abstract function getFile($path);
89
-	/**
90
-	 * extract a single file from the archive
91
-	 * @param string $path
92
-	 * @param string $dest
93
-	 * @return bool
94
-	 */
95
-	public abstract function extractFile($path, $dest);
96
-	/**
97
-	 * extract the archive
98
-	 * @param string $dest
99
-	 * @return bool
100
-	 */
101
-	public abstract function extract($dest);
102
-	/**
103
-	 * check if a file or folder exists in the archive
104
-	 * @param string $path
105
-	 * @return bool
106
-	 */
107
-	public abstract function fileExists($path);
108
-	/**
109
-	 * remove a file or folder from the archive
110
-	 * @param string $path
111
-	 * @return bool
112
-	 */
113
-	public abstract function remove($path);
114
-	/**
115
-	 * get a file handler
116
-	 * @param string $path
117
-	 * @param string $mode
118
-	 * @return resource
119
-	 */
120
-	public abstract function getStream($path, $mode);
121
-	/**
122
-	 * add a folder and all its content
123
-	 * @param string $path
124
-	 * @param string $source
125
-	 * @return boolean|null
126
-	 */
127
-	public function addRecursive($path, $source) {
128
-		$dh = opendir($source);
129
-		if(is_resource($dh)) {
130
-			$this->addFolder($path);
131
-			while (($file = readdir($dh)) !== false) {
132
-				if($file === '.' || $file === '..') {
133
-					continue;
134
-				}
135
-				if(is_dir($source.'/'.$file)) {
136
-					$this->addRecursive($path.'/'.$file, $source.'/'.$file);
137
-				}else{
138
-					$this->addFile($path.'/'.$file, $source.'/'.$file);
139
-				}
140
-			}
141
-		}
142
-	}
36
+    /**
37
+     * @param $source
38
+     */
39
+    public abstract function __construct($source);
40
+    /**
41
+     * add an empty folder to the archive
42
+     * @param string $path
43
+     * @return bool
44
+     */
45
+    public abstract function addFolder($path);
46
+    /**
47
+     * add a file to the archive
48
+     * @param string $path
49
+     * @param string $source either a local file or string data
50
+     * @return bool
51
+     */
52
+    public abstract function addFile($path, $source='');
53
+    /**
54
+     * rename a file or folder in the archive
55
+     * @param string $source
56
+     * @param string $dest
57
+     * @return bool
58
+     */
59
+    public abstract function rename($source, $dest);
60
+    /**
61
+     * get the uncompressed size of a file in the archive
62
+     * @param string $path
63
+     * @return int
64
+     */
65
+    public abstract function filesize($path);
66
+    /**
67
+     * get the last modified time of a file in the archive
68
+     * @param string $path
69
+     * @return int
70
+     */
71
+    public abstract function mtime($path);
72
+    /**
73
+     * get the files in a folder
74
+     * @param string $path
75
+     * @return array
76
+     */
77
+    public abstract function getFolder($path);
78
+    /**
79
+     * get all files in the archive
80
+     * @return array
81
+     */
82
+    public abstract function getFiles();
83
+    /**
84
+     * get the content of a file
85
+     * @param string $path
86
+     * @return string
87
+     */
88
+    public abstract function getFile($path);
89
+    /**
90
+     * extract a single file from the archive
91
+     * @param string $path
92
+     * @param string $dest
93
+     * @return bool
94
+     */
95
+    public abstract function extractFile($path, $dest);
96
+    /**
97
+     * extract the archive
98
+     * @param string $dest
99
+     * @return bool
100
+     */
101
+    public abstract function extract($dest);
102
+    /**
103
+     * check if a file or folder exists in the archive
104
+     * @param string $path
105
+     * @return bool
106
+     */
107
+    public abstract function fileExists($path);
108
+    /**
109
+     * remove a file or folder from the archive
110
+     * @param string $path
111
+     * @return bool
112
+     */
113
+    public abstract function remove($path);
114
+    /**
115
+     * get a file handler
116
+     * @param string $path
117
+     * @param string $mode
118
+     * @return resource
119
+     */
120
+    public abstract function getStream($path, $mode);
121
+    /**
122
+     * add a folder and all its content
123
+     * @param string $path
124
+     * @param string $source
125
+     * @return boolean|null
126
+     */
127
+    public function addRecursive($path, $source) {
128
+        $dh = opendir($source);
129
+        if(is_resource($dh)) {
130
+            $this->addFolder($path);
131
+            while (($file = readdir($dh)) !== false) {
132
+                if($file === '.' || $file === '..') {
133
+                    continue;
134
+                }
135
+                if(is_dir($source.'/'.$file)) {
136
+                    $this->addRecursive($path.'/'.$file, $source.'/'.$file);
137
+                }else{
138
+                    $this->addFile($path.'/'.$file, $source.'/'.$file);
139
+                }
140
+            }
141
+        }
142
+    }
143 143
 }
Please login to merge, or discard this patch.
lib/private/Search/Provider/File.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -32,45 +32,45 @@
 block discarded – undo
32 32
  */
33 33
 class File extends \OCP\Search\Provider {
34 34
 
35
-	/**
36
-	 * Search for files and folders matching the given query
37
-	 * @param string $query
38
-	 * @return \OCP\Search\Result
39
-	 */
40
-	public function search($query) {
41
-		$files = Filesystem::search($query);
42
-		$results = array();
43
-		// edit results
44
-		foreach ($files as $fileData) {
45
-			// skip versions
46
-			if (strpos($fileData['path'], '_versions') === 0) {
47
-				continue;
48
-			}
49
-			// skip top-level folder
50
-			if ($fileData['name'] === 'files' && $fileData['parent'] === -1) {
51
-				continue;
52
-			}
53
-			// create audio result
54
-			if($fileData['mimepart'] === 'audio'){
55
-				$result = new \OC\Search\Result\Audio($fileData);
56
-			}
57
-			// create image result
58
-			elseif($fileData['mimepart'] === 'image'){
59
-				$result = new \OC\Search\Result\Image($fileData);
60
-			}
61
-			// create folder result
62
-			elseif($fileData['mimetype'] === 'httpd/unix-directory'){
63
-				$result = new \OC\Search\Result\Folder($fileData);
64
-			}
65
-			// or create file result
66
-			else{
67
-				$result = new \OC\Search\Result\File($fileData);
68
-			}
69
-			// add to results
70
-			$results[] = $result;
71
-		}
72
-		// return
73
-		return $results;
74
-	}
35
+    /**
36
+     * Search for files and folders matching the given query
37
+     * @param string $query
38
+     * @return \OCP\Search\Result
39
+     */
40
+    public function search($query) {
41
+        $files = Filesystem::search($query);
42
+        $results = array();
43
+        // edit results
44
+        foreach ($files as $fileData) {
45
+            // skip versions
46
+            if (strpos($fileData['path'], '_versions') === 0) {
47
+                continue;
48
+            }
49
+            // skip top-level folder
50
+            if ($fileData['name'] === 'files' && $fileData['parent'] === -1) {
51
+                continue;
52
+            }
53
+            // create audio result
54
+            if($fileData['mimepart'] === 'audio'){
55
+                $result = new \OC\Search\Result\Audio($fileData);
56
+            }
57
+            // create image result
58
+            elseif($fileData['mimepart'] === 'image'){
59
+                $result = new \OC\Search\Result\Image($fileData);
60
+            }
61
+            // create folder result
62
+            elseif($fileData['mimetype'] === 'httpd/unix-directory'){
63
+                $result = new \OC\Search\Result\Folder($fileData);
64
+            }
65
+            // or create file result
66
+            else{
67
+                $result = new \OC\Search\Result\File($fileData);
68
+            }
69
+            // add to results
70
+            $results[] = $result;
71
+        }
72
+        // return
73
+        return $results;
74
+    }
75 75
 	
76 76
 }
Please login to merge, or discard this patch.