Skip to content

Commit bc70c8b

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

26 files changed

+285
-2490
lines changed

lib/AppInfo/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function register(IRegistrationContext $context): void {
5353
public function boot(IBootContext $context): void {
5454
$this->registerHooks();
5555

56-
$context->injectFn(function (ILockManager $lockManager) use ($context) {
56+
$context->injectFn(function (ILockManager $lockManager) {
5757
$lockManager->registerLazyLockProvider(LockProvider::class);
5858
});
5959
}

lib/Command/Lock.php

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace OCA\FilesLock\Command;
1313

1414
use OC\Core\Command\Base;
15+
use OC\DB\Connection;
16+
use OC\DB\SchemaWrapper;
1517
use OC\User\NoUserException;
1618
use OCA\FilesLock\Db\LocksRequest;
1719
use OCA\FilesLock\Exceptions\LockNotFoundException;
@@ -26,6 +28,7 @@
2628
use OCP\Files\Lock\ILock;
2729
use OCP\Files\Lock\LockContext;
2830
use OCP\Files\NotFoundException;
31+
use OCP\IDBConnection;
2932
use OCP\IUserManager;
3033
use Symfony\Component\Console\Exception\InvalidArgumentException;
3134
use Symfony\Component\Console\Input\InputArgument;
@@ -35,48 +38,17 @@
3538
use Symfony\Component\Console\Question\ConfirmationQuestion;
3639

3740
class Lock extends Base {
38-
/** @var IUserManager */
39-
private $userManager;
40-
41-
/** @var LocksRequest */
42-
private $locksRequest;
43-
44-
/** @var FileService */
45-
private $fileService;
46-
47-
/** @var LockService */
48-
private $lockService;
49-
50-
/** @var ConfigService */
51-
private $configService;
52-
53-
54-
/**
55-
* CacheUpdate constructor.
56-
*
57-
* @param IUserManager $userManager
58-
* @param FileService $fileService
59-
* @param LockService $lockService
60-
* @param LocksRequest $locksRequest
61-
* @param ConfigService $configService
62-
*/
6341
public function __construct(
64-
IUserManager $userManager, LocksRequest $locksRequest, FileService $fileService,
65-
LockService $lockService, ConfigService $configService,
42+
private IUserManager $userManager,
43+
private LocksRequest $locksRequest,
44+
private FileService $fileService,
45+
private LockService $lockService,
46+
private ConfigService $configService,
47+
private IDBConnection $connection,
6648
) {
6749
parent::__construct();
68-
69-
$this->userManager = $userManager;
70-
$this->locksRequest = $locksRequest;
71-
$this->fileService = $fileService;
72-
$this->lockService = $lockService;
73-
$this->configService = $configService;
7450
}
7551

76-
77-
/**
78-
*
79-
*/
8052
protected function configure() {
8153
parent::configure();
8254
$this->setName('files:lock')
@@ -241,4 +213,42 @@ private function uninstallApp(InputInterface $input, OutputInterface $output) {
241213

242214
throw new SuccessException();
243215
}
216+
217+
218+
/**
219+
*
220+
*/
221+
public function uninstall(): void {
222+
$this->uninstallAppTables();
223+
$this->removeFromJobs();
224+
$this->removeFromMigrations();
225+
}
226+
227+
public function uninstallAppTables() {
228+
$dbConn = \OCP\Server::get(Connection::class);
229+
$schema = new SchemaWrapper($dbConn);
230+
231+
foreach (array_keys(self::$tables) as $table) {
232+
if ($schema->hasTable($table)) {
233+
$schema->dropTable($table);
234+
}
235+
}
236+
237+
$schema->performDropTableCalls();
238+
}
239+
240+
public function removeFromMigrations() {
241+
$qb = $this->connection->getQueryBuilder();
242+
$qb->delete('migrations');
243+
$qb->where($qb->expr()->eq('app', 'files_lock'));
244+
245+
$qb->executeStatement();
246+
}
247+
248+
public function removeFromJobs() {
249+
$qb = $this->connection->getQueryBuilder();
250+
$qb->delete('jobs');
251+
$qb->where($qb->expr()->eq('class', 'OCA\FilesLock\Cron\Unlock'));
252+
$qb->executeStatement();
253+
}
244254
}

lib/Controller/LockController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ protected function fail(
173173
);
174174

175175
if ($log) {
176-
$this->logger->warning('[warning] ' . $status . ' - ' . json_encode($data));
176+
$this->logger->warning('[warning] ' . (string)$status . ' - ' . json_encode($data));
177177
}
178178

179179
return new DataResponse($data, $status);

lib/Db/CoreQueryBuilder.php

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

lib/Db/CoreRequestBuilder.php

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

0 commit comments

Comments
 (0)