14
14
use OCA \FilesLock \Exceptions \LockNotFoundException ;
15
15
use OCA \FilesLock \Exceptions \UnauthorizedUnlockException ;
16
16
use OCA \FilesLock \Model \FileLock ;
17
- use OCA \FilesLock \Tools \Traits \TLogger ;
18
17
use OCA \FilesLock \Tools \Traits \TStringTools ;
19
18
use OCP \App \IAppManager ;
20
19
use OCP \EventDispatcher \IEventDispatcher ;
@@ -34,8 +33,6 @@ class LockService {
34
33
35
34
36
35
use TStringTools;
37
- use TLogger;
38
-
39
36
40
37
private IUserManager $ userManager ;
41
38
private IL10N $ l10n ;
@@ -78,8 +75,6 @@ public function __construct(
78
75
$ this ->userSession = $ userSession ;
79
76
$ this ->request = $ request ;
80
77
$ this ->logger = $ logger ;
81
-
82
- $ this ->setup ('app ' , 'files_lock ' );
83
78
}
84
79
85
80
/**
@@ -157,7 +152,7 @@ public function lock(LockContext $lockScope): FileLock {
157
152
$ known ->setTimeout (
158
153
$ known ->getETA () !== FileLock::ETA_INFINITE ? $ known ->getTimeout () - $ known ->getETA () + $ this ->configService ->getTimeoutSeconds () : 0
159
154
);
160
- $ this ->notice ('extending existing lock ' , false , ['fileLock ' => $ known ]);
155
+ $ this ->logger -> notice ('extending existing lock ' , ['fileLock ' => $ known ]);
161
156
$ this ->locksRequest ->update ($ known );
162
157
$ this ->injectMetadata ($ known );
163
158
return $ known ;
@@ -169,7 +164,7 @@ public function lock(LockContext $lockScope): FileLock {
169
164
$ lock = FileLock::fromLockScope ($ lockScope , $ this ->configService ->getTimeoutSeconds ());
170
165
$ this ->generateToken ($ lock );
171
166
$ lock ->setCreation (time ());
172
- $ this ->notice ('locking file ' , false , ['fileLock ' => $ lock ]);
167
+ $ this ->logger -> notice ('locking file ' , ['fileLock ' => $ lock ]);
173
168
$ this ->injectMetadata ($ lock );
174
169
$ this ->locksRequest ->save ($ lock );
175
170
$ this ->propagateEtag ($ lockScope );
@@ -193,7 +188,7 @@ public function getAppName(string $appId): ?string {
193
188
* @throws UnauthorizedUnlockException
194
189
*/
195
190
public function unlock (LockContext $ lock , bool $ force = false ): FileLock {
196
- $ this ->notice ('unlocking file ' , false , ['fileLock ' => $ lock ]);
191
+ $ this ->logger -> notice ('unlocking file ' , ['fileLock ' => $ lock ]);
197
192
198
193
$ known = $ this ->getLockFromFileId ($ lock ->getNode ()->getId ());
199
194
if (!$ force ) {
@@ -284,8 +279,8 @@ public function unlockFile(int $fileId, string $userId, bool $force = false, int
284
279
public function getDeprecatedLocks (): array {
285
280
$ timeout = (int )$ this ->configService ->getAppValue (ConfigService::LOCK_TIMEOUT );
286
281
if ($ timeout === 0 ) {
287
- $ this ->notice (
288
- 'ConfigService::LOCK_TIMEOUT is not numerical, using default ' , true , ['current ' => $ timeout ]
282
+ $ this ->logger -> notice (
283
+ 'ConfigService::LOCK_TIMEOUT is not numerical, using default ' , ['current ' => $ timeout, ' exception ' => new \ Exception () ]
289
284
);
290
285
$ timeout = (int )$ this ->configService ->defaults [ConfigService::LOCK_TIMEOUT ];
291
286
}
@@ -381,7 +376,7 @@ function (FileLock $lock) {
381
376
}, $ locks
382
377
);
383
378
384
- $ this ->notice ('removing locks ' , false , ['ids ' => $ ids ]);
379
+ $ this ->logger -> notice ('removing locks ' , ['ids ' => $ ids ]);
385
380
386
381
$ this ->locksRequest ->removeIds ($ ids );
387
382
}
0 commit comments