diff options
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 11 | ||||
-rw-r--r-- | apps/files_sharing/lib/Command/CleanupRemoteStorages.php | 20 |
2 files changed, 18 insertions, 13 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index d89419b8ea9..b76239dc00d 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -116,11 +116,6 @@ class Application extends App implements IBootstrap { Share::registerBackend('file', File::class); Share::registerBackend('folder', Folder::class, 'file'); - - /** - * Always add main sharing script - */ - Util::addScript(self::APP_ID, 'main'); } @@ -139,6 +134,12 @@ class Application extends App implements IBootstrap { $dispatcher->addListener(ResourcesLoadAdditionalScriptsEvent::class, function () { \OCP\Util::addScript('files_sharing', 'collaboration'); }); + $dispatcher->addListener(\OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent::class, function () { + /** + * Always add main sharing script + */ + Util::addScript(self::APP_ID, 'main'); + }); // notifications api to accept incoming user shares $dispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event) { diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index 3816a2a5124..de4c7862785 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -113,8 +113,9 @@ class CleanupRemoteStorages extends Command { $queryBuilder->createNamedParameter($numericId, IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR) ); - $result = $queryBuilder->execute(); + $result = $queryBuilder->executeQuery(); $count = $result->fetchOne(); + $result->closeCursor(); $output->writeln("$count files can be deleted for storage $numericId"); } @@ -127,7 +128,7 @@ class CleanupRemoteStorages extends Command { IQueryBuilder::PARAM_STR) ); $output->write("deleting $id [$numericId] ... "); - $count = $queryBuilder->execute(); + $count = $queryBuilder->executeStatement(); $output->writeln("deleted $count storage"); $this->deleteFiles($numericId, $output); } @@ -141,7 +142,7 @@ class CleanupRemoteStorages extends Command { IQueryBuilder::PARAM_STR) ); $output->write("deleting files for storage $numericId ... "); - $count = $queryBuilder->execute(); + $count = $queryBuilder->executeStatement(); $output->writeln("deleted $count files"); } @@ -160,14 +161,16 @@ class CleanupRemoteStorages extends Command { // but not the ones starting with a '/', they are for normal shares $queryBuilder->createNamedParameter($this->connection->escapeLikeParameter('shared::/') . '%'), IQueryBuilder::PARAM_STR) - )->orderBy('numeric_id'); - $query = $queryBuilder->execute(); + ) + ->orderBy('numeric_id'); + $result = $queryBuilder->executeQuery(); $remoteStorages = []; - while ($row = $query->fetch()) { + while ($row = $result->fetch()) { $remoteStorages[$row['id']] = $row['numeric_id']; } + $result->closeCursor(); return $remoteStorages; } @@ -176,16 +179,17 @@ class CleanupRemoteStorages extends Command { $queryBuilder = $this->connection->getQueryBuilder(); $queryBuilder->select(['id', 'share_token', 'owner', 'remote']) ->from('share_external'); - $query = $queryBuilder->execute(); + $result = $queryBuilder->executeQuery(); $remoteShareIds = []; - while ($row = $query->fetch()) { + while ($row = $result->fetch()) { $cloudId = $this->cloudIdManager->getCloudId($row['owner'], $row['remote']); $remote = $cloudId->getRemote(); $remoteShareIds[$row['id']] = 'shared::' . md5($row['share_token'] . '@' . $remote); } + $result->closeCursor(); return $remoteShareIds; } |