36
36
use OCA \FilesLock \Exceptions \LockNotFoundException ;
37
37
use OCA \FilesLock \Exceptions \UnauthorizedUnlockException ;
38
38
use OCA \FilesLock \Model \FileLock ;
39
- use OCA \FilesLock \Tools \Traits \TLogger ;
40
39
use OCA \FilesLock \Tools \Traits \TStringTools ;
41
40
use OCP \App \IAppManager ;
42
41
use OCP \EventDispatcher \IEventDispatcher ;
@@ -56,8 +55,6 @@ class LockService {
56
55
57
56
58
57
use TStringTools;
59
- use TLogger;
60
-
61
58
62
59
private IUserManager $ userManager ;
63
60
private IL10N $ l10n ;
@@ -100,8 +97,6 @@ public function __construct(
100
97
$ this ->userSession = $ userSession ;
101
98
$ this ->request = $ request ;
102
99
$ this ->logger = $ logger ;
103
-
104
- $ this ->setup ('app ' , 'files_lock ' );
105
100
}
106
101
107
102
/**
@@ -179,7 +174,7 @@ public function lock(LockContext $lockScope): FileLock {
179
174
$ known ->setTimeout (
180
175
$ known ->getETA () !== FileLock::ETA_INFINITE ? $ known ->getTimeout () - $ known ->getETA () + $ this ->configService ->getTimeoutSeconds () : 0
181
176
);
182
- $ this ->notice ('extending existing lock ' , false , ['fileLock ' => $ known ]);
177
+ $ this ->logger -> notice ('extending existing lock ' , ['fileLock ' => $ known ]);
183
178
$ this ->locksRequest ->update ($ known );
184
179
$ this ->injectMetadata ($ known );
185
180
return $ known ;
@@ -191,7 +186,7 @@ public function lock(LockContext $lockScope): FileLock {
191
186
$ lock = FileLock::fromLockScope ($ lockScope , $ this ->configService ->getTimeoutSeconds ());
192
187
$ this ->generateToken ($ lock );
193
188
$ lock ->setCreation (time ());
194
- $ this ->notice ('locking file ' , false , ['fileLock ' => $ lock ]);
189
+ $ this ->logger -> notice ('locking file ' , ['fileLock ' => $ lock ]);
195
190
$ this ->injectMetadata ($ lock );
196
191
$ this ->locksRequest ->save ($ lock );
197
192
$ this ->propagateEtag ($ lockScope );
@@ -215,7 +210,7 @@ public function getAppName(string $appId): ?string {
215
210
* @throws UnauthorizedUnlockException
216
211
*/
217
212
public function unlock (LockContext $ lock , bool $ force = false ): FileLock {
218
- $ this ->notice ('unlocking file ' , false , ['fileLock ' => $ lock ]);
213
+ $ this ->logger -> notice ('unlocking file ' , ['fileLock ' => $ lock ]);
219
214
220
215
$ known = $ this ->getLockFromFileId ($ lock ->getNode ()->getId ());
221
216
if (!$ force ) {
@@ -306,8 +301,8 @@ public function unlockFile(int $fileId, string $userId, bool $force = false, int
306
301
public function getDeprecatedLocks (): array {
307
302
$ timeout = (int )$ this ->configService ->getAppValue (ConfigService::LOCK_TIMEOUT );
308
303
if ($ timeout === 0 ) {
309
- $ this ->notice (
310
- 'ConfigService::LOCK_TIMEOUT is not numerical, using default ' , true , ['current ' => $ timeout ]
304
+ $ this ->logger -> notice (
305
+ 'ConfigService::LOCK_TIMEOUT is not numerical, using default ' , ['current ' => $ timeout, ' exception ' => new \ Exception () ]
311
306
);
312
307
$ timeout = (int )$ this ->configService ->defaults [ConfigService::LOCK_TIMEOUT ];
313
308
}
@@ -403,7 +398,7 @@ function (FileLock $lock) {
403
398
}, $ locks
404
399
);
405
400
406
- $ this ->notice ('removing locks ' , false , ['ids ' => $ ids ]);
401
+ $ this ->logger -> notice ('removing locks ' , ['ids ' => $ ids ]);
407
402
408
403
$ this ->locksRequest ->removeIds ($ ids );
409
404
}
0 commit comments