@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | private function setupAdminSection($sectionClassName) { |
144 | 144 | if (!class_exists($sectionClassName)) { |
145 | - $this->log->debug('Could not find admin section class ' . $sectionClassName); |
|
145 | + $this->log->debug('Could not find admin section class '.$sectionClassName); |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 | try { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | private function setupAdminSettings($settingsClassName) { |
226 | 226 | if (!class_exists($settingsClassName)) { |
227 | - $this->log->debug('Could not find admin section class ' . $settingsClassName); |
|
227 | + $this->log->debug('Could not find admin section class '.$settingsClassName); |
|
228 | 228 | return; |
229 | 229 | } |
230 | 230 |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | parent::__construct(); |
120 | 120 | $this->webRoot = $webRoot; |
121 | 121 | |
122 | - $this->registerService('ContactsManager', function ($c) { |
|
122 | + $this->registerService('ContactsManager', function($c) { |
|
123 | 123 | return new ContactsManager(); |
124 | 124 | }); |
125 | 125 | |
126 | - $this->registerService('PreviewManager', function (Server $c) { |
|
126 | + $this->registerService('PreviewManager', function(Server $c) { |
|
127 | 127 | return new PreviewManager( |
128 | 128 | $c->getConfig(), |
129 | 129 | $c->getRootFolder(), |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | ); |
134 | 134 | }); |
135 | 135 | |
136 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
136 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
137 | 137 | return new \OC\Preview\Watcher( |
138 | 138 | $c->getAppDataDir('preview') |
139 | 139 | ); |
140 | 140 | }); |
141 | 141 | |
142 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
142 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
143 | 143 | $view = new View(); |
144 | 144 | $util = new Encryption\Util( |
145 | 145 | $view, |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ); |
158 | 158 | }); |
159 | 159 | |
160 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
160 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
161 | 161 | $util = new Encryption\Util( |
162 | 162 | new View(), |
163 | 163 | $c->getUserManager(), |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return new Encryption\File($util); |
168 | 168 | }); |
169 | 169 | |
170 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
170 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
171 | 171 | $view = new View(); |
172 | 172 | $util = new Encryption\Util( |
173 | 173 | $view, |
@@ -178,27 +178,27 @@ discard block |
||
178 | 178 | |
179 | 179 | return new Encryption\Keys\Storage($view, $util); |
180 | 180 | }); |
181 | - $this->registerService('TagMapper', function (Server $c) { |
|
181 | + $this->registerService('TagMapper', function(Server $c) { |
|
182 | 182 | return new TagMapper($c->getDatabaseConnection()); |
183 | 183 | }); |
184 | - $this->registerService('TagManager', function (Server $c) { |
|
184 | + $this->registerService('TagManager', function(Server $c) { |
|
185 | 185 | $tagMapper = $c->query('TagMapper'); |
186 | 186 | return new TagManager($tagMapper, $c->getUserSession()); |
187 | 187 | }); |
188 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
188 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
189 | 189 | $config = $c->getConfig(); |
190 | 190 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
191 | 191 | /** @var \OC\SystemTag\ManagerFactory $factory */ |
192 | 192 | $factory = new $factoryClass($this); |
193 | 193 | return $factory; |
194 | 194 | }); |
195 | - $this->registerService('SystemTagManager', function (Server $c) { |
|
195 | + $this->registerService('SystemTagManager', function(Server $c) { |
|
196 | 196 | return $c->query('SystemTagManagerFactory')->getManager(); |
197 | 197 | }); |
198 | - $this->registerService('SystemTagObjectMapper', function (Server $c) { |
|
198 | + $this->registerService('SystemTagObjectMapper', function(Server $c) { |
|
199 | 199 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
200 | 200 | }); |
201 | - $this->registerService('RootFolder', function (Server $c) { |
|
201 | + $this->registerService('RootFolder', function(Server $c) { |
|
202 | 202 | $manager = \OC\Files\Filesystem::getMountManager(null); |
203 | 203 | $view = new View(); |
204 | 204 | $root = new Root( |
@@ -222,28 +222,28 @@ discard block |
||
222 | 222 | return $c->query('RootFolder'); |
223 | 223 | }); |
224 | 224 | }); |
225 | - $this->registerService('UserManager', function (Server $c) { |
|
225 | + $this->registerService('UserManager', function(Server $c) { |
|
226 | 226 | $config = $c->getConfig(); |
227 | 227 | return new \OC\User\Manager($config); |
228 | 228 | }); |
229 | - $this->registerService('GroupManager', function (Server $c) { |
|
229 | + $this->registerService('GroupManager', function(Server $c) { |
|
230 | 230 | $groupManager = new \OC\Group\Manager($this->getUserManager()); |
231 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
231 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
232 | 232 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
233 | 233 | }); |
234 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
234 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
235 | 235 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
236 | 236 | }); |
237 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
237 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
238 | 238 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
239 | 239 | }); |
240 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
240 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
241 | 241 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
242 | 242 | }); |
243 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
243 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
244 | 244 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
245 | 245 | }); |
246 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
246 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
247 | 247 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
248 | 248 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
249 | 249 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | return new Store($session, $logger, $tokenProvider); |
262 | 262 | }); |
263 | 263 | $this->registerAlias(IStore::class, Store::class); |
264 | - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
264 | + $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) { |
|
265 | 265 | $dbConnection = $c->getDatabaseConnection(); |
266 | 266 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
267 | 267 | }); |
268 | - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
268 | + $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) { |
|
269 | 269 | $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
270 | 270 | $crypto = $c->getCrypto(); |
271 | 271 | $config = $c->getConfig(); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory); |
275 | 275 | }); |
276 | 276 | $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
277 | - $this->registerService('UserSession', function (Server $c) { |
|
277 | + $this->registerService('UserSession', function(Server $c) { |
|
278 | 278 | $manager = $c->getUserManager(); |
279 | 279 | $session = new \OC\Session\Memory(''); |
280 | 280 | $timeFactory = new TimeFactory(); |
@@ -287,69 +287,69 @@ discard block |
||
287 | 287 | } |
288 | 288 | |
289 | 289 | $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom()); |
290 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
290 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
291 | 291 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
292 | 292 | }); |
293 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
293 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
294 | 294 | /** @var $user \OC\User\User */ |
295 | 295 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
296 | 296 | }); |
297 | - $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
297 | + $userSession->listen('\OC\User', 'preDelete', function($user) { |
|
298 | 298 | /** @var $user \OC\User\User */ |
299 | 299 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
300 | 300 | }); |
301 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
301 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
302 | 302 | /** @var $user \OC\User\User */ |
303 | 303 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
304 | 304 | }); |
305 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
305 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
306 | 306 | /** @var $user \OC\User\User */ |
307 | 307 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
308 | 308 | }); |
309 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
309 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
310 | 310 | /** @var $user \OC\User\User */ |
311 | 311 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
312 | 312 | }); |
313 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
313 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
314 | 314 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
315 | 315 | }); |
316 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
316 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
317 | 317 | /** @var $user \OC\User\User */ |
318 | 318 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
319 | 319 | }); |
320 | - $userSession->listen('\OC\User', 'logout', function () { |
|
320 | + $userSession->listen('\OC\User', 'logout', function() { |
|
321 | 321 | \OC_Hook::emit('OC_User', 'logout', array()); |
322 | 322 | }); |
323 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) { |
|
323 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value) { |
|
324 | 324 | /** @var $user \OC\User\User */ |
325 | 325 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value)); |
326 | 326 | }); |
327 | 327 | return $userSession; |
328 | 328 | }); |
329 | 329 | |
330 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
330 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) { |
|
331 | 331 | return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger()); |
332 | 332 | }); |
333 | 333 | |
334 | - $this->registerService('NavigationManager', function (Server $c) { |
|
334 | + $this->registerService('NavigationManager', function(Server $c) { |
|
335 | 335 | return new \OC\NavigationManager($c->getAppManager(), |
336 | 336 | $c->getURLGenerator(), |
337 | 337 | $c->getL10NFactory(), |
338 | 338 | $c->getUserSession(), |
339 | 339 | $c->getGroupManager()); |
340 | 340 | }); |
341 | - $this->registerService('AllConfig', function (Server $c) { |
|
341 | + $this->registerService('AllConfig', function(Server $c) { |
|
342 | 342 | return new \OC\AllConfig( |
343 | 343 | $c->getSystemConfig() |
344 | 344 | ); |
345 | 345 | }); |
346 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
346 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
347 | 347 | return new \OC\SystemConfig($config); |
348 | 348 | }); |
349 | - $this->registerService('AppConfig', function (Server $c) { |
|
349 | + $this->registerService('AppConfig', function(Server $c) { |
|
350 | 350 | return new \OC\AppConfig($c->getDatabaseConnection()); |
351 | 351 | }); |
352 | - $this->registerService('L10NFactory', function (Server $c) { |
|
352 | + $this->registerService('L10NFactory', function(Server $c) { |
|
353 | 353 | return new \OC\L10N\Factory( |
354 | 354 | $c->getConfig(), |
355 | 355 | $c->getRequest(), |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | \OC::$SERVERROOT |
358 | 358 | ); |
359 | 359 | }); |
360 | - $this->registerService('URLGenerator', function (Server $c) { |
|
360 | + $this->registerService('URLGenerator', function(Server $c) { |
|
361 | 361 | $config = $c->getConfig(); |
362 | 362 | $cacheFactory = $c->getMemCacheFactory(); |
363 | 363 | return new \OC\URLGenerator( |
@@ -365,10 +365,10 @@ discard block |
||
365 | 365 | $cacheFactory |
366 | 366 | ); |
367 | 367 | }); |
368 | - $this->registerService('AppHelper', function ($c) { |
|
368 | + $this->registerService('AppHelper', function($c) { |
|
369 | 369 | return new \OC\AppHelper(); |
370 | 370 | }); |
371 | - $this->registerService('AppFetcher', function ($c) { |
|
371 | + $this->registerService('AppFetcher', function($c) { |
|
372 | 372 | return new AppFetcher( |
373 | 373 | $this->getAppDataDir('appstore'), |
374 | 374 | $this->getHTTPClientService(), |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $this->getConfig() |
377 | 377 | ); |
378 | 378 | }); |
379 | - $this->registerService('CategoryFetcher', function ($c) { |
|
379 | + $this->registerService('CategoryFetcher', function($c) { |
|
380 | 380 | return new CategoryFetcher( |
381 | 381 | $this->getAppDataDir('appstore'), |
382 | 382 | $this->getHTTPClientService(), |
@@ -384,19 +384,19 @@ discard block |
||
384 | 384 | $this->getConfig() |
385 | 385 | ); |
386 | 386 | }); |
387 | - $this->registerService('UserCache', function ($c) { |
|
387 | + $this->registerService('UserCache', function($c) { |
|
388 | 388 | return new Cache\File(); |
389 | 389 | }); |
390 | - $this->registerService('MemCacheFactory', function (Server $c) { |
|
390 | + $this->registerService('MemCacheFactory', function(Server $c) { |
|
391 | 391 | $config = $c->getConfig(); |
392 | 392 | |
393 | 393 | if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
394 | 394 | $v = \OC_App::getAppVersions(); |
395 | - $v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php')); |
|
395 | + $v['core'] = md5(file_get_contents(\OC::$SERVERROOT.'/version.php')); |
|
396 | 396 | $version = implode(',', $v); |
397 | 397 | $instanceId = \OC_Util::getInstanceId(); |
398 | 398 | $path = \OC::$SERVERROOT; |
399 | - $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . \OC::$WEBROOT); |
|
399 | + $prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.\OC::$WEBROOT); |
|
400 | 400 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
401 | 401 | $config->getSystemValue('memcache.local', null), |
402 | 402 | $config->getSystemValue('memcache.distributed', null), |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | '\\OC\\Memcache\\ArrayCache' |
411 | 411 | ); |
412 | 412 | }); |
413 | - $this->registerService('RedisFactory', function (Server $c) { |
|
413 | + $this->registerService('RedisFactory', function(Server $c) { |
|
414 | 414 | $systemConfig = $c->getSystemConfig(); |
415 | 415 | return new RedisFactory($systemConfig); |
416 | 416 | }); |
417 | - $this->registerService('ActivityManager', function (Server $c) { |
|
417 | + $this->registerService('ActivityManager', function(Server $c) { |
|
418 | 418 | return new \OC\Activity\Manager( |
419 | 419 | $c->getRequest(), |
420 | 420 | $c->getUserSession(), |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | $c->query(IValidator::class) |
423 | 423 | ); |
424 | 424 | }); |
425 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
425 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
426 | 426 | return new \OC\Activity\EventMerger( |
427 | 427 | $c->getL10N('lib') |
428 | 428 | ); |
429 | 429 | }); |
430 | 430 | $this->registerAlias(IValidator::class, Validator::class); |
431 | - $this->registerService('AvatarManager', function (Server $c) { |
|
431 | + $this->registerService('AvatarManager', function(Server $c) { |
|
432 | 432 | return new AvatarManager( |
433 | 433 | $c->getUserManager(), |
434 | 434 | $c->getAppDataDir('avatar'), |
@@ -437,14 +437,14 @@ discard block |
||
437 | 437 | $c->getConfig() |
438 | 438 | ); |
439 | 439 | }); |
440 | - $this->registerService('Logger', function (Server $c) { |
|
440 | + $this->registerService('Logger', function(Server $c) { |
|
441 | 441 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
442 | 442 | $logger = Log::getLogClass($logType); |
443 | 443 | call_user_func(array($logger, 'init')); |
444 | 444 | |
445 | 445 | return new Log($logger); |
446 | 446 | }); |
447 | - $this->registerService('JobList', function (Server $c) { |
|
447 | + $this->registerService('JobList', function(Server $c) { |
|
448 | 448 | $config = $c->getConfig(); |
449 | 449 | return new \OC\BackgroundJob\JobList( |
450 | 450 | $c->getDatabaseConnection(), |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | new TimeFactory() |
453 | 453 | ); |
454 | 454 | }); |
455 | - $this->registerService('Router', function (Server $c) { |
|
455 | + $this->registerService('Router', function(Server $c) { |
|
456 | 456 | $cacheFactory = $c->getMemCacheFactory(); |
457 | 457 | $logger = $c->getLogger(); |
458 | 458 | if ($cacheFactory->isAvailable()) { |
@@ -462,22 +462,22 @@ discard block |
||
462 | 462 | } |
463 | 463 | return $router; |
464 | 464 | }); |
465 | - $this->registerService('Search', function ($c) { |
|
465 | + $this->registerService('Search', function($c) { |
|
466 | 466 | return new Search(); |
467 | 467 | }); |
468 | - $this->registerService('SecureRandom', function ($c) { |
|
468 | + $this->registerService('SecureRandom', function($c) { |
|
469 | 469 | return new SecureRandom(); |
470 | 470 | }); |
471 | - $this->registerService('Crypto', function (Server $c) { |
|
471 | + $this->registerService('Crypto', function(Server $c) { |
|
472 | 472 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
473 | 473 | }); |
474 | - $this->registerService('Hasher', function (Server $c) { |
|
474 | + $this->registerService('Hasher', function(Server $c) { |
|
475 | 475 | return new Hasher($c->getConfig()); |
476 | 476 | }); |
477 | - $this->registerService('CredentialsManager', function (Server $c) { |
|
477 | + $this->registerService('CredentialsManager', function(Server $c) { |
|
478 | 478 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
479 | 479 | }); |
480 | - $this->registerService('DatabaseConnection', function (Server $c) { |
|
480 | + $this->registerService('DatabaseConnection', function(Server $c) { |
|
481 | 481 | $systemConfig = $c->getSystemConfig(); |
482 | 482 | $factory = new \OC\DB\ConnectionFactory($c->getConfig()); |
483 | 483 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -489,14 +489,14 @@ discard block |
||
489 | 489 | $connection->getConfiguration()->setSQLLogger($c->getQueryLogger()); |
490 | 490 | return $connection; |
491 | 491 | }); |
492 | - $this->registerService('HTTPHelper', function (Server $c) { |
|
492 | + $this->registerService('HTTPHelper', function(Server $c) { |
|
493 | 493 | $config = $c->getConfig(); |
494 | 494 | return new HTTPHelper( |
495 | 495 | $config, |
496 | 496 | $c->getHTTPClientService() |
497 | 497 | ); |
498 | 498 | }); |
499 | - $this->registerService('HttpClientService', function (Server $c) { |
|
499 | + $this->registerService('HttpClientService', function(Server $c) { |
|
500 | 500 | $user = \OC_User::getUser(); |
501 | 501 | $uid = $user ? $user : null; |
502 | 502 | return new ClientService( |
@@ -504,27 +504,27 @@ discard block |
||
504 | 504 | new \OC\Security\CertificateManager($uid, new View(), $c->getConfig(), $c->getLogger()) |
505 | 505 | ); |
506 | 506 | }); |
507 | - $this->registerService('EventLogger', function (Server $c) { |
|
507 | + $this->registerService('EventLogger', function(Server $c) { |
|
508 | 508 | if ($c->getSystemConfig()->getValue('debug', false)) { |
509 | 509 | return new EventLogger(); |
510 | 510 | } else { |
511 | 511 | return new NullEventLogger(); |
512 | 512 | } |
513 | 513 | }); |
514 | - $this->registerService('QueryLogger', function (Server $c) { |
|
514 | + $this->registerService('QueryLogger', function(Server $c) { |
|
515 | 515 | if ($c->getSystemConfig()->getValue('debug', false)) { |
516 | 516 | return new QueryLogger(); |
517 | 517 | } else { |
518 | 518 | return new NullQueryLogger(); |
519 | 519 | } |
520 | 520 | }); |
521 | - $this->registerService('TempManager', function (Server $c) { |
|
521 | + $this->registerService('TempManager', function(Server $c) { |
|
522 | 522 | return new TempManager( |
523 | 523 | $c->getLogger(), |
524 | 524 | $c->getConfig() |
525 | 525 | ); |
526 | 526 | }); |
527 | - $this->registerService('AppManager', function (Server $c) { |
|
527 | + $this->registerService('AppManager', function(Server $c) { |
|
528 | 528 | return new \OC\App\AppManager( |
529 | 529 | $c->getUserSession(), |
530 | 530 | $c->getAppConfig(), |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | $c->getEventDispatcher() |
534 | 534 | ); |
535 | 535 | }); |
536 | - $this->registerService('DateTimeZone', function (Server $c) { |
|
536 | + $this->registerService('DateTimeZone', function(Server $c) { |
|
537 | 537 | return new DateTimeZone( |
538 | 538 | $c->getConfig(), |
539 | 539 | $c->getSession() |
540 | 540 | ); |
541 | 541 | }); |
542 | - $this->registerService('DateTimeFormatter', function (Server $c) { |
|
542 | + $this->registerService('DateTimeFormatter', function(Server $c) { |
|
543 | 543 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
544 | 544 | |
545 | 545 | return new DateTimeFormatter( |
@@ -547,16 +547,16 @@ discard block |
||
547 | 547 | $c->getL10N('lib', $language) |
548 | 548 | ); |
549 | 549 | }); |
550 | - $this->registerService('UserMountCache', function (Server $c) { |
|
550 | + $this->registerService('UserMountCache', function(Server $c) { |
|
551 | 551 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
552 | 552 | $listener = new UserMountCacheListener($mountCache); |
553 | 553 | $listener->listen($c->getUserManager()); |
554 | 554 | return $mountCache; |
555 | 555 | }); |
556 | - $this->registerService('MountConfigManager', function (Server $c) { |
|
556 | + $this->registerService('MountConfigManager', function(Server $c) { |
|
557 | 557 | $loader = \OC\Files\Filesystem::getLoader(); |
558 | 558 | $mountCache = $c->query('UserMountCache'); |
559 | - $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
559 | + $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
560 | 560 | |
561 | 561 | // builtin providers |
562 | 562 | |
@@ -567,14 +567,14 @@ discard block |
||
567 | 567 | |
568 | 568 | return $manager; |
569 | 569 | }); |
570 | - $this->registerService('IniWrapper', function ($c) { |
|
570 | + $this->registerService('IniWrapper', function($c) { |
|
571 | 571 | return new IniGetWrapper(); |
572 | 572 | }); |
573 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
573 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
574 | 574 | $jobList = $c->getJobList(); |
575 | 575 | return new AsyncBus($jobList); |
576 | 576 | }); |
577 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
577 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
578 | 578 | return new TrustedDomainHelper($this->getConfig()); |
579 | 579 | }); |
580 | 580 | $this->registerService('Throttler', function(Server $c) { |
@@ -585,10 +585,10 @@ discard block |
||
585 | 585 | $c->getConfig() |
586 | 586 | ); |
587 | 587 | }); |
588 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
588 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
589 | 589 | // IConfig and IAppManager requires a working database. This code |
590 | 590 | // might however be called when ownCloud is not yet setup. |
591 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
591 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
592 | 592 | $config = $c->getConfig(); |
593 | 593 | $appManager = $c->getAppManager(); |
594 | 594 | } else { |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $c->getTempManager() |
607 | 607 | ); |
608 | 608 | }); |
609 | - $this->registerService('Request', function ($c) { |
|
609 | + $this->registerService('Request', function($c) { |
|
610 | 610 | if (isset($this['urlParams'])) { |
611 | 611 | $urlParams = $this['urlParams']; |
612 | 612 | } else { |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | $stream |
641 | 641 | ); |
642 | 642 | }); |
643 | - $this->registerService('Mailer', function (Server $c) { |
|
643 | + $this->registerService('Mailer', function(Server $c) { |
|
644 | 644 | return new Mailer( |
645 | 645 | $c->getConfig(), |
646 | 646 | $c->getLogger(), |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | $this->registerService('LDAPProvider', function(Server $c) { |
651 | 651 | $config = $c->getConfig(); |
652 | 652 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
653 | - if(is_null($factoryClass)) { |
|
653 | + if (is_null($factoryClass)) { |
|
654 | 654 | throw new \Exception('ldapProviderFactory not set'); |
655 | 655 | } |
656 | 656 | /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
657 | 657 | $factory = new $factoryClass($this); |
658 | 658 | return $factory->getLDAPProvider(); |
659 | 659 | }); |
660 | - $this->registerService('LockingProvider', function (Server $c) { |
|
660 | + $this->registerService('LockingProvider', function(Server $c) { |
|
661 | 661 | $ini = $c->getIniWrapper(); |
662 | 662 | $config = $c->getConfig(); |
663 | 663 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -672,29 +672,29 @@ discard block |
||
672 | 672 | } |
673 | 673 | return new NoopLockingProvider(); |
674 | 674 | }); |
675 | - $this->registerService('MountManager', function () { |
|
675 | + $this->registerService('MountManager', function() { |
|
676 | 676 | return new \OC\Files\Mount\Manager(); |
677 | 677 | }); |
678 | - $this->registerService('MimeTypeDetector', function (Server $c) { |
|
678 | + $this->registerService('MimeTypeDetector', function(Server $c) { |
|
679 | 679 | return new \OC\Files\Type\Detection( |
680 | 680 | $c->getURLGenerator(), |
681 | 681 | \OC::$configDir, |
682 | - \OC::$SERVERROOT . '/resources/config/' |
|
682 | + \OC::$SERVERROOT.'/resources/config/' |
|
683 | 683 | ); |
684 | 684 | }); |
685 | - $this->registerService('MimeTypeLoader', function (Server $c) { |
|
685 | + $this->registerService('MimeTypeLoader', function(Server $c) { |
|
686 | 686 | return new \OC\Files\Type\Loader( |
687 | 687 | $c->getDatabaseConnection() |
688 | 688 | ); |
689 | 689 | }); |
690 | - $this->registerService('NotificationManager', function (Server $c) { |
|
690 | + $this->registerService('NotificationManager', function(Server $c) { |
|
691 | 691 | return new Manager( |
692 | 692 | $c->query(IValidator::class) |
693 | 693 | ); |
694 | 694 | }); |
695 | - $this->registerService('CapabilitiesManager', function (Server $c) { |
|
695 | + $this->registerService('CapabilitiesManager', function(Server $c) { |
|
696 | 696 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
697 | - $manager->registerCapability(function () use ($c) { |
|
697 | + $manager->registerCapability(function() use ($c) { |
|
698 | 698 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
699 | 699 | }); |
700 | 700 | return $manager; |
@@ -732,10 +732,10 @@ discard block |
||
732 | 732 | } |
733 | 733 | return new \OC_Defaults(); |
734 | 734 | }); |
735 | - $this->registerService('EventDispatcher', function () { |
|
735 | + $this->registerService('EventDispatcher', function() { |
|
736 | 736 | return new EventDispatcher(); |
737 | 737 | }); |
738 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
738 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
739 | 739 | // FIXME: Instantiiated here due to cyclic dependency |
740 | 740 | $request = new Request( |
741 | 741 | [ |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | $request |
761 | 761 | ); |
762 | 762 | }); |
763 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
763 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
764 | 764 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
765 | 765 | |
766 | 766 | return new CsrfTokenManager( |
@@ -768,10 +768,10 @@ discard block |
||
768 | 768 | $c->query(SessionStorage::class) |
769 | 769 | ); |
770 | 770 | }); |
771 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
771 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
772 | 772 | return new SessionStorage($c->getSession()); |
773 | 773 | }); |
774 | - $this->registerService('ContentSecurityPolicyManager', function (Server $c) { |
|
774 | + $this->registerService('ContentSecurityPolicyManager', function(Server $c) { |
|
775 | 775 | return new ContentSecurityPolicyManager(); |
776 | 776 | }); |
777 | 777 | $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
@@ -816,23 +816,23 @@ discard block |
||
816 | 816 | ); |
817 | 817 | return $manager; |
818 | 818 | }); |
819 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
819 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
820 | 820 | return new \OC\Files\AppData\Factory( |
821 | 821 | $c->getRootFolder(), |
822 | 822 | $c->getSystemConfig() |
823 | 823 | ); |
824 | 824 | }); |
825 | 825 | |
826 | - $this->registerService('LockdownManager', function (Server $c) { |
|
826 | + $this->registerService('LockdownManager', function(Server $c) { |
|
827 | 827 | return new LockdownManager(); |
828 | 828 | }); |
829 | 829 | |
830 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
830 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
831 | 831 | return new CloudIdManager(); |
832 | 832 | }); |
833 | 833 | |
834 | 834 | /* To trick DI since we don't extend the DIContainer here */ |
835 | - $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) { |
|
835 | + $this->registerService(CleanPreviewsBackgroundJob::class, function(Server $c) { |
|
836 | 836 | return new CleanPreviewsBackgroundJob( |
837 | 837 | $c->getRootFolder(), |
838 | 838 | $c->getLogger(), |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | * @deprecated since 9.2.0 use IAppData |
977 | 977 | */ |
978 | 978 | public function getAppFolder() { |
979 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
979 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
980 | 980 | $root = $this->getRootFolder(); |
981 | 981 | if (!$root->nodeExists($dir)) { |
982 | 982 | $folder = $root->newFolder($dir); |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | |
30 | 30 | class Streamer { |
31 | 31 | // array of regexp. Matching user agents will get tar instead of zip |
32 | - private $preferTarFor = [ '/macintosh|mac os x/i' ]; |
|
32 | + private $preferTarFor = ['/macintosh|mac os x/i']; |
|
33 | 33 | |
34 | 34 | // streamer instance |
35 | 35 | private $streamerInstance; |
36 | 36 | |
37 | - public function __construct(){ |
|
37 | + public function __construct() { |
|
38 | 38 | /** @var \OCP\IRequest */ |
39 | 39 | $request = \OC::$server->getRequest(); |
40 | 40 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * Send HTTP headers |
50 | 50 | * @param string $name |
51 | 51 | */ |
52 | - public function sendHeaders($name){ |
|
52 | + public function sendHeaders($name) { |
|
53 | 53 | $extension = $this->streamerInstance instanceof ZipStreamer ? '.zip' : '.tar'; |
54 | - $fullName = $name . $extension; |
|
54 | + $fullName = $name.$extension; |
|
55 | 55 | $this->streamerInstance->sendHeaders($fullName); |
56 | 56 | } |
57 | 57 | |
@@ -60,27 +60,27 @@ discard block |
||
60 | 60 | * @param string $dir |
61 | 61 | * @param string $internalDir |
62 | 62 | */ |
63 | - public function addDirRecursive($dir, $internalDir='') { |
|
63 | + public function addDirRecursive($dir, $internalDir = '') { |
|
64 | 64 | $dirname = basename($dir); |
65 | - $rootDir = $internalDir . $dirname; |
|
65 | + $rootDir = $internalDir.$dirname; |
|
66 | 66 | if (!empty($rootDir)) { |
67 | 67 | $this->streamerInstance->addEmptyDir($rootDir); |
68 | 68 | } |
69 | - $internalDir .= $dirname . '/'; |
|
69 | + $internalDir .= $dirname.'/'; |
|
70 | 70 | // prevent absolute dirs |
71 | 71 | $internalDir = ltrim($internalDir, '/'); |
72 | 72 | |
73 | - $files= \OC\Files\Filesystem::getDirectoryContent($dir); |
|
74 | - foreach($files as $file) { |
|
73 | + $files = \OC\Files\Filesystem::getDirectoryContent($dir); |
|
74 | + foreach ($files as $file) { |
|
75 | 75 | $filename = $file['name']; |
76 | - $file = $dir . '/' . $filename; |
|
77 | - if(\OC\Files\Filesystem::is_file($file)) { |
|
76 | + $file = $dir.'/'.$filename; |
|
77 | + if (\OC\Files\Filesystem::is_file($file)) { |
|
78 | 78 | $filesize = \OC\Files\Filesystem::filesize($file); |
79 | 79 | $fileTime = \OC\Files\Filesystem::filemtime($file); |
80 | 80 | $fh = \OC\Files\Filesystem::fopen($file, 'r'); |
81 | - $this->addFileFromStream($fh, $internalDir . $filename, $filesize, $fileTime); |
|
81 | + $this->addFileFromStream($fh, $internalDir.$filename, $filesize, $fileTime); |
|
82 | 82 | fclose($fh); |
83 | - }elseif(\OC\Files\Filesystem::is_dir($file)) { |
|
83 | + }elseif (\OC\Files\Filesystem::is_dir($file)) { |
|
84 | 84 | $this->addDirRecursive($file, $internalDir); |
85 | 85 | } |
86 | 86 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $dirName Directory Path and name to be added to the archive. |
117 | 117 | * @return bool $success |
118 | 118 | */ |
119 | - public function addEmptyDir($dirName){ |
|
119 | + public function addEmptyDir($dirName) { |
|
120 | 120 | return $this->streamerInstance->addEmptyDir($dirName); |
121 | 121 | } |
122 | 122 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * closing, the file is completely written to the output stream. |
127 | 127 | * @return bool $success |
128 | 128 | */ |
129 | - public function finalize(){ |
|
129 | + public function finalize() { |
|
130 | 130 | return $this->streamerInstance->finalize(); |
131 | 131 | } |
132 | 132 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @return \OCP\IMemcache |
131 | 131 | */ |
132 | 132 | public function createLocking($prefix = '') { |
133 | - return new $this->lockingCacheClass($this->globalPrefix . '/' . $prefix); |
|
133 | + return new $this->lockingCacheClass($this->globalPrefix.'/'.$prefix); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return \OC\Memcache\Cache |
141 | 141 | */ |
142 | 142 | public function createDistributed($prefix = '') { |
143 | - return new $this->distributedCacheClass($this->globalPrefix . '/' . $prefix); |
|
143 | + return new $this->distributedCacheClass($this->globalPrefix.'/'.$prefix); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @return \OC\Memcache\Cache |
151 | 151 | */ |
152 | 152 | public function createLocal($prefix = '') { |
153 | - return new $this->localCacheClass($this->globalPrefix . '/' . $prefix); |
|
153 | + return new $this->localCacheClass($this->globalPrefix.'/'.$prefix); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -41,13 +41,13 @@ |
||
41 | 41 | */ |
42 | 42 | public function cas($key, $old, $new) { |
43 | 43 | //no native cas, emulate with locking |
44 | - if ($this->add($key . '_lock', true)) { |
|
44 | + if ($this->add($key.'_lock', true)) { |
|
45 | 45 | if ($this->get($key) === $old) { |
46 | 46 | $this->set($key, $new); |
47 | - $this->remove($key . '_lock'); |
|
47 | + $this->remove($key.'_lock'); |
|
48 | 48 | return true; |
49 | 49 | } else { |
50 | - $this->remove($key . '_lock'); |
|
50 | + $this->remove($key.'_lock'); |
|
51 | 51 | return false; |
52 | 52 | } |
53 | 53 | } else { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | use CADTrait; |
38 | 38 | |
39 | 39 | public function get($key) { |
40 | - $result = apcu_fetch($this->getPrefix() . $key, $success); |
|
40 | + $result = apcu_fetch($this->getPrefix().$key, $success); |
|
41 | 41 | if (!$success) { |
42 | 42 | return null; |
43 | 43 | } |
@@ -45,24 +45,24 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function set($key, $value, $ttl = 0) { |
48 | - return apcu_store($this->getPrefix() . $key, $value, $ttl); |
|
48 | + return apcu_store($this->getPrefix().$key, $value, $ttl); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function hasKey($key) { |
52 | - return apcu_exists($this->getPrefix() . $key); |
|
52 | + return apcu_exists($this->getPrefix().$key); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function remove($key) { |
56 | - return apcu_delete($this->getPrefix() . $key); |
|
56 | + return apcu_delete($this->getPrefix().$key); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function clear($prefix = '') { |
60 | - $ns = $this->getPrefix() . $prefix; |
|
60 | + $ns = $this->getPrefix().$prefix; |
|
61 | 61 | $ns = preg_quote($ns, '/'); |
62 | - if(class_exists('\APCIterator')) { |
|
63 | - $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY); |
|
62 | + if (class_exists('\APCIterator')) { |
|
63 | + $iter = new \APCIterator('user', '/^'.$ns.'/', APC_ITER_KEY); |
|
64 | 64 | } else { |
65 | - $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); |
|
65 | + $iter = new \APCUIterator('/^'.$ns.'/', APC_ITER_KEY); |
|
66 | 66 | } |
67 | 67 | return apcu_delete($iter); |
68 | 68 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return bool |
77 | 77 | */ |
78 | 78 | public function add($key, $value, $ttl = 0) { |
79 | - return apcu_add($this->getPrefix() . $key, $value, $ttl); |
|
79 | + return apcu_add($this->getPrefix().$key, $value, $ttl); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221 |
101 | 101 | * for details |
102 | 102 | */ |
103 | - return apcu_exists($this->getPrefix() . $key) |
|
104 | - ? apcu_inc($this->getPrefix() . $key, $step) |
|
103 | + return apcu_exists($this->getPrefix().$key) |
|
104 | + ? apcu_inc($this->getPrefix().$key, $step) |
|
105 | 105 | : false; |
106 | 106 | } |
107 | 107 | |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221 |
126 | 126 | * for details |
127 | 127 | */ |
128 | - return apcu_exists($this->getPrefix() . $key) |
|
129 | - ? apcu_dec($this->getPrefix() . $key, $step) |
|
128 | + return apcu_exists($this->getPrefix().$key) |
|
129 | + ? apcu_dec($this->getPrefix().$key, $step) |
|
130 | 130 | : false; |
131 | 131 | } |
132 | 132 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function cas($key, $old, $new) { |
142 | 142 | // apc only does cas for ints |
143 | 143 | if (is_int($old) and is_int($new)) { |
144 | - return apcu_cas($this->getPrefix() . $key, $old, $new); |
|
144 | + return apcu_cas($this->getPrefix().$key, $old, $new); |
|
145 | 145 | } else { |
146 | 146 | return $this->casEmulated($key, $old, $new); |
147 | 147 | } |
@@ -38,13 +38,13 @@ |
||
38 | 38 | */ |
39 | 39 | public function cad($key, $old) { |
40 | 40 | //no native cas, emulate with locking |
41 | - if ($this->add($key . '_lock', true)) { |
|
41 | + if ($this->add($key.'_lock', true)) { |
|
42 | 42 | if ($this->get($key) === $old) { |
43 | 43 | $this->remove($key); |
44 | - $this->remove($key . '_lock'); |
|
44 | + $this->remove($key.'_lock'); |
|
45 | 45 | return true; |
46 | 46 | } else { |
47 | - $this->remove($key . '_lock'); |
|
47 | + $this->remove($key.'_lock'); |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | } else { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | public function get($key) { |
100 | - $result = self::$cache->get($this->getNamespace() . $key); |
|
100 | + $result = self::$cache->get($this->getNamespace().$key); |
|
101 | 101 | if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
102 | 102 | return null; |
103 | 103 | } else { |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | |
108 | 108 | public function set($key, $value, $ttl = 0) { |
109 | 109 | if ($ttl > 0) { |
110 | - $result = self::$cache->set($this->getNamespace() . $key, $value, $ttl); |
|
110 | + $result = self::$cache->set($this->getNamespace().$key, $value, $ttl); |
|
111 | 111 | } else { |
112 | - $result = self::$cache->set($this->getNamespace() . $key, $value); |
|
112 | + $result = self::$cache->set($this->getNamespace().$key, $value); |
|
113 | 113 | } |
114 | 114 | if ($result !== true) { |
115 | 115 | $this->verifyReturnCode(); |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | public function hasKey($key) { |
121 | - self::$cache->get($this->getNamespace() . $key); |
|
121 | + self::$cache->get($this->getNamespace().$key); |
|
122 | 122 | return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
123 | 123 | } |
124 | 124 | |
125 | 125 | public function remove($key) { |
126 | - $result= self::$cache->delete($this->getNamespace() . $key); |
|
126 | + $result = self::$cache->delete($this->getNamespace().$key); |
|
127 | 127 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
128 | 128 | $this->verifyReturnCode(); |
129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | public function clear($prefix = '') { |
134 | - $prefix = $this->getNamespace() . $prefix; |
|
134 | + $prefix = $this->getNamespace().$prefix; |
|
135 | 135 | $allKeys = self::$cache->getAllKeys(); |
136 | 136 | if ($allKeys === false) { |
137 | 137 | // newer Memcached doesn't like getAllKeys(), flush everything |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @throws \Exception |
166 | 166 | */ |
167 | 167 | public function add($key, $value, $ttl = 0) { |
168 | - $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
168 | + $result = self::$cache->add($this->getPrefix().$key, $value, $ttl); |
|
169 | 169 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
170 | 170 | $this->verifyReturnCode(); |
171 | 171 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function inc($key, $step = 1) { |
183 | 183 | $this->add($key, 0); |
184 | - $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
184 | + $result = self::$cache->increment($this->getPrefix().$key, $step); |
|
185 | 185 | |
186 | 186 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
187 | 187 | return false; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return int | bool |
199 | 199 | */ |
200 | 200 | public function dec($key, $step = 1) { |
201 | - $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
201 | + $result = self::$cache->decrement($this->getPrefix().$key, $step); |
|
202 | 202 | |
203 | 203 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
204 | 204 | return false; |
@@ -47,28 +47,28 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | public function get($key) { |
50 | - return xcache_get($this->getNamespace() . $key); |
|
50 | + return xcache_get($this->getNamespace().$key); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function set($key, $value, $ttl = 0) { |
54 | 54 | if ($ttl > 0) { |
55 | - return xcache_set($this->getNamespace() . $key, $value, $ttl); |
|
55 | + return xcache_set($this->getNamespace().$key, $value, $ttl); |
|
56 | 56 | } else { |
57 | - return xcache_set($this->getNamespace() . $key, $value); |
|
57 | + return xcache_set($this->getNamespace().$key, $value); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | public function hasKey($key) { |
62 | - return xcache_isset($this->getNamespace() . $key); |
|
62 | + return xcache_isset($this->getNamespace().$key); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function remove($key) { |
66 | - return xcache_unset($this->getNamespace() . $key); |
|
66 | + return xcache_unset($this->getNamespace().$key); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function clear($prefix = '') { |
70 | 70 | if (function_exists('xcache_unset_by_prefix')) { |
71 | - return xcache_unset_by_prefix($this->getNamespace() . $prefix); |
|
71 | + return xcache_unset_by_prefix($this->getNamespace().$prefix); |
|
72 | 72 | } else { |
73 | 73 | // Since we can not clear by prefix, we just clear the whole cache. |
74 | 74 | xcache_clear_cache(\XC_TYPE_VAR, 0); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return int | bool |
101 | 101 | */ |
102 | 102 | public function inc($key, $step = 1) { |
103 | - return xcache_inc($this->getPrefix() . $key, $step); |
|
103 | + return xcache_inc($this->getPrefix().$key, $step); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return int | bool |
112 | 112 | */ |
113 | 113 | public function dec($key, $step = 1) { |
114 | - return xcache_dec($this->getPrefix() . $key, $step); |
|
114 | + return xcache_dec($this->getPrefix().$key, $step); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | static public function isAvailable() { |