@@ -51,8 +51,8 @@ |
||
51 | 51 | } |
52 | 52 | if ($entry && $entry['mimetype'] === 'httpd/unix-directory') { |
53 | 53 | $id = $entry['fileid']; |
54 | - $sql = 'SELECT SUM(`size`) AS f1 ' . |
|
55 | - 'FROM `*PREFIX*filecache` ' . |
|
54 | + $sql = 'SELECT SUM(`size`) AS f1 '. |
|
55 | + 'FROM `*PREFIX*filecache` '. |
|
56 | 56 | 'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0'; |
57 | 57 | $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); |
58 | 58 | if ($row = $result->fetchRow()) { |
@@ -67,7 +67,7 @@ |
||
67 | 67 | if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) { |
68 | 68 | $folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId()); |
69 | 69 | foreach ($folderContent as $subEntry) { |
70 | - $subTargetPath = $targetPath . '/' . $subEntry->getName(); |
|
70 | + $subTargetPath = $targetPath.'/'.$subEntry->getName(); |
|
71 | 71 | $this->copyFromCache($sourceCache, $subEntry, $subTargetPath); |
72 | 72 | } |
73 | 73 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | $query = $this->connection->prepare('SELECT `lock` from `*PREFIX*file_locks` WHERE `key` = ?'); |
138 | 138 | $query->execute([$path]); |
139 | - $lockValue = (int)$query->fetchColumn(); |
|
139 | + $lockValue = (int) $query->fetchColumn(); |
|
140 | 140 | if ($type === self::LOCK_SHARED) { |
141 | 141 | if ($this->isLocallyLocked($path)) { |
142 | 142 | // if we have a shared lock we kept open locally but it's released we always have at least 1 shared lock in the db |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | // since we keep shared locks we need to manually clean those |
263 | 263 | $lockedPaths = array_keys($this->sharedLocks); |
264 | - $lockedPaths = array_filter($lockedPaths, function ($path) { |
|
264 | + $lockedPaths = array_filter($lockedPaths, function($path) { |
|
265 | 265 | return $this->sharedLocks[$path]; |
266 | 266 | }); |
267 | 267 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * because the database connection was created with an uninitialized config |
88 | 88 | */ |
89 | 89 | private function fixDIInit() { |
90 | - if($this->connection === null) { |
|
90 | + if ($this->connection === null) { |
|
91 | 91 | $this->connection = \OC::$server->getDatabaseConnection(); |
92 | 92 | } |
93 | 93 | } |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | $prevValue = $this->getUserValue($userId, $appName, $key, null); |
219 | 219 | |
220 | 220 | if ($prevValue !== null) { |
221 | - if ($prevValue === (string)$value) { |
|
221 | + if ($prevValue === (string) $value) { |
|
222 | 222 | return; |
223 | - } else if ($preCondition !== null && $prevValue !== (string)$preCondition) { |
|
223 | + } else if ($preCondition !== null && $prevValue !== (string) $preCondition) { |
|
224 | 224 | throw new PreConditionNotMetException(); |
225 | 225 | } else { |
226 | 226 | $qb = $this->connection->getQueryBuilder(); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // TODO - FIXME |
306 | 306 | $this->fixDIInit(); |
307 | 307 | |
308 | - $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
308 | + $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
309 | 309 | 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'; |
310 | 310 | $this->connection->executeUpdate($sql, array($userId, $appName, $key)); |
311 | 311 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | // TODO - FIXME |
324 | 324 | $this->fixDIInit(); |
325 | 325 | |
326 | - $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
326 | + $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
327 | 327 | 'WHERE `userid` = ?'; |
328 | 328 | $this->connection->executeUpdate($sql, array($userId)); |
329 | 329 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | // TODO - FIXME |
340 | 340 | $this->fixDIInit(); |
341 | 341 | |
342 | - $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
342 | + $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
343 | 343 | 'WHERE `appid` = ?'; |
344 | 344 | $this->connection->executeUpdate($sql, array($appName)); |
345 | 345 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return $this->userCache[$userId]; |
363 | 363 | } |
364 | 364 | if ($userId === null || $userId === '') { |
365 | - $this->userCache[$userId]=array(); |
|
365 | + $this->userCache[$userId] = array(); |
|
366 | 366 | return $this->userCache[$userId]; |
367 | 367 | } |
368 | 368 | |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | array_unshift($queryParams, $key); |
410 | 410 | array_unshift($queryParams, $appName); |
411 | 411 | |
412 | - $placeholders = (sizeof($chunk) == 50) ? $placeholders50 : implode(',', array_fill(0, sizeof($chunk), '?')); |
|
412 | + $placeholders = (sizeof($chunk) == 50) ? $placeholders50 : implode(',', array_fill(0, sizeof($chunk), '?')); |
|
413 | 413 | |
414 | - $query = 'SELECT `userid`, `configvalue` ' . |
|
415 | - 'FROM `*PREFIX*preferences` ' . |
|
416 | - 'WHERE `appid` = ? AND `configkey` = ? ' . |
|
417 | - 'AND `userid` IN (' . $placeholders . ')'; |
|
414 | + $query = 'SELECT `userid`, `configvalue` '. |
|
415 | + 'FROM `*PREFIX*preferences` '. |
|
416 | + 'WHERE `appid` = ? AND `configkey` = ? '. |
|
417 | + 'AND `userid` IN ('.$placeholders.')'; |
|
418 | 418 | $result = $this->connection->executeQuery($query, $queryParams); |
419 | 419 | |
420 | 420 | while ($row = $result->fetch()) { |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | // TODO - FIXME |
438 | 438 | $this->fixDIInit(); |
439 | 439 | |
440 | - $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . |
|
440 | + $sql = 'SELECT `userid` FROM `*PREFIX*preferences` '. |
|
441 | 441 | 'WHERE `appid` = ? AND `configkey` = ? '; |
442 | 442 | |
443 | - if($this->getSystemValue('dbtype', 'sqlite') === 'oci') { |
|
443 | + if ($this->getSystemValue('dbtype', 'sqlite') === 'oci') { |
|
444 | 444 | //oracle hack: need to explicitly cast CLOB to CHAR for comparison |
445 | 445 | $sql .= 'AND to_char(`configvalue`) = ?'; |
446 | 446 | } else { |
@@ -31,8 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function get($file) { |
34 | - return $file !== '' ? null : |
|
35 | - new CacheEntry([ |
|
34 | + return $file !== '' ? null : new CacheEntry([ |
|
36 | 35 | 'fileid' => -1, |
37 | 36 | 'parent' => -1, |
38 | 37 | 'name' => '', |
@@ -51,19 +51,19 @@ |
||
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | // create audio result |
54 | - if($fileData['mimepart'] === 'audio'){ |
|
54 | + if ($fileData['mimepart'] === 'audio') { |
|
55 | 55 | $result = new \OC\Search\Result\Audio($fileData); |
56 | 56 | } |
57 | 57 | // create image result |
58 | - elseif($fileData['mimepart'] === 'image'){ |
|
58 | + elseif ($fileData['mimepart'] === 'image') { |
|
59 | 59 | $result = new \OC\Search\Result\Image($fileData); |
60 | 60 | } |
61 | 61 | // create folder result |
62 | - elseif($fileData['mimetype'] === 'httpd/unix-directory'){ |
|
62 | + elseif ($fileData['mimetype'] === 'httpd/unix-directory') { |
|
63 | 63 | $result = new \OC\Search\Result\Folder($fileData); |
64 | 64 | } |
65 | 65 | // or create file result |
66 | - else{ |
|
66 | + else { |
|
67 | 67 | $result = new \OC\Search\Result\File($fileData); |
68 | 68 | } |
69 | 69 | // add to results |
@@ -105,7 +105,7 @@ |
||
105 | 105 | * @param string $path |
106 | 106 | * @return string relative path |
107 | 107 | */ |
108 | - protected function getRelativePath ($path) { |
|
108 | + protected function getRelativePath($path) { |
|
109 | 109 | if (!isset(self::$userFolderCache)) { |
110 | 110 | $user = \OC::$server->getUserSession()->getUser()->getUID(); |
111 | 111 | self::$userFolderCache = \OC::$server->getUserFolder($user); |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | * @throws QueryException if the class could not be found or instantiated |
90 | 90 | */ |
91 | 91 | public function resolve($name) { |
92 | - $baseMsg = 'Could not resolve ' . $name . '!'; |
|
92 | + $baseMsg = 'Could not resolve '.$name.'!'; |
|
93 | 93 | try { |
94 | 94 | $class = new ReflectionClass($name); |
95 | 95 | if ($class->isInstantiable()) { |
96 | 96 | return $this->buildClass($class); |
97 | 97 | } else { |
98 | - throw new QueryException($baseMsg . |
|
98 | + throw new QueryException($baseMsg. |
|
99 | 99 | ' Class can not be instantiated'); |
100 | 100 | } |
101 | - } catch(ReflectionException $e) { |
|
102 | - throw new QueryException($baseMsg . ' ' . $e->getMessage()); |
|
101 | + } catch (ReflectionException $e) { |
|
102 | + throw new QueryException($baseMsg.' '.$e->getMessage()); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return $this->offsetGet($name); |
116 | 116 | } else { |
117 | 117 | $object = $this->resolve($name); |
118 | - $this->registerService($name, function () use ($object) { |
|
118 | + $this->registerService($name, function() use ($object) { |
|
119 | 119 | return $object; |
120 | 120 | }); |
121 | 121 | return $object; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function registerService($name, Closure $closure, $shared = true) { |
143 | 143 | $name = $this->sanitizeName($name); |
144 | - if (isset($this[$name])) { |
|
144 | + if (isset($this[$name])) { |
|
145 | 145 | unset($this[$name]); |
146 | 146 | } |
147 | 147 | if ($shared) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param string $target the target that should be resolved instead |
160 | 160 | */ |
161 | 161 | public function registerAlias($alias, $target) { |
162 | - $this->registerService($alias, function (IContainer $container) use ($target) { |
|
162 | + $this->registerService($alias, function(IContainer $container) use ($target) { |
|
163 | 163 | return $container->query($target); |
164 | 164 | }, false); |
165 | 165 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * class and add your methods |
39 | 39 | * @deprecated |
40 | 40 | */ |
41 | -class API implements IApi{ |
|
41 | +class API implements IApi { |
|
42 | 42 | |
43 | 43 | private $appName; |
44 | 44 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * constructor |
47 | 47 | * @param string $appName the name of your application |
48 | 48 | */ |
49 | - public function __construct($appName){ |
|
49 | + public function __construct($appName) { |
|
50 | 50 | $this->appName = $appName; |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @return string the user id of the current user |
57 | 57 | * @deprecated Use \OC::$server->getUserSession()->getUser()->getUID() |
58 | 58 | */ |
59 | - public function getUserId(){ |
|
59 | + public function getUserId() { |
|
60 | 60 | return \OCP\User::getUser(); |
61 | 61 | } |
62 | 62 | |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | * @param string $scriptName the name of the javascript in js/ without the suffix |
68 | 68 | * @param string $appName the name of the app, defaults to the current one |
69 | 69 | */ |
70 | - public function addScript($scriptName, $appName=null){ |
|
71 | - if($appName === null){ |
|
70 | + public function addScript($scriptName, $appName = null) { |
|
71 | + if ($appName === null) { |
|
72 | 72 | $appName = $this->appName; |
73 | 73 | } |
74 | 74 | \OCP\Util::addScript($appName, $scriptName); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @param string $styleName the name of the css file in css/without the suffix |
82 | 82 | * @param string $appName the name of the app, defaults to the current one |
83 | 83 | */ |
84 | - public function addStyle($styleName, $appName=null){ |
|
85 | - if($appName === null){ |
|
84 | + public function addStyle($styleName, $appName = null) { |
|
85 | + if ($appName === null) { |
|
86 | 86 | $appName = $this->appName; |
87 | 87 | } |
88 | 88 | \OCP\Util::addStyle($appName, $styleName); |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * shorthand for addScript for files in the 3rdparty directory |
95 | 95 | * @param string $name the name of the file without the suffix |
96 | 96 | */ |
97 | - public function add3rdPartyScript($name){ |
|
98 | - \OCP\Util::addScript($this->appName . '/3rdparty', $name); |
|
97 | + public function add3rdPartyScript($name) { |
|
98 | + \OCP\Util::addScript($this->appName.'/3rdparty', $name); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * shorthand for addStyle for files in the 3rdparty directory |
105 | 105 | * @param string $name the name of the file without the suffix |
106 | 106 | */ |
107 | - public function add3rdPartyStyle($name){ |
|
108 | - \OCP\Util::addStyle($this->appName . '/3rdparty', $name); |
|
107 | + public function add3rdPartyStyle($name) { |
|
108 | + \OCP\Util::addStyle($this->appName.'/3rdparty', $name); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string $appName the name of an app |
118 | 118 | * @return bool true if app is enabled |
119 | 119 | */ |
120 | - public function isAppEnabled($appName){ |
|
120 | + public function isAppEnabled($appName) { |
|
121 | 121 | return \OCP\App::isEnabled($appName); |
122 | 122 | } |
123 | 123 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return \OCP\IEventSource a new open EventSource class |
128 | 128 | * @deprecated Use \OC::$server->createEventSource(); |
129 | 129 | */ |
130 | - public function openEventSource(){ |
|
130 | + public function openEventSource() { |
|
131 | 131 | return \OC::$server->createEventSource(); |
132 | 132 | } |
133 | 133 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param string $signalClass |
165 | 165 | * @param string $signalName |
166 | 166 | */ |
167 | - public function clearHook($signalClass=false, $signalName=false) { |
|
167 | + public function clearHook($signalClass = false, $signalName = false) { |
|
168 | 168 | if ($signalClass) { |
169 | 169 | \OC_Hook::clear($signalClass, $signalName); |
170 | 170 | } |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * suffix, relative to your apps directory! not the template directory |
177 | 177 | * @param string $appName the name of the app, defaults to the current one |
178 | 178 | */ |
179 | - public function registerAdmin($mainPath, $appName=null) { |
|
180 | - if($appName === null){ |
|
179 | + public function registerAdmin($mainPath, $appName = null) { |
|
180 | + if ($appName === null) { |
|
181 | 181 | $appName = $this->appName; |
182 | 182 | } |
183 | 183 |