Skip to content

Commit e810a46

Browse files
committed
chore: Remove some unused old tools
Signed-off-by: Julius Knorr <[email protected]>
1 parent d61568b commit e810a46

File tree

5 files changed

+25
-238
lines changed

5 files changed

+25
-238
lines changed

lib/Service/LockService.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
class LockService {
3232
public const PREFIX = 'files_lock';
3333

34-
35-
use TStringTools;
36-
3734
private IUserManager $userManager;
3835
private IL10N $l10n;
3936
private LocksRequest $locksRequest;
@@ -361,6 +358,30 @@ public function generateToken(FileLock $lock) {
361358
$lock->setToken(self::PREFIX . '/' . $this->uuid());
362359
}
363360

361+
/**
362+
* Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80
363+
*
364+
* @param int $length
365+
*
366+
* @return string
367+
*/
368+
protected function uuid(int $length = 0): string {
369+
$uuid = sprintf(
370+
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff),
371+
mt_rand(0, 0xffff), mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000,
372+
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
373+
);
374+
375+
if ($length > 0) {
376+
if ($length <= 16) {
377+
$uuid = str_replace('-', '', $uuid);
378+
}
379+
380+
$uuid = substr($uuid, 0, $length);
381+
}
382+
383+
return $uuid;
384+
}
364385

365386
/**
366387
* @param FileLock[] $locks

lib/Tools/Traits/TSetup.php

Lines changed: 0 additions & 77 deletions
This file was deleted.

lib/Tools/Traits/TStringTools.php

Lines changed: 0 additions & 136 deletions
This file was deleted.

psalm.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,6 @@
2525
<directory name="vendor" />
2626
</extraFiles>
2727
<issueHandlers>
28-
<UndefinedMagicMethod>
29-
<errorLevel type="suppress">
30-
<referencedMethod name="/Db\\.*::.*/" />
31-
</errorLevel>
32-
</UndefinedMagicMethod>
33-
<UndefinedInterfaceMethod>
34-
<errorLevel type="suppress">
35-
<!-- FIXME Deprecated event handling -->
36-
<referencedMethod name="OCP\IUserManager::listen" />
37-
<referencedMethod name="OCP\IGroupManager::listen" />
38-
</errorLevel>
39-
</UndefinedInterfaceMethod>
4028
<UndefinedClass>
4129
<errorLevel type="suppress">
4230
<referencedClass name="OC\*" />

tests/psalm-baseline.xml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
2+
<files psalm-version="6.8.2@720ed6b578ac24f9543c65c3d4cecea0ff348ccd">
33
<file src="lib/DAV/LockPlugin.php">
44
<UndefinedClass>
55
<code><![CDATA[CachingTree]]></code>
@@ -99,13 +99,4 @@
9999
<code><![CDATA[$arr === null]]></code>
100100
</TypeDoesNotContainNull>
101101
</file>
102-
<file src="lib/Tools/Traits/TSetup.php">
103-
<MismatchingDocblockParamType>
104-
<code><![CDATA[string]]></code>
105-
<code><![CDATA[string]]></code>
106-
</MismatchingDocblockParamType>
107-
<MismatchingDocblockReturnType>
108-
<code><![CDATA[string]]></code>
109-
</MismatchingDocblockReturnType>
110-
</file>
111102
</files>

0 commit comments

Comments
 (0)