aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/DeleteOrphanedSharesJob.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/DeleteOrphanedSharesJob.php')
-rw-r--r--apps/files_sharing/lib/DeleteOrphanedSharesJob.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php
index d2cc39ff060..2d166da2010 100644
--- a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php
+++ b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php
@@ -26,6 +26,9 @@ namespace OCA\Files_Sharing;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
+use OCP\IDBConnection;
+use OCP\Server;
+use Psr\Log\LoggerInterface;
/**
* Delete all share entries that have no matching entries in the file cache table.
@@ -33,10 +36,8 @@ use OCP\BackgroundJob\TimedJob;
class DeleteOrphanedSharesJob extends TimedJob {
/**
* Default interval in minutes
- *
- * @var int $defaultIntervalMin
**/
- protected $defaultIntervalMin = 15;
+ protected int $defaultIntervalMin = 15;
/**
* sets the correct interval for this timed job
@@ -53,15 +54,15 @@ class DeleteOrphanedSharesJob extends TimedJob {
* @param array $argument unused argument
*/
public function run($argument) {
- $connection = \OC::$server->getDatabaseConnection();
- $logger = \OC::$server->getLogger();
+ $connection = Server::get(IDBConnection::class);
+ $logger = Server::get(LoggerInterface::class);
$sql =
'DELETE FROM `*PREFIX*share` ' .
'WHERE `item_type` in (\'file\', \'folder\') ' .
'AND NOT EXISTS (SELECT `fileid` FROM `*PREFIX*filecache` WHERE `file_source` = `fileid`)';
- $deletedEntries = $connection->executeUpdate($sql);
+ $deletedEntries = $connection->executeStatement($sql);
$logger->debug("$deletedEntries orphaned share(s) deleted", ['app' => 'DeleteOrphanedSharesJob']);
}
}