diff options
Diffstat (limited to 'core')
71 files changed, 747 insertions, 258 deletions
diff --git a/core/Application.php b/core/Application.php index cc84f191330..17640f2ce0d 100644 --- a/core/Application.php +++ b/core/Application.php @@ -54,7 +54,7 @@ class Application extends App { $notificationManager->registerNotifierService(CoreNotifier::class); $notificationManager->registerNotifierService(AuthenticationNotifier::class); - $eventDispatcher->addListener(AddMissingIndicesEvent::class, function (AddMissingIndicesEvent $event) { + $eventDispatcher->addListener(AddMissingIndicesEvent::class, function (AddMissingIndicesEvent $event): void { $event->addMissingIndex( 'share', 'share_with_index', @@ -244,7 +244,7 @@ class Application extends App { ); }); - $eventDispatcher->addListener(AddMissingPrimaryKeyEvent::class, function (AddMissingPrimaryKeyEvent $event) { + $eventDispatcher->addListener(AddMissingPrimaryKeyEvent::class, function (AddMissingPrimaryKeyEvent $event): void { $event->addMissingPrimaryKey( 'federated_reshares', 'federated_res_pk', diff --git a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php index 2396cde2290..d1ecc08ca4b 100644 --- a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php +++ b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php @@ -10,6 +10,7 @@ namespace OC\Core\BackgroundJobs; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\QueuedJob; +use OCP\Files; use OCP\IConfig; use Psr\Log\LoggerInterface; @@ -70,7 +71,7 @@ class BackgroundCleanupUpdaterBackupsJob extends QueuedJob { foreach ($dirList as $dir) { $this->log->info("Removing $dir ..."); - $result = \OC_Helper::rmdirr($dir); + $result = Files::rmdirr($dir); if (!$result) { $this->log->error('Could not remove updater backup folder $dir'); } diff --git a/core/BackgroundJobs/CheckForUserCertificates.php b/core/BackgroundJobs/CheckForUserCertificates.php index 7fa5951d775..c4ac28905ef 100644 --- a/core/BackgroundJobs/CheckForUserCertificates.php +++ b/core/BackgroundJobs/CheckForUserCertificates.php @@ -32,7 +32,7 @@ class CheckForUserCertificates extends QueuedJob { */ public function run($arguments): void { $uploadList = []; - $this->userManager->callForSeenUsers(function (IUser $user) use (&$uploadList) { + $this->userManager->callForSeenUsers(function (IUser $user) use (&$uploadList): void { $userId = $user->getUID(); try { \OC_Util::setupFS($userId); diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index e775717092a..cb02a8e4ffa 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -8,6 +8,7 @@ declare(strict_types=1); namespace OC\Core\BackgroundJobs; +use OC\Files\Mount\MoveableMount; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\TimedJob; @@ -83,7 +84,7 @@ class GenerateMetadataJob extends TimedJob { private function scanFolder(Folder $folder): void { // Do not scan share and other moveable mounts. - if ($folder->getMountPoint() instanceof \OC\Files\Mount\MoveableMount) { + if ($folder->getMountPoint() instanceof MoveableMount) { return; } diff --git a/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php b/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php index 906a80019eb..86622e58758 100644 --- a/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php +++ b/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php @@ -27,7 +27,7 @@ class LookupServerSendCheckBackgroundJob extends QueuedJob { * @param array $argument */ public function run($argument): void { - $this->userManager->callForSeenUsers(function (IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user): void { // If the user data was not updated yet (check if LUS is enabled and if then update on LUS or delete on LUS) // then we need to flag the user data to be checked if ($this->config->getUserValue($user->getUID(), 'lookup_server_connector', 'dataSend', '') === '') { diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index b2d02e222de..71c7f84e5b0 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace OC\Core\Command\App; use OC\Installer; +use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Command\Command; @@ -64,7 +65,7 @@ class Update extends Command { $apps = [$singleAppId]; try { $this->manager->getAppPath($singleAppId); - } catch (\OCP\App\AppPathNotFoundException $e) { + } catch (AppPathNotFoundException $e) { $output->writeln($singleAppId . ' not installed'); return 1; } diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index 7fa005cf231..9a862f5a13a 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -10,6 +10,8 @@ namespace OC\Core\Command\Background; use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; +use OCP\BackgroundJob\QueuedJob; +use OCP\BackgroundJob\TimedJob; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -75,7 +77,7 @@ class Job extends Command { $output->writeln('<info>Job executed!</info>'); $output->writeln(''); - if ($job instanceof \OCP\BackgroundJob\TimedJob) { + if ($job instanceof TimedJob) { $this->printJobInfo($jobId, $job, $output); } } else { @@ -99,10 +101,10 @@ class Job extends Command { $output->writeln('Job class: ' . get_class($job)); $output->writeln('Arguments: ' . json_encode($job->getArgument())); - $isTimedJob = $job instanceof \OCP\BackgroundJob\TimedJob; + $isTimedJob = $job instanceof TimedJob; if ($isTimedJob) { $output->writeln('Type: timed'); - } elseif ($job instanceof \OCP\BackgroundJob\QueuedJob) { + } elseif ($job instanceof QueuedJob) { $output->writeln('Type: queued'); } else { $output->writeln('Type: job'); diff --git a/core/Command/Background/JobBase.php b/core/Command/Background/JobBase.php index d92bb77d4b6..81d16f874eb 100644 --- a/core/Command/Background/JobBase.php +++ b/core/Command/Background/JobBase.php @@ -10,12 +10,15 @@ declare(strict_types=1); namespace OC\Core\Command\Background; +use OC\Core\Command\Base; use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; +use OCP\BackgroundJob\QueuedJob; +use OCP\BackgroundJob\TimedJob; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Output\OutputInterface; -abstract class JobBase extends \OC\Core\Command\Base { +abstract class JobBase extends Base { public function __construct( protected IJobList $jobList, @@ -41,10 +44,10 @@ abstract class JobBase extends \OC\Core\Command\Base { $output->writeln('Job class: ' . get_class($job)); $output->writeln('Arguments: ' . json_encode($job->getArgument())); - $isTimedJob = $job instanceof \OCP\BackgroundJob\TimedJob; + $isTimedJob = $job instanceof TimedJob; if ($isTimedJob) { $output->writeln('Type: timed'); - } elseif ($job instanceof \OCP\BackgroundJob\QueuedJob) { + } elseif ($job instanceof QueuedJob) { $output->writeln('Type: queued'); } else { $output->writeln('Type: job'); diff --git a/core/Command/Broadcast/Test.php b/core/Command/Broadcast/Test.php index fb80ce26ff0..eb8b49bc3ee 100644 --- a/core/Command/Broadcast/Test.php +++ b/core/Command/Broadcast/Test.php @@ -44,16 +44,11 @@ class Test extends Command { $uid = $input->getArgument('uid'); $event = new class($name, $uid) extends ABroadcastedEvent { - /** @var string */ - private $name; - /** @var string */ - private $uid; - - public function __construct(string $name, - string $uid) { + public function __construct( + private string $name, + private string $uid, + ) { parent::__construct(); - $this->name = $name; - $this->uid = $uid; } public function broadcastAs(): string { diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index b5d1b9b9330..bca41407f68 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -13,9 +13,11 @@ use Doctrine\DBAL\Schema\Table; use OC\DB\Connection; use OC\DB\ConnectionFactory; use OC\DB\MigrationService; +use OC\DB\PgSqlTools; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\Types; use OCP\IConfig; +use OCP\Server; use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; @@ -159,7 +161,7 @@ class ConvertType extends Command implements CompletionAwareInterface { $this->readPassword($input, $output); /** @var Connection $fromDB */ - $fromDB = \OC::$server->get(Connection::class); + $fromDB = Server::get(Connection::class); $toDB = $this->getToDBConnection($input, $output); if ($input->getOption('clear-schema')) { @@ -401,7 +403,7 @@ class ConvertType extends Command implements CompletionAwareInterface { $this->copyTable($fromDB, $toDB, $schema->getTable($table), $input, $output); } if ($input->getArgument('type') === 'pgsql') { - $tools = new \OC\DB\PgSqlTools($this->config); + $tools = new PgSqlTools($this->config); $tools->resynchronizeDatabaseSequences($toDB); } // save new database config diff --git a/core/Command/Encryption/ListModules.php b/core/Command/Encryption/ListModules.php index b1f35b05bc9..bf02c29f432 100644 --- a/core/Command/Encryption/ListModules.php +++ b/core/Command/Encryption/ListModules.php @@ -57,7 +57,7 @@ class ListModules extends Base { */ protected function writeModuleList(InputInterface $input, OutputInterface $output, $items) { if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { - array_walk($items, function (&$item) { + array_walk($items, function (&$item): void { if (!$item['default']) { $item = $item['displayName']; } else { diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index c21c2e666fb..287bd0e29cb 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -9,6 +9,7 @@ namespace OC\Core\Command\Info; use OC\Files\ObjectStore\ObjectStoreStorage; use OC\Files\Storage\Wrapper\Encryption; +use OC\Files\Storage\Wrapper\Wrapper; use OC\Files\View; use OCA\Files_External\Config\ExternalMountPoint; use OCA\GroupFolders\Mount\GroupMountPoint; @@ -176,7 +177,7 @@ class File extends Command { if ($input->getOption('storage-tree')) { $storageTmp = $storage; $storageClass = get_class($storageTmp) . ' (cache:' . get_class($storageTmp->getCache()) . ')'; - while ($storageTmp instanceof \OC\Files\Storage\Wrapper\Wrapper) { + while ($storageTmp instanceof Wrapper) { $storageTmp = $storageTmp->getWrapperStorage(); $storageClass .= "\n\t" . '> ' . get_class($storageTmp) . ' (cache:' . get_class($storageTmp->getCache()) . ')'; } diff --git a/core/Command/Info/FileUtils.php b/core/Command/Info/FileUtils.php index 5de5f5fcaa6..bc07535a289 100644 --- a/core/Command/Info/FileUtils.php +++ b/core/Command/Info/FileUtils.php @@ -8,11 +8,13 @@ declare(strict_types=1); namespace OC\Core\Command\Info; +use OC\User\NoUserException; use OCA\Circles\MountManager\CircleMount; use OCA\Files_External\Config\ExternalMountPoint; use OCA\Files_Sharing\SharedMount; use OCA\GroupFolders\Mount\GroupMountPoint; use OCP\Constants; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Config\IUserMountCache; use OCP\Files\FileInfo; use OCP\Files\Folder; @@ -21,22 +23,28 @@ use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountPoint; use OCP\Files\Node; use OCP\Files\NotFoundException; +use OCP\Files\NotPermittedException; +use OCP\IDBConnection; use OCP\Share\IShare; use OCP\Util; use Symfony\Component\Console\Output\OutputInterface; +/** + * @psalm-type StorageInfo array{numeric_id: int, id: string, available: bool, last_checked: ?\DateTime, files: int, mount_id: ?int} + */ class FileUtils { public function __construct( private IRootFolder $rootFolder, private IUserMountCache $userMountCache, + private IDBConnection $connection, ) { } /** * @param FileInfo $file * @return array<string, Node[]> - * @throws \OCP\Files\NotPermittedException - * @throws \OC\User\NoUserException + * @throws NotPermittedException + * @throws NoUserException */ public function getFilesByUser(FileInfo $file): array { $id = $file->getId(); @@ -218,4 +226,100 @@ class FileUtils { } return $count; } + + public function getNumericStorageId(string $id): ?int { + if (is_numeric($id)) { + return (int)$id; + } + $query = $this->connection->getQueryBuilder(); + $query->select('numeric_id') + ->from('storages') + ->where($query->expr()->eq('id', $query->createNamedParameter($id))); + $result = $query->executeQuery()->fetchOne(); + return $result ? (int)$result : null; + } + + /** + * @param int|null $limit + * @return ?StorageInfo + * @throws \OCP\DB\Exception + */ + public function getStorage(int $id): ?array { + $query = $this->connection->getQueryBuilder(); + $query->select('numeric_id', 's.id', 'available', 'last_checked', 'mount_id') + ->selectAlias($query->func()->count('fileid'), 'files') + ->from('storages', 's') + ->innerJoin('s', 'filecache', 'f', $query->expr()->eq('f.storage', 's.numeric_id')) + ->leftJoin('s', 'mounts', 'm', $query->expr()->eq('s.numeric_id', 'm.storage_id')) + ->where($query->expr()->eq('s.numeric_id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))) + ->groupBy('s.numeric_id', 's.id', 's.available', 's.last_checked', 'mount_id'); + $row = $query->executeQuery()->fetch(); + if ($row) { + return [ + 'numeric_id' => $row['numeric_id'], + 'id' => $row['id'], + 'files' => $row['files'], + 'available' => (bool)$row['available'], + 'last_checked' => $row['last_checked'] ? new \DateTime('@' . $row['last_checked']) : null, + 'mount_id' => $row['mount_id'], + ]; + } else { + return null; + } + } + + /** + * @param int|null $limit + * @return \Iterator<StorageInfo> + * @throws \OCP\DB\Exception + */ + public function listStorages(?int $limit): \Iterator { + $query = $this->connection->getQueryBuilder(); + $query->select('numeric_id', 's.id', 'available', 'last_checked', 'mount_id') + ->selectAlias($query->func()->count('fileid'), 'files') + ->from('storages', 's') + ->innerJoin('s', 'filecache', 'f', $query->expr()->eq('f.storage', 's.numeric_id')) + ->leftJoin('s', 'mounts', 'm', $query->expr()->eq('s.numeric_id', 'm.storage_id')) + ->groupBy('s.numeric_id', 's.id', 's.available', 's.last_checked', 'mount_id') + ->orderBy('files', 'DESC'); + if ($limit !== null) { + $query->setMaxResults($limit); + } + $result = $query->executeQuery(); + while ($row = $result->fetch()) { + yield [ + 'numeric_id' => $row['numeric_id'], + 'id' => $row['id'], + 'files' => $row['files'], + 'available' => (bool)$row['available'], + 'last_checked' => $row['last_checked'] ? new \DateTime('@' . $row['last_checked']) : null, + 'mount_id' => $row['mount_id'], + ]; + } + } + + /** + * @param StorageInfo $storage + * @return array + */ + public function formatStorage(array $storage): array { + return [ + 'numeric_id' => $storage['numeric_id'], + 'id' => $storage['id'], + 'files' => $storage['files'], + 'available' => $storage['available'] ? 'true' : 'false', + 'last_checked' => $storage['last_checked']?->format(\DATE_ATOM), + 'external_mount_id' => $storage['mount_id'], + ]; + } + + /** + * @param \Iterator<StorageInfo> $storages + * @return \Iterator + */ + public function formatStorages(\Iterator $storages): \Iterator { + foreach ($storages as $storage) { + yield $this->formatStorage($storage); + } + } } diff --git a/core/Command/Info/Storage.php b/core/Command/Info/Storage.php new file mode 100644 index 00000000000..c1d0e1725ca --- /dev/null +++ b/core/Command/Info/Storage.php @@ -0,0 +1,49 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OC\Core\Command\Info; + +use OC\Core\Command\Base; +use OCP\IDBConnection; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class Storage extends Base { + public function __construct( + private readonly IDBConnection $connection, + private readonly FileUtils $fileUtils, + ) { + parent::__construct(); + } + + protected function configure(): void { + parent::configure(); + $this + ->setName('info:storage') + ->setDescription('Get information a single storage') + ->addArgument('storage', InputArgument::REQUIRED, 'Storage to get information for'); + } + + public function execute(InputInterface $input, OutputInterface $output): int { + $storage = $input->getArgument('storage'); + $storageId = $this->fileUtils->getNumericStorageId($storage); + if (!$storageId) { + $output->writeln('<error>No storage with id ' . $storage . ' found</error>'); + return 1; + } + + $info = $this->fileUtils->getStorage($storageId); + if (!$info) { + $output->writeln('<error>No storage with id ' . $storage . ' found</error>'); + return 1; + } + $this->writeArrayInOutputFormat($input, $output, $this->fileUtils->formatStorage($info)); + return 0; + } +} diff --git a/core/Command/Info/Storages.php b/core/Command/Info/Storages.php new file mode 100644 index 00000000000..ff767a2ff5d --- /dev/null +++ b/core/Command/Info/Storages.php @@ -0,0 +1,43 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OC\Core\Command\Info; + +use OC\Core\Command\Base; +use OCP\IDBConnection; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +class Storages extends Base { + public function __construct( + private readonly IDBConnection $connection, + private readonly FileUtils $fileUtils, + ) { + parent::__construct(); + } + + protected function configure(): void { + parent::configure(); + $this + ->setName('info:storages') + ->setDescription('List storages ordered by the number of files') + ->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'Number of storages to display', 25) + ->addOption('all', 'a', InputOption::VALUE_NONE, 'Display all storages'); + } + + public function execute(InputInterface $input, OutputInterface $output): int { + $count = (int)$input->getOption('count'); + $all = $input->getOption('all'); + + $limit = $all ? null : $count; + $storages = $this->fileUtils->listStorages($limit); + $this->writeStreamingTableInOutputFormat($input, $output, $this->fileUtils->formatStorages($storages), 100); + return 0; + } +} diff --git a/core/Command/Log/File.php b/core/Command/Log/File.php index 8b4a38db611..ba5dad956e9 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -8,6 +8,7 @@ namespace OC\Core\Command\Log; use OCP\IConfig; +use OCP\Util; use Stecman\Component\Symfony\Console\BashCompletion\Completion; use Stecman\Component\Symfony\Console\BashCompletion\Completion\ShellPathCompletion; @@ -61,7 +62,7 @@ class File extends Command implements Completion\CompletionAwareInterface { } if (($rotateSize = $input->getOption('rotate-size')) !== null) { - $rotateSize = \OCP\Util::computerFileSize($rotateSize); + $rotateSize = Util::computerFileSize($rotateSize); $this->validateRotateSize($rotateSize); $toBeSet['log_rotate_size'] = $rotateSize; } @@ -87,7 +88,7 @@ class File extends Command implements Completion\CompletionAwareInterface { $rotateSize = $this->config->getSystemValue('log_rotate_size', 100 * 1024 * 1024); if ($rotateSize) { - $rotateString = \OCP\Util::humanFileSize($rotateSize); + $rotateString = Util::humanFileSize($rotateSize); } else { $rotateString = 'disabled'; } diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index d23a8d30070..84fd832e016 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -15,6 +15,7 @@ use OC\Console\TimestampFormatter; use OC\Migration\ConsoleOutput; use OC\Setup; use OC\SystemConfig; +use OCP\Server; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; @@ -51,7 +52,7 @@ class Install extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { // validate the environment - $setupHelper = \OCP\Server::get(\OC\Setup::class); + $setupHelper = Server::get(Setup::class); $sysInfo = $setupHelper->getSystemInfo(true); $errors = $sysInfo['errors']; if (count($errors) > 0) { diff --git a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php index 5b598d20672..60445b4b117 100644 --- a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php +++ b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php @@ -15,7 +15,7 @@ class GenerateMimetypeFileBuilder { * @param array<string,string> $aliases * @return string */ - public function generateFile(array $aliases): string { + public function generateFile(array $aliases, array $names): string { // Remove comments $aliases = array_filter($aliases, static function ($key) { // Single digit extensions will be treated as integers @@ -71,6 +71,15 @@ class GenerateMimetypeFileBuilder { sort($themes[$theme]); } + $namesOutput = ''; + foreach ($names as $key => $name) { + if (str_starts_with($key, '_')) { + // Skip internal names + continue; + } + $namesOutput .= "'$key': t('core', " . json_encode($name) . "),\n"; + } + //Generate the JS return '/** * This file is automatically generated @@ -83,7 +92,8 @@ class GenerateMimetypeFileBuilder { OC.MimeTypeList={ aliases: ' . json_encode($aliases, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . ', files: ' . json_encode($files, JSON_PRETTY_PRINT) . ', - themes: ' . json_encode($themes, JSON_PRETTY_PRINT) . ' + themes: ' . json_encode($themes, JSON_PRETTY_PRINT) . ', + names: {' . $namesOutput . '}, }; '; } diff --git a/core/Command/Maintenance/Mimetype/UpdateJS.php b/core/Command/Maintenance/Mimetype/UpdateJS.php index 35633f16355..2132ff54c6d 100644 --- a/core/Command/Maintenance/Mimetype/UpdateJS.php +++ b/core/Command/Maintenance/Mimetype/UpdateJS.php @@ -32,7 +32,8 @@ class UpdateJS extends Command { // Output the JS $generatedMimetypeFile = new GenerateMimetypeFileBuilder(); - file_put_contents(\OC::$SERVERROOT . '/core/js/mimetypelist.js', $generatedMimetypeFile->generateFile($aliases)); + $namings = $this->mimetypeDetector->getAllNamings(); + file_put_contents(\OC::$SERVERROOT . '/core/js/mimetypelist.js', $generatedMimetypeFile->generateFile($aliases, $namings)); $output->writeln('<info>mimetypelist.js is updated'); return 0; diff --git a/core/Command/Maintenance/UpdateHtaccess.php b/core/Command/Maintenance/UpdateHtaccess.php index 4939e368e2d..eeff3bf8c62 100644 --- a/core/Command/Maintenance/UpdateHtaccess.php +++ b/core/Command/Maintenance/UpdateHtaccess.php @@ -7,6 +7,7 @@ */ namespace OC\Core\Command\Maintenance; +use OC\Setup; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -19,7 +20,7 @@ class UpdateHtaccess extends Command { } protected function execute(InputInterface $input, OutputInterface $output): int { - if (\OC\Setup::updateHtaccess()) { + if (Setup::updateHtaccess()) { $output->writeln('.htaccess has been updated'); return 0; } else { diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php index 3ccd8231300..a92a4cf8ed0 100644 --- a/core/Command/Preview/Repair.php +++ b/core/Command/Preview/Repair.php @@ -86,7 +86,7 @@ class Repair extends Command { $output->writeln(''); $output->writeln('Fetching previews that need to be migrated …'); - /** @var \OCP\Files\Folder $currentPreviewFolder */ + /** @var Folder $currentPreviewFolder */ $currentPreviewFolder = $this->rootFolder->get("appdata_$instanceId/preview"); $directoryListing = $currentPreviewFolder->getDirectoryListing(); diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index 6220c9a70d4..1b6fe369ceb 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -21,6 +21,7 @@ use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IURLGenerator; +use OCP\Server; use OCP\Util; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; @@ -63,11 +64,11 @@ class Upgrade extends Command { } $self = $this; - $updater = \OCP\Server::get(Updater::class); + $updater = Server::get(Updater::class); $incompatibleOverwrites = $this->config->getSystemValue('app_install_overwrite', []); /** @var IEventDispatcher $dispatcher */ - $dispatcher = \OC::$server->get(IEventDispatcher::class); + $dispatcher = Server::get(IEventDispatcher::class); $progress = new ProgressBar($output); $progress->setFormat(" %message%\n %current%/%max% [%bar%] %percent:3s%%"); $listener = function (MigratorExecuteSqlEvent $event) use ($progress, $output): void { @@ -132,17 +133,17 @@ class Upgrade extends Command { $dispatcher->addListener(RepairErrorEvent::class, $repairListener); - $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($output) { + $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($output): void { $output->writeln('<info>Turned on maintenance mode</info>'); }); - $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($output) { + $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($output): void { $output->writeln('<info>Turned off maintenance mode</info>'); }); - $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($output) { + $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($output): void { $output->writeln('<info>Maintenance mode is kept active</info>'); }); $updater->listen('\OC\Updater', 'updateEnd', - function ($success) use ($output, $self) { + function ($success) use ($output, $self): void { if ($success) { $message = '<info>Update successful</info>'; } else { @@ -150,42 +151,42 @@ class Upgrade extends Command { } $output->writeln($message); }); - $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($output) { + $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($output): void { $output->writeln('<info>Updating database schema</info>'); }); - $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($output) { + $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($output): void { $output->writeln('<info>Updated database</info>'); }); - $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use ($output, &$incompatibleOverwrites) { + $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use ($output, &$incompatibleOverwrites): void { if (!in_array($app, $incompatibleOverwrites)) { $output->writeln('<comment>Disabled incompatible app: ' . $app . '</comment>'); } }); - $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($output) { + $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($output): void { $output->writeln('<info>Update app ' . $app . ' from App Store</info>'); }); - $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($output) { + $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($output): void { $output->writeln("<info>Checking whether the database schema for <$app> can be updated (this can take a long time depending on the database size)</info>"); }); - $updater->listen('\OC\Updater', 'appUpgradeStarted', function ($app, $version) use ($output) { + $updater->listen('\OC\Updater', 'appUpgradeStarted', function ($app, $version) use ($output): void { $output->writeln("<info>Updating <$app> ...</info>"); }); - $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output) { + $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output): void { $output->writeln("<info>Updated <$app> to $version</info>"); }); - $updater->listen('\OC\Updater', 'failure', function ($message) use ($output, $self) { + $updater->listen('\OC\Updater', 'failure', function ($message) use ($output, $self): void { $output->writeln("<error>$message</error>"); }); - $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($output) { + $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($output): void { $output->writeln('<info>Setting log level to debug</info>'); }); - $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($output) { + $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($output): void { $output->writeln('<info>Resetting log level</info>'); }); - $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($output) { + $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($output): void { $output->writeln('<info>Starting code integrity check...</info>'); }); - $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($output) { + $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($output): void { $output->writeln('<info>Finished code integrity check</info>'); }); diff --git a/core/Command/User/Info.php b/core/Command/User/Info.php index 6487b533fa2..220bbbf571d 100644 --- a/core/Command/User/Info.php +++ b/core/Command/User/Info.php @@ -6,6 +6,7 @@ namespace OC\Core\Command\User; use OC\Core\Command\Base; +use OCP\Files\NotFoundException; use OCP\IGroupManager; use OCP\IUser; use OCP\IUserManager; @@ -84,7 +85,7 @@ class Info extends Base { \OC_Util::setupFS($user->getUID()); try { $storage = \OC_Helper::getStorageInfo('/'); - } catch (\OCP\Files\NotFoundException $e) { + } catch (NotFoundException $e) { return []; } return [ diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php index dbb611a4fff..984def72cd6 100644 --- a/core/Command/User/LastSeen.php +++ b/core/Command/User/LastSeen.php @@ -68,7 +68,7 @@ class LastSeen extends Base { return 1; } - $this->userManager->callForAllUsers(static function (IUser $user) use ($output) { + $this->userManager->callForAllUsers(static function (IUser $user) use ($output): void { $lastLogin = $user->getLastLogin(); if ($lastLogin === 0) { $output->writeln($user->getUID() . ' has never logged in.'); diff --git a/core/Command/User/SyncAccountDataCommand.php b/core/Command/User/SyncAccountDataCommand.php index 640b66581e1..3e3ba3961ee 100644 --- a/core/Command/User/SyncAccountDataCommand.php +++ b/core/Command/User/SyncAccountDataCommand.php @@ -16,15 +16,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class SyncAccountDataCommand extends Base { - protected IUserManager $userManager; - protected IAccountManager $accountManager; - public function __construct( - IUserManager $userManager, - IAccountManager $accountManager, + protected IUserManager $userManager, + protected IAccountManager $accountManager, ) { - $this->userManager = $userManager; - $this->accountManager = $accountManager; parent::__construct(); } diff --git a/core/Command/User/Welcome.php b/core/Command/User/Welcome.php index c383811f982..35ce32ff174 100644 --- a/core/Command/User/Welcome.php +++ b/core/Command/User/Welcome.php @@ -15,24 +15,15 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Welcome extends Base { - /** @var IUserManager */ - protected $userManager; - - /** @var NewUserMailHelper */ - private $newUserMailHelper; - /** * @param IUserManager $userManager * @param NewUserMailHelper $newUserMailHelper */ public function __construct( - IUserManager $userManager, - NewUserMailHelper $newUserMailHelper, + protected IUserManager $userManager, + private NewUserMailHelper $newUserMailHelper, ) { parent::__construct(); - - $this->userManager = $userManager; - $this->newUserMailHelper = $newUserMailHelper; } /** diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index 16ec124e23a..41a45926ba7 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -20,6 +20,7 @@ use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired; use OCP\AppFramework\Http\Attribute\UseSession; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSForbiddenException; +use OCP\AppFramework\OCSController; use OCP\Authentication\Exceptions\CredentialsUnavailableException; use OCP\Authentication\Exceptions\InvalidTokenException; use OCP\Authentication\Exceptions\PasswordUnavailableException; @@ -31,7 +32,7 @@ use OCP\IUserManager; use OCP\Security\Bruteforce\IThrottler; use OCP\Security\ISecureRandom; -class AppPasswordController extends \OCP\AppFramework\OCSController { +class AppPasswordController extends OCSController { public function __construct( string $appName, IRequest $request, diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index f25a2d52752..4e7a2f8714a 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -8,6 +8,7 @@ namespace OC\Core\Controller; use OC\AppFramework\Utility\TimeFactory; +use OC\NotSquareException; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\FrontpageRoute; @@ -21,9 +22,11 @@ use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\Response; use OCP\Files\File; use OCP\Files\IRootFolder; +use OCP\Files\NotPermittedException; use OCP\IAvatarManager; use OCP\ICache; use OCP\IL10N; +use OCP\Image; use OCP\IRequest; use OCP\IUserManager; use Psr\Log\LoggerInterface; @@ -182,7 +185,7 @@ class AvatarController extends Controller { try { $content = $node->getContent(); - } catch (\OCP\Files\NotPermittedException $e) { + } catch (NotPermittedException $e) { return new JSONResponse( ['data' => ['message' => $this->l10n->t('The selected file cannot be read.')]], Http::STATUS_BAD_REQUEST @@ -229,7 +232,7 @@ class AvatarController extends Controller { } try { - $image = new \OCP\Image(); + $image = new Image(); $image->loadFromData($content); $image->readExif($content); $image->fixOrientation(); @@ -300,7 +303,7 @@ class AvatarController extends Controller { Http::STATUS_NOT_FOUND); } - $image = new \OCP\Image(); + $image = new Image(); $image->loadFromData($tmpAvatar); $resp = new DataDisplayResponse( @@ -335,7 +338,7 @@ class AvatarController extends Controller { Http::STATUS_BAD_REQUEST); } - $image = new \OCP\Image(); + $image = new Image(); $image->loadFromData($tmpAvatar); $image->crop($crop['x'], $crop['y'], (int)round($crop['w']), (int)round($crop['h'])); try { @@ -344,7 +347,7 @@ class AvatarController extends Controller { // Clean up $this->cache->remove('tmpAvatar'); return new JSONResponse(['status' => 'success']); - } catch (\OC\NotSquareException $e) { + } catch (NotSquareException $e) { return new JSONResponse(['data' => ['message' => $this->l10n->t('Crop is not square')]], Http::STATUS_BAD_REQUEST); } catch (\Exception $e) { diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 99074e6ff59..affb60f2b2e 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -19,6 +19,8 @@ use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UseSession; +use OCP\AppFramework\Http\ContentSecurityPolicy; +use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\StandaloneTemplateResponse; use OCP\AppFramework\Utility\ITimeFactory; @@ -124,7 +126,7 @@ class ClientFlowLoginController extends Controller { ); $this->session->set(self::STATE_NAME, $stateToken); - $csp = new Http\ContentSecurityPolicy(); + $csp = new ContentSecurityPolicy(); if ($client) { $csp->addAllowedFormActionDomain($client->getRedirectUri()); } else { @@ -177,7 +179,7 @@ class ClientFlowLoginController extends Controller { $clientName = $client->getName(); } - $csp = new Http\ContentSecurityPolicy(); + $csp = new ContentSecurityPolicy(); if ($client) { $csp->addAllowedFormActionDomain($client->getRedirectUri()); } else { @@ -313,7 +315,7 @@ class ClientFlowLoginController extends Controller { new AppPasswordCreatedEvent($generatedToken) ); - return new Http\RedirectResponse($redirectUri); + return new RedirectResponse($redirectUri); } #[PublicPage] @@ -342,7 +344,7 @@ class ClientFlowLoginController extends Controller { } $redirectUri = 'nc://login/server:' . $this->getServerPath() . '&user:' . urlencode($user) . '&password:' . urlencode($password); - return new Http\RedirectResponse($redirectUri); + return new RedirectResponse($redirectUri); } private function getServerPath(): string { diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index b4a7622161f..e21a0cb250d 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -34,6 +34,7 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserSession; use OCP\Security\ISecureRandom; +use OCP\Server; /** * @psalm-import-type CoreLoginFlowV2Credentials from ResponseDefinitions @@ -204,7 +205,7 @@ class ClientFlowLoginV2Controller extends Controller { $this->session->remove(self::STATE_NAME); try { - $token = \OC::$server->get(\OC\Authentication\Token\IProvider::class)->getToken($password); + $token = Server::get(\OC\Authentication\Token\IProvider::class)->getToken($password); if ($token->getLoginName() !== $user) { throw new InvalidTokenException('login name does not match'); } diff --git a/core/Controller/ErrorController.php b/core/Controller/ErrorController.php index 55925ffc941..d80dc3f76eb 100644 --- a/core/Controller/ErrorController.php +++ b/core/Controller/ErrorController.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace OC\Core\Controller; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; @@ -17,7 +18,7 @@ use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\TemplateResponse; #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] -class ErrorController extends \OCP\AppFramework\Controller { +class ErrorController extends Controller { #[PublicPage] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: 'error/403')] diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php index 7eef6828fec..818b25a0c80 100644 --- a/core/Controller/GuestAvatarController.php +++ b/core/Controller/GuestAvatarController.php @@ -76,7 +76,7 @@ class GuestAvatarController extends Controller { $this->logger->error('error while creating guest avatar', [ 'err' => $e, ]); - $resp = new Http\Response(); + $resp = new Response(); $resp->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); return $resp; } diff --git a/core/Controller/HoverCardController.php b/core/Controller/HoverCardController.php index 7a816e21d14..236a81760ac 100644 --- a/core/Controller/HoverCardController.php +++ b/core/Controller/HoverCardController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; use OCP\IRequest; use OCP\IUserSession; use OCP\Share\IShare; @@ -20,7 +21,7 @@ use OCP\Share\IShare; /** * @psalm-import-type CoreContactsAction from ResponseDefinitions */ -class HoverCardController extends \OCP\AppFramework\OCSController { +class HoverCardController extends OCSController { public function __construct( IRequest $request, private IUserSession $userSession, diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index ed884460b43..7e8afd9f083 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -29,6 +29,7 @@ use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UseSession; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\RedirectResponse; +use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\Defaults; @@ -42,6 +43,7 @@ use OCP\IUserManager; use OCP\Notification\IManager; use OCP\Security\Bruteforce\IThrottler; use OCP\Security\ITrustedDomainHelper; +use OCP\Server; use OCP\Util; class LoginController extends Controller { @@ -111,7 +113,7 @@ class LoginController extends Controller { #[UseSession] #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[FrontpageRoute(verb: 'GET', url: '/login')] - public function showLoginForm(?string $user = null, ?string $redirect_url = null): Http\Response { + public function showLoginForm(?string $user = null, ?string $redirect_url = null): Response { if ($this->userSession->isLoggedIn()) { return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl()); } @@ -224,7 +226,7 @@ class LoginController extends Controller { // check if user_ldap is enabled, and the required classes exist if ($this->appManager->isAppLoaded('user_ldap') && class_exists(Helper::class)) { - $helper = \OCP\Server::get(Helper::class); + $helper = Server::get(Helper::class); $allPrefixes = $helper->getServerConfigurationPrefixes(); // check each LDAP server the user is connected too foreach ($allPrefixes as $prefix) { diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 001ab737c7e..f940a3cfeee 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -14,6 +14,7 @@ use OC\Core\Events\PasswordResetEvent; use OC\Core\Exception\ResetPasswordException; use OC\Security\RateLimiting\Exception\RateLimitExceededException; use OC\Security\RateLimiting\Limiter; +use OC\User\Session; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Attribute\AnonRateLimit; use OCP\AppFramework\Http\Attribute\BruteForceProtection; @@ -36,8 +37,11 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use OCP\Mail\IMailer; +use OCP\PreConditionNotMetException; use OCP\Security\VerificationToken\InvalidTokenException; use OCP\Security\VerificationToken\IVerificationToken; +use OCP\Server; +use OCP\Util; use Psr\Log\LoggerInterface; use function array_filter; use function count; @@ -52,8 +56,6 @@ use function reset; */ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] class LostController extends Controller { - protected string $from; - public function __construct( string $appName, IRequest $request, @@ -62,7 +64,7 @@ class LostController extends Controller { private Defaults $defaults, private IL10N $l10n, private IConfig $config, - string $defaultMailAddress, + protected string $from, private IManager $encryptionManager, private IMailer $mailer, private LoggerInterface $logger, @@ -73,7 +75,6 @@ class LostController extends Controller { private Limiter $limiter, ) { parent::__construct($appName, $request); - $this->from = $defaultMailAddress; } /** @@ -158,7 +159,7 @@ class LostController extends Controller { return new JSONResponse($this->error($this->l10n->t('Unsupported email length (>255)'))); } - \OCP\Util::emitHook( + Util::emitHook( '\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', ['uid' => &$user] @@ -217,7 +218,7 @@ class LostController extends Controller { $this->twoFactorManager->clearTwoFactorPending($userId); $this->config->deleteUserValue($userId, 'core', 'lostpassword'); - @\OC::$server->getUserSession()->unsetMagicInCookie(); + @Server::get(Session::class)->unsetMagicInCookie(); } catch (HintException $e) { $response = new JSONResponse($this->error($e->getHint())); $response->throttle(); @@ -233,7 +234,7 @@ class LostController extends Controller { /** * @throws ResetPasswordException - * @throws \OCP\PreConditionNotMetException + * @throws PreConditionNotMetException */ protected function sendEmail(string $input): void { $user = $this->findUserByIdOrMail($input); diff --git a/core/Controller/OCMController.php b/core/Controller/OCMController.php index 40d53cf7a97..2d3b99f431d 100644 --- a/core/Controller/OCMController.php +++ b/core/Controller/OCMController.php @@ -10,6 +10,7 @@ declare(strict_types=1); namespace OC\Core\Controller; use Exception; +use OCA\CloudFederationAPI\Capabilities; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\FrontpageRoute; @@ -58,7 +59,7 @@ class OCMController extends Controller { $cap = Server::get( $this->appConfig->getValueString( 'core', 'ocm_providers', - \OCA\CloudFederationAPI\Capabilities::class, + Capabilities::class, lazy: true ) ); diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 65ce55b8606..b05ddd0e298 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -17,6 +17,7 @@ use OCP\IRequest; use OCP\IUserManager; use OCP\IUserSession; use OCP\ServerVersion; +use OCP\Util; class OCSController extends \OCP\AppFramework\OCSController { public function __construct( @@ -63,7 +64,7 @@ class OCSController extends \OCP\AppFramework\OCSController { 'micro' => $this->serverVersion->getPatchVersion(), 'string' => $this->serverVersion->getVersionString(), 'edition' => '', - 'extendedSupport' => \OCP\Util::hasExtendedSupport() + 'extendedSupport' => Util::hasExtendedSupport() ]; if ($this->userSession->isLoggedIn()) { diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 0e4c71380ec..ea90be31078 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -18,6 +18,7 @@ use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\RedirectResponse; +use OCP\AppFramework\Http\Response; use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\Files\Node; @@ -68,7 +69,7 @@ class PreviewController extends Controller { bool $a = false, bool $forceIcon = true, string $mode = 'fill', - bool $mimeFallback = false): Http\Response { + bool $mimeFallback = false): Response { if ($file === '' || $x === 0 || $y === 0) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -137,7 +138,7 @@ class PreviewController extends Controller { bool $a, bool $forceIcon, string $mode, - bool $mimeFallback = false) : Http\Response { + bool $mimeFallback = false) : Response { if (!($node instanceof File) || (!$forceIcon && !$this->preview->isAvailable($node))) { return new DataResponse([], Http::STATUS_NOT_FOUND); } diff --git a/core/Controller/ReferenceApiController.php b/core/Controller/ReferenceApiController.php index 099fdb97194..d4fb753f404 100644 --- a/core/Controller/ReferenceApiController.php +++ b/core/Controller/ReferenceApiController.php @@ -15,6 +15,7 @@ use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; use OCP\Collaboration\Reference\IDiscoverableReferenceProvider; use OCP\Collaboration\Reference\IReferenceManager; use OCP\Collaboration\Reference\Reference; @@ -24,7 +25,7 @@ use OCP\IRequest; * @psalm-import-type CoreReference from ResponseDefinitions * @psalm-import-type CoreReferenceProvider from ResponseDefinitions */ -class ReferenceApiController extends \OCP\AppFramework\OCSController { +class ReferenceApiController extends OCSController { private const LIMIT_MAX = 15; public function __construct( diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 58ed599da3b..f89506680ad 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -7,9 +7,11 @@ */ namespace OC\Core\Controller; +use OC\IntegrityCheck\Checker; use OC\Setup; use OCP\IInitialStateService; use OCP\IURLGenerator; +use OCP\Server; use OCP\Template\ITemplateManager; use OCP\Util; use Psr\Log\LoggerInterface; @@ -104,13 +106,13 @@ class SetupController { if (file_exists($this->autoConfigFile)) { unlink($this->autoConfigFile); } - \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); + Server::get(Checker::class)->runInstanceVerification(); if ($this->setupHelper->shouldRemoveCanInstallFile()) { $this->templateManager->printGuestPage('', 'installation_incomplete'); } - header('Location: ' . \OC::$server->getURLGenerator()->getAbsoluteURL('index.php/core/apps/recommended')); + header('Location: ' . Server::get(IURLGenerator::class)->getAbsoluteURL('index.php/core/apps/recommended')); exit(); } diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 2f5a81ea7a8..cf62b4f6b6b 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -17,10 +17,12 @@ use OCP\AppFramework\Http\Attribute\AnonRateLimit; use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\ExAppRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataDownloadResponse; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; use OCP\Files\File; use OCP\Files\GenericFileException; use OCP\Files\IAppData; @@ -45,7 +47,7 @@ use stdClass; * @psalm-import-type CoreTaskProcessingTask from ResponseDefinitions * @psalm-import-type CoreTaskProcessingTaskType from ResponseDefinitions */ -class TaskProcessingApiController extends \OCP\AppFramework\OCSController { +class TaskProcessingApiController extends OCSController { public function __construct( string $appName, IRequest $request, @@ -306,9 +308,9 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * 404: Task or file not found */ #[NoAdminRequired] - #[Http\Attribute\NoCSRFRequired] + #[NoCSRFRequired] #[ApiRoute(verb: 'GET', url: '/tasks/{taskId}/file/{fileId}', root: '/taskprocessing')] - public function getFileContents(int $taskId, int $fileId): Http\DataDownloadResponse|DataResponse { + public function getFileContents(int $taskId, int $fileId): DataDownloadResponse|DataResponse { try { $task = $this->taskProcessingManager->getUserTask($taskId, $this->userId); return $this->getFileContentsInternal($task, $fileId); @@ -331,7 +333,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { */ #[ExAppRequired] #[ApiRoute(verb: 'GET', url: '/tasks_provider/{taskId}/file/{fileId}', root: '/taskprocessing')] - public function getFileContentsExApp(int $taskId, int $fileId): Http\DataDownloadResponse|DataResponse { + public function getFileContentsExApp(int $taskId, int $fileId): DataDownloadResponse|DataResponse { try { $task = $this->taskProcessingManager->getTask($taskId); return $this->getFileContentsInternal($task, $fileId); @@ -384,7 +386,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * * @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> */ - private function getFileContentsInternal(Task $task, int $fileId): Http\DataDownloadResponse|DataResponse { + private function getFileContentsInternal(Task $task, int $fileId): DataDownloadResponse|DataResponse { $ids = $this->extractFileIdsFromTask($task); if (!in_array($fileId, $ids)) { return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND); @@ -401,7 +403,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { } elseif (!$node instanceof File) { throw new NotFoundException('Node is not a file'); } - return new Http\DataDownloadResponse($node->getContent(), $node->getName(), $node->getMimeType()); + return new DataDownloadResponse($node->getContent(), $node->getName(), $node->getMimeType()); } /** diff --git a/core/Controller/TeamsApiController.php b/core/Controller/TeamsApiController.php index 36685555d4d..2eb33a0c254 100644 --- a/core/Controller/TeamsApiController.php +++ b/core/Controller/TeamsApiController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; use OCP\IRequest; use OCP\Teams\ITeamManager; use OCP\Teams\Team; @@ -22,7 +23,7 @@ use OCP\Teams\Team; * @psalm-import-type CoreTeam from ResponseDefinitions * @property $userId string */ -class TeamsApiController extends \OCP\AppFramework\OCSController { +class TeamsApiController extends OCSController { public function __construct( string $appName, IRequest $request, diff --git a/core/Controller/TextProcessingApiController.php b/core/Controller/TextProcessingApiController.php index cdf39563167..d3e6967f169 100644 --- a/core/Controller/TextProcessingApiController.php +++ b/core/Controller/TextProcessingApiController.php @@ -19,6 +19,7 @@ use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; use OCP\Common\Exception\NotFoundException; use OCP\DB\Exception; use OCP\IL10N; @@ -36,7 +37,7 @@ use Psr\Log\LoggerInterface; /** * @psalm-import-type CoreTextProcessingTask from ResponseDefinitions */ -class TextProcessingApiController extends \OCP\AppFramework\OCSController { +class TextProcessingApiController extends OCSController { public function __construct( string $appName, IRequest $request, diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index 3ffc868e80f..d2c3e1ec288 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -21,6 +21,7 @@ use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; +use OCP\AppFramework\OCSController; use OCP\DB\Exception; use OCP\Files\NotFoundException; use OCP\IL10N; @@ -34,7 +35,7 @@ use OCP\TextToImage\Task; /** * @psalm-import-type CoreTextToImageTask from ResponseDefinitions */ -class TextToImageApiController extends \OCP\AppFramework\OCSController { +class TextToImageApiController extends OCSController { public function __construct( string $appName, IRequest $request, diff --git a/core/Controller/TranslationApiController.php b/core/Controller/TranslationApiController.php index 294251baa47..73dd0657230 100644 --- a/core/Controller/TranslationApiController.php +++ b/core/Controller/TranslationApiController.php @@ -17,13 +17,14 @@ use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; use OCP\IL10N; use OCP\IRequest; use OCP\PreConditionNotMetException; use OCP\Translation\CouldNotTranslateException; use OCP\Translation\ITranslationManager; -class TranslationApiController extends \OCP\AppFramework\OCSController { +class TranslationApiController extends OCSController { public function __construct( string $appName, IRequest $request, diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 86192d8f466..b3bb7becbac 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -19,6 +19,7 @@ use OCP\IRequest; use OCP\IUserManager; use OCP\IUserSession; use OCP\L10N\IFactory; +use OCP\PreConditionNotMetException; use OCP\ServerVersion; class WhatsNewController extends OCSController { @@ -88,7 +89,7 @@ class WhatsNewController extends OCSController { * @param string $version Version to dismiss the changes for * * @return DataResponse<Http::STATUS_OK, list<empty>, array{}> - * @throws \OCP\PreConditionNotMetException + * @throws PreConditionNotMetException * @throws DoesNotExistException * * 200: Changes dismissed diff --git a/core/Migrations/Version14000Date20180626223656.php b/core/Migrations/Version14000Date20180626223656.php index 8c3e81303bc..3a08fb45c20 100644 --- a/core/Migrations/Version14000Date20180626223656.php +++ b/core/Migrations/Version14000Date20180626223656.php @@ -6,10 +6,11 @@ namespace OC\Core\Migrations; use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version14000Date20180626223656 extends SimpleMigrationStep { - public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) { + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); if (!$schema->hasTable('whats_new')) { diff --git a/core/Migrations/Version14000Date20180712153140.php b/core/Migrations/Version14000Date20180712153140.php index d719b0f803c..4d27a60bbb4 100644 --- a/core/Migrations/Version14000Date20180712153140.php +++ b/core/Migrations/Version14000Date20180712153140.php @@ -6,6 +6,7 @@ namespace OC\Core\Migrations; use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; /** @@ -14,7 +15,7 @@ use OCP\Migration\SimpleMigrationStep; * Class Version14000Date20180712153140 */ class Version14000Date20180712153140 extends SimpleMigrationStep { - public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) { + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/ajax/update.php b/core/ajax/update.php index 0868eff72b4..798a81ff6ee 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -6,6 +6,8 @@ * SPDX-License-Identifier: AGPL-3.0-only */ use OC\DB\MigratorExecuteSqlEvent; +use OC\Installer; +use OC\IntegrityCheck\Checker; use OC\Repair\Events\RepairAdvanceEvent; use OC\Repair\Events\RepairErrorEvent; use OC\Repair\Events\RepairFinishEvent; @@ -13,6 +15,8 @@ use OC\Repair\Events\RepairInfoEvent; use OC\Repair\Events\RepairStartEvent; use OC\Repair\Events\RepairStepEvent; use OC\Repair\Events\RepairWarningEvent; +use OC\SystemConfig; +use OC\Updater; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventDispatcher; use OCP\IAppConfig; @@ -22,6 +26,8 @@ use OCP\IEventSourceFactory; use OCP\IL10N; use OCP\L10N\IFactory; use OCP\Server; +use OCP\ServerVersion; +use OCP\Util; use Psr\Log\LoggerInterface; if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) { @@ -30,10 +36,10 @@ if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) { require_once '../../lib/base.php'; -/** @var \OCP\IL10N $l */ -$l = \OC::$server->get(IFactory::class)->get('core'); +/** @var IL10N $l */ +$l = Server::get(IFactory::class)->get('core'); -$eventSource = \OC::$server->get(IEventSourceFactory::class)->create(); +$eventSource = Server::get(IEventSourceFactory::class)->create(); // need to send an initial message to force-init the event source, // which will then trigger its own CSRF check and produces its own CSRF error // message @@ -77,8 +83,8 @@ class FeedBackHandler { } } -if (\OCP\Util::needUpgrade()) { - $config = \OC::$server->getSystemConfig(); +if (Util::needUpgrade()) { + $config = Server::get(SystemConfig::class); if ($config->getValue('upgrade.disable-web', false)) { $eventSource->send('failure', $l->t('Please use the command line updater because updating via browser is disabled in your config.php.')); $eventSource->close(); @@ -90,19 +96,19 @@ if (\OCP\Util::needUpgrade()) { \OC_User::setIncognitoMode(true); $config = Server::get(IConfig::class); - $updater = new \OC\Updater( - Server::get(\OCP\ServerVersion::class), + $updater = new Updater( + Server::get(ServerVersion::class), $config, Server::get(IAppConfig::class), - \OC::$server->getIntegrityCodeChecker(), + Server::get(Checker::class), Server::get(LoggerInterface::class), - Server::get(\OC\Installer::class) + Server::get(Installer::class) ); $incompatibleApps = []; $incompatibleOverwrites = $config->getSystemValue('app_install_overwrite', []); /** @var IEventDispatcher $dispatcher */ - $dispatcher = \OC::$server->get(IEventDispatcher::class); + $dispatcher = Server::get(IEventDispatcher::class); $dispatcher->addListener( MigratorExecuteSqlEvent::class, function (MigratorExecuteSqlEvent $event) use ($eventSource, $l): void { @@ -118,50 +124,50 @@ if (\OCP\Util::needUpgrade()) { $dispatcher->addListener(RepairWarningEvent::class, [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener(RepairErrorEvent::class, [$feedBack, 'handleRepairFeedback']); - $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l): void { $eventSource->send('success', $l->t('Turned on maintenance mode')); }); - $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l): void { $eventSource->send('success', $l->t('Turned off maintenance mode')); }); - $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l): void { $eventSource->send('success', $l->t('Maintenance mode is kept active')); }); - $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l): void { $eventSource->send('success', $l->t('Updating database schema')); }); - $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l): void { $eventSource->send('success', $l->t('Updated database')); }); - $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l): void { $eventSource->send('success', $l->t('Update app "%s" from App Store', [$app])); }); - $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l): void { $eventSource->send('success', $l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app])); }); - $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l): void { $eventSource->send('success', $l->t('Updated "%1$s" to %2$s', [$app, $version])); }); - $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps, &$incompatibleOverwrites) { + $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps, &$incompatibleOverwrites): void { if (!in_array($app, $incompatibleOverwrites)) { $incompatibleApps[] = $app; } }); - $updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) { + $updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config): void { $eventSource->send('failure', $message); $eventSource->close(); $config->setSystemValue('maintenance', false); }); - $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l): void { $eventSource->send('success', $l->t('Set log level to debug')); }); - $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l): void { $eventSource->send('success', $l->t('Reset log level')); }); - $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l): void { $eventSource->send('success', $l->t('Starting code integrity check')); }); - $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) { + $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l): void { $eventSource->send('success', $l->t('Finished code integrity check')); }); diff --git a/core/js/mimetypelist.js b/core/js/mimetypelist.js index ed861205cf0..1e2aeaa3f00 100644 --- a/core/js/mimetypelist.js +++ b/core/js/mimetypelist.js @@ -81,7 +81,6 @@ OC.MimeTypeList={ "application/x-7z-compressed": "package/x-generic", "application/x-bzip2": "package/x-generic", "application/x-cbr": "text", - "application/x-compressed": "package/x-generic", "application/x-dcraw": "image", "application/x-deb": "package/x-generic", "application/x-fictionbook+xml": "text", @@ -115,6 +114,7 @@ OC.MimeTypeList={ "text/x-h": "text/code", "text/x-java-source": "text/code", "text/x-ldif": "text/code", + "text/x-nfo": "text/code", "text/x-python": "text/code", "text/x-rst": "text", "text/x-shellscript": "text/code", @@ -151,5 +151,110 @@ OC.MimeTypeList={ "x-office-presentation", "x-office-spreadsheet" ], - themes: [] + themes: [], + names: {'application/epub+zip': t('core', "Electronic book document"), +'application/gpx+xml': t('core', "GPX geographic data"), +'application/gzip': t('core', "Gzip archive"), +'application/illustrator': t('core', "Adobe Illustrator document"), +'application/json': t('core', "JSON document"), +'application/msword': t('core', "Word document"), +'application/octet-stream': t('core', "Unknown"), +'application/pdf': t('core', "PDF document"), +'application/postscript': t('core', "PostScript document"), +'application/rss+xml': t('core', "RSS summary"), +'application/vnd.android.package-archive': t('core', "Android package"), +'application/vnd.google-earth.kml+xml': t('core', "KML geographic data"), +'application/vnd.google-earth.kmz': t('core', "KML geographic compressed data"), +'application/vnd.lotus-wordpro': t('core', "Lotus Word Pro document"), +'application/vnd.ms-excel': t('core', "Excel spreadsheet"), +'application/vnd.ms-excel.addin.macroEnabled.12': t('core', "Excel add-in"), +'application/vnd.ms-excel.sheet.binary.macroEnabled.12': t('core', "Excel 2007 binary spreadsheet"), +'application/vnd.ms-excel.sheet.macroEnabled.12': t('core', "Excel spreadsheet"), +'application/vnd.ms-excel.template.macroEnabled.12': t('core', "Excel spreadsheet template"), +'application/vnd.ms-powerpoint': t('core', "PowerPoint presentation"), +'application/vnd.ms-powerpoint.addin.macroEnabled.12': t('core', "PowerPoint add-in"), +'application/vnd.ms-powerpoint.presentation.macroEnabled.12': t('core', "PowerPoint presentation"), +'application/vnd.ms-powerpoint.slideshow.macroEnabled.12': t('core', "PowerPoint presentation"), +'application/vnd.ms-powerpoint.template.macroEnabled.12': t('core', "PowerPoint presentation template"), +'application/vnd.ms-word.document.macroEnabled.12': t('core', "Word document"), +'application/vnd.oasis.opendocument.formula': t('core', "ODF formula"), +'application/vnd.oasis.opendocument.graphics': t('core', "ODG drawing"), +'application/vnd.oasis.opendocument.graphics-flat-xml': t('core', "ODG drawing (Flat XML)"), +'application/vnd.oasis.opendocument.graphics-template': t('core', "ODG template"), +'application/vnd.oasis.opendocument.presentation': t('core', "ODP presentation"), +'application/vnd.oasis.opendocument.presentation-flat-xml': t('core', "ODP presentation (Flat XML)"), +'application/vnd.oasis.opendocument.presentation-template': t('core', "ODP template"), +'application/vnd.oasis.opendocument.spreadsheet': t('core', "ODS spreadsheet"), +'application/vnd.oasis.opendocument.spreadsheet-flat-xml': t('core', "ODS spreadsheet (Flat XML)"), +'application/vnd.oasis.opendocument.spreadsheet-template': t('core', "ODS template"), +'application/vnd.oasis.opendocument.text': t('core', "ODT document"), +'application/vnd.oasis.opendocument.text-flat-xml': t('core', "ODT document (Flat XML)"), +'application/vnd.oasis.opendocument.text-template': t('core', "ODT template"), +'application/vnd.openxmlformats-officedocument.presentationml.presentation': t('core', "PowerPoint 2007 presentation"), +'application/vnd.openxmlformats-officedocument.presentationml.slideshow': t('core', "PowerPoint 2007 show"), +'application/vnd.openxmlformats-officedocument.presentationml.template': t('core', "PowerPoint 2007 presentation template"), +'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': t('core', "Excel 2007 spreadsheet"), +'application/vnd.openxmlformats-officedocument.spreadsheetml.template': t('core', "Excel 2007 spreadsheet template"), +'application/vnd.openxmlformats-officedocument.wordprocessingml.document': t('core', "Word 2007 document"), +'application/vnd.openxmlformats-officedocument.wordprocessingml.template': t('core', "Word 2007 document template"), +'application/vnd.visio': t('core', "Microsoft Visio document"), +'application/vnd.wordperfect': t('core', "WordPerfect document"), +'application/x-7z-compressed': t('core', "7-zip archive"), +'application/x-blender': t('core', "Blender scene"), +'application/x-bzip2': t('core', "Bzip2 archive"), +'application/x-fictionbook+xml': t('core', "FictionBook document"), +'application/x-krita': t('core', "Krita document"), +'application/x-mobipocket-ebook': t('core', "Mobipocket e-book"), +'application/x-msi': t('core', "Windows Installer package"), +'application/x-perl': t('core', "Perl script"), +'application/x-php': t('core', "PHP script"), +'application/x-tar': t('core', "Tar archive"), +'application/xml': t('core', "XML document"), +'application/yaml': t('core', "YAML document"), +'application/zip': t('core', "Zip archive"), +'application/zstd': t('core', "Zstandard archive"), +'audio/aac': t('core', "AAC audio"), +'audio/flac': t('core', "FLAC audio"), +'audio/mp4': t('core', "MPEG-4 audio"), +'audio/mpeg': t('core', "MP3 audio"), +'audio/ogg': t('core', "Ogg audio"), +'audio/webm': t('core', "WebM audio"), +'audio/x-scpls': t('core', "MP3 ShoutCast playlist"), +'image/bmp': t('core', "Windows BMP image"), +'image/emf': t('core', "EMF image"), +'image/gif': t('core', "GIF image"), +'image/heif': t('core', "HEIF image"), +'image/jp2': t('core', "JPEG-2000 JP2 image"), +'image/jpeg': t('core', "JPEG image"), +'image/png': t('core', "PNG image"), +'image/svg+xml': t('core', "SVG image"), +'image/tiff': t('core', "TIFF image"), +'image/webp': t('core', "WebP image"), +'image/x-dcraw': t('core', "Digital raw image"), +'message/rfc822': t('core', "Email message"), +'text/calendar': t('core', "VCS\/ICS calendar"), +'text/css': t('core', "CSS stylesheet"), +'text/csv': t('core', "CSV document"), +'text/html': t('core', "HTML document"), +'text/markdown': t('core', "Markdown document"), +'text/org': t('core', "Org-mode file"), +'text/plain': t('core', "Plain text document"), +'text/vcard': t('core', "Electronic business card"), +'text/x-c++src': t('core', "C++ source code"), +'text/x-ldif': t('core', "LDIF address book"), +'text/x-nfo': t('core', "NFO document"), +'text/x-python': t('core', "Python script"), +'text/x-rst': t('core', "ReStructuredText document"), +'video/3gpp': t('core', "3GPP multimedia file"), +'video/dv': t('core', "DV video"), +'video/mp2t': t('core', "MPEG-2 transport stream"), +'video/mp4': t('core', "MPEG-4 video"), +'video/mpeg': t('core', "MPEG video"), +'video/ogg': t('core', "Ogg video"), +'video/quicktime': t('core', "QuickTime video"), +'video/webm': t('core', "WebM video"), +'video/x-flv': t('core', "Flash video"), +'video/x-matroska': t('core', "Matroska video"), +'video/x-ms-wmv': t('core', "Windows Media video"), +}, }; diff --git a/core/l10n/et_EE.js b/core/l10n/et_EE.js index 2f54c840f15..554d93d21a1 100644 --- a/core/l10n/et_EE.js +++ b/core/l10n/et_EE.js @@ -277,7 +277,7 @@ OC.L10N.register( "Show details" : "Näita üksikasju", "Hide details" : "Peida üksikasjad", "Rename project" : "Muuda projekti nime", - "Failed to rename the project" : "Projekti ümbernimetamine ebaõnnestus", + "Failed to rename the project" : "Projekti nime muutmine ei õnnestunud", "Failed to create a project" : "Projekti loomine ebaõnnestus", "Failed to add the item to the project" : "Objekti lisamine projekti ei õnnestunud", "Connect items to a project to make them easier to find" : "Et objekte oleks lihtsam leida, seo nad projektiga", diff --git a/core/l10n/et_EE.json b/core/l10n/et_EE.json index d17342b6a5d..d81a13f24b6 100644 --- a/core/l10n/et_EE.json +++ b/core/l10n/et_EE.json @@ -275,7 +275,7 @@ "Show details" : "Näita üksikasju", "Hide details" : "Peida üksikasjad", "Rename project" : "Muuda projekti nime", - "Failed to rename the project" : "Projekti ümbernimetamine ebaõnnestus", + "Failed to rename the project" : "Projekti nime muutmine ei õnnestunud", "Failed to create a project" : "Projekti loomine ebaõnnestus", "Failed to add the item to the project" : "Objekti lisamine projekti ei õnnestunud", "Connect items to a project to make them easier to find" : "Et objekte oleks lihtsam leida, seo nad projektiga", diff --git a/core/l10n/sl.js b/core/l10n/sl.js index e84e3be1c78..30c60b739d0 100644 --- a/core/l10n/sl.js +++ b/core/l10n/sl.js @@ -27,6 +27,7 @@ OC.L10N.register( "Could not complete login" : "Prijave ni mogoče dokončati", "State token missing" : "Manjka žeton stanja", "Your login token is invalid or has expired" : "Prijavni žeton je neveljaven, ali pa je že potekel.", + "Please use original client" : "Uporabite izvorni odjemalec", "This community release of Nextcloud is unsupported and push notifications are limited." : "Ta skupnostna objava oblaka Nextcloud ni podprta, nekatera potisna obvestila so zato omejena.", "Login" : "Prijava", "Unsupported email length (>255)" : "Nepodprta dolžina sporočila ( > 255 )", @@ -146,6 +147,8 @@ OC.L10N.register( "Account name" : "Ime računa", "Server side authentication failed!" : "Overitev na strani strežnika je spodletela!", "Please contact your administrator." : "Stopite v stik s skrbnikom sistema.", + "Session error" : "Napaka seje", + "It appears your session token has expired, please refresh the page and try again." : "Žeton seje je verjetno potekel. Osvežite stran in poskusite znova.", "An internal error occurred." : "Prišlo je do notranje napake.", "Please try again or contact your administrator." : "Poskusite znova ali pa stopite v stik s skrbnikom sistema.", "Password" : "Geslo", @@ -168,6 +171,7 @@ OC.L10N.register( "Schedule work & meetings, synced with all your devices." : "Načrtujte delo in sestanke, ki se samodejno usklajujejo z vsemi vašimi napravami.", "Keep your colleagues and friends in one place without leaking their private info." : "Združite sodelavce in prijatelje na enem mestu brez skrbi za njihove zasebne podatke.", "Simple email app nicely integrated with Files, Contacts and Calendar." : "Enostaven program za pošto se odlično povezuje z Datotekami, Stiki in Koledarjem.", + "Chatting, video calls, screen sharing, online meetings and web conferencing – in your browser and with mobile apps." : "Klepet, videoklici, souparaba zaslona, spletni sestanki in konference v spletnem brskalniku ali z mobilnimi aplikacijami.", "Collaborative documents, spreadsheets and presentations, built on Collabora Online." : "Sodelovanje pri ustvarjanju dokumentov, preglednic in predstavitev, ki zahtevajo storitev Collabora Online.", "Distraction free note taking app." : "Enostavno beleženje in zapisovanje", "Recommended apps" : "Priporočeni programi", @@ -204,9 +208,25 @@ OC.L10N.register( "Login form is disabled." : "Prijavni obrazec je onemogočen.", "The Nextcloud login form is disabled. Use another login option if available or contact your administration." : "Prijavni obrazec Nextcloud je onemogočen. Če je mogoče, izberite drug način prijave, ali pa stopite v stik s skrbnikom sistema.", "More actions" : "Več dejanj", + "Password is too weak" : "Geslo je prešibko", + "Password is weak" : "Geslo je šibko", + "Password is average" : "Geslo je povprečno", + "Password is strong" : "Geslo je močno", + "Password is very strong" : "Geslo je zelo močno", + "Password is extremely strong" : "Geslo je izjemno močno", + "Unknown password strength" : "Nenznana moč gesla", + "Your data directory and files are probably accessible from the internet because the <code>.htaccess</code> file does not work." : "Vaš podatkovni imenik in datoteke je verjetno dostopen s spleta, ker datoteka <code>.htaccess</code> ne deluje.", + "For information how to properly configure your server, please {linkStart}see the documentation{linkEnd}" : "Za podatke o pravilnih nastavitvah strežnika si {linkStart}preberite dokumentacijo{linkEnd}", + "Autoconfig file detected" : "Zaznana je datoteka za samodejno konfiguracijo", + "The setup form below is pre-filled with the values from the config file." : "Spodnja namestitev je predizpolnjena z vfednostmi iz konfiguracijske datoteke.", "Security warning" : "Varnostno opozorilo", + "Create administration account" : "Ustvari skrbniški račun", + "Administration account name" : "Ime skrbniškega računa", + "Administration account password" : "Geslo skrbniškega računa", "Storage & database" : "Shramba in podatkovna zbirka", "Data folder" : "Podatkovna mapa", + "Database configuration" : "Nastavitve podatkovnih baz", + "Only {firstAndOnlyDatabase} is available." : "Na voljo je le {firstAndOnlyDatabase}", "Install and activate additional PHP modules to choose other database types." : "Namestite in omogočite dodatne module PHP za izbor drugih vrst podatkovnih zbirk.", "For more details check out the documentation." : "Za več podrobnosti preverite dokumentacijo.", "Performance warning" : "Opozorilo učinkovitosti delovanja", @@ -219,6 +239,7 @@ OC.L10N.register( "Database tablespace" : "Razpredelnica podatkovne zbirke", "Please specify the port number along with the host name (e.g., localhost:5432)." : "Skupaj z imenom gostitelja je treba določiti tudi številko vrat (na primer localhost:5432).", "Database host" : "Gostitelj podatkovne zbirke", + "localhost" : "localhost", "Installing …" : "Poteka nameščanje ...", "Install" : "Namesti", "Need help?" : "Ali potrebujete pomoč?", @@ -274,6 +295,7 @@ OC.L10N.register( "Rename" : "Preimenuj", "Collaborative tags" : "Sodelovalne oznake", "No tags found" : "Ni najdenih oznak", + "Clipboard not available, please copy manually" : "Odložišče ni na voljo, kopirajte ročno", "Personal" : "Osebno", "Accounts" : "Računi", "Admin" : "Skrbništvo", @@ -376,6 +398,9 @@ OC.L10N.register( "The profile does not exist." : "Profil ne obstaja.", "Your data directory and files are probably accessible from the internet because the .htaccess file does not work." : "Podatkovna mapa in datoteke so najverjetneje javno dostopni v omrežju, ker datoteka .htaccess ni ustrezno nastavljena.", "For information how to properly configure your server, please see the <a href=\"%s\" target=\"_blank\" rel=\"noreferrer noopener\">documentation</a>." : "Več podrobnosti, kako pravilno nastaviti strežnik, je zapisanih v <a href=\"%s\" target=\"_blank\" rel=\"noreferrer noopener\">dokumentaciji</a>.", + "<strong>Create an admin account</strong>" : "<strong>Ustvari skrbniški račun</strong>", + "New admin account name" : "Ime računa novega skrbnika", + "New admin password" : "Geslo novega skrbnika", "Show password" : "Pokaži geslo", "Toggle password visibility" : "Preklopi vidnost gesla", "Configure the database" : "Nastavi podatkovno zbirko", diff --git a/core/l10n/sl.json b/core/l10n/sl.json index c44852ba3be..8fbec53fa08 100644 --- a/core/l10n/sl.json +++ b/core/l10n/sl.json @@ -25,6 +25,7 @@ "Could not complete login" : "Prijave ni mogoče dokončati", "State token missing" : "Manjka žeton stanja", "Your login token is invalid or has expired" : "Prijavni žeton je neveljaven, ali pa je že potekel.", + "Please use original client" : "Uporabite izvorni odjemalec", "This community release of Nextcloud is unsupported and push notifications are limited." : "Ta skupnostna objava oblaka Nextcloud ni podprta, nekatera potisna obvestila so zato omejena.", "Login" : "Prijava", "Unsupported email length (>255)" : "Nepodprta dolžina sporočila ( > 255 )", @@ -144,6 +145,8 @@ "Account name" : "Ime računa", "Server side authentication failed!" : "Overitev na strani strežnika je spodletela!", "Please contact your administrator." : "Stopite v stik s skrbnikom sistema.", + "Session error" : "Napaka seje", + "It appears your session token has expired, please refresh the page and try again." : "Žeton seje je verjetno potekel. Osvežite stran in poskusite znova.", "An internal error occurred." : "Prišlo je do notranje napake.", "Please try again or contact your administrator." : "Poskusite znova ali pa stopite v stik s skrbnikom sistema.", "Password" : "Geslo", @@ -166,6 +169,7 @@ "Schedule work & meetings, synced with all your devices." : "Načrtujte delo in sestanke, ki se samodejno usklajujejo z vsemi vašimi napravami.", "Keep your colleagues and friends in one place without leaking their private info." : "Združite sodelavce in prijatelje na enem mestu brez skrbi za njihove zasebne podatke.", "Simple email app nicely integrated with Files, Contacts and Calendar." : "Enostaven program za pošto se odlično povezuje z Datotekami, Stiki in Koledarjem.", + "Chatting, video calls, screen sharing, online meetings and web conferencing – in your browser and with mobile apps." : "Klepet, videoklici, souparaba zaslona, spletni sestanki in konference v spletnem brskalniku ali z mobilnimi aplikacijami.", "Collaborative documents, spreadsheets and presentations, built on Collabora Online." : "Sodelovanje pri ustvarjanju dokumentov, preglednic in predstavitev, ki zahtevajo storitev Collabora Online.", "Distraction free note taking app." : "Enostavno beleženje in zapisovanje", "Recommended apps" : "Priporočeni programi", @@ -202,9 +206,25 @@ "Login form is disabled." : "Prijavni obrazec je onemogočen.", "The Nextcloud login form is disabled. Use another login option if available or contact your administration." : "Prijavni obrazec Nextcloud je onemogočen. Če je mogoče, izberite drug način prijave, ali pa stopite v stik s skrbnikom sistema.", "More actions" : "Več dejanj", + "Password is too weak" : "Geslo je prešibko", + "Password is weak" : "Geslo je šibko", + "Password is average" : "Geslo je povprečno", + "Password is strong" : "Geslo je močno", + "Password is very strong" : "Geslo je zelo močno", + "Password is extremely strong" : "Geslo je izjemno močno", + "Unknown password strength" : "Nenznana moč gesla", + "Your data directory and files are probably accessible from the internet because the <code>.htaccess</code> file does not work." : "Vaš podatkovni imenik in datoteke je verjetno dostopen s spleta, ker datoteka <code>.htaccess</code> ne deluje.", + "For information how to properly configure your server, please {linkStart}see the documentation{linkEnd}" : "Za podatke o pravilnih nastavitvah strežnika si {linkStart}preberite dokumentacijo{linkEnd}", + "Autoconfig file detected" : "Zaznana je datoteka za samodejno konfiguracijo", + "The setup form below is pre-filled with the values from the config file." : "Spodnja namestitev je predizpolnjena z vfednostmi iz konfiguracijske datoteke.", "Security warning" : "Varnostno opozorilo", + "Create administration account" : "Ustvari skrbniški račun", + "Administration account name" : "Ime skrbniškega računa", + "Administration account password" : "Geslo skrbniškega računa", "Storage & database" : "Shramba in podatkovna zbirka", "Data folder" : "Podatkovna mapa", + "Database configuration" : "Nastavitve podatkovnih baz", + "Only {firstAndOnlyDatabase} is available." : "Na voljo je le {firstAndOnlyDatabase}", "Install and activate additional PHP modules to choose other database types." : "Namestite in omogočite dodatne module PHP za izbor drugih vrst podatkovnih zbirk.", "For more details check out the documentation." : "Za več podrobnosti preverite dokumentacijo.", "Performance warning" : "Opozorilo učinkovitosti delovanja", @@ -217,6 +237,7 @@ "Database tablespace" : "Razpredelnica podatkovne zbirke", "Please specify the port number along with the host name (e.g., localhost:5432)." : "Skupaj z imenom gostitelja je treba določiti tudi številko vrat (na primer localhost:5432).", "Database host" : "Gostitelj podatkovne zbirke", + "localhost" : "localhost", "Installing …" : "Poteka nameščanje ...", "Install" : "Namesti", "Need help?" : "Ali potrebujete pomoč?", @@ -272,6 +293,7 @@ "Rename" : "Preimenuj", "Collaborative tags" : "Sodelovalne oznake", "No tags found" : "Ni najdenih oznak", + "Clipboard not available, please copy manually" : "Odložišče ni na voljo, kopirajte ročno", "Personal" : "Osebno", "Accounts" : "Računi", "Admin" : "Skrbništvo", @@ -374,6 +396,9 @@ "The profile does not exist." : "Profil ne obstaja.", "Your data directory and files are probably accessible from the internet because the .htaccess file does not work." : "Podatkovna mapa in datoteke so najverjetneje javno dostopni v omrežju, ker datoteka .htaccess ni ustrezno nastavljena.", "For information how to properly configure your server, please see the <a href=\"%s\" target=\"_blank\" rel=\"noreferrer noopener\">documentation</a>." : "Več podrobnosti, kako pravilno nastaviti strežnik, je zapisanih v <a href=\"%s\" target=\"_blank\" rel=\"noreferrer noopener\">dokumentaciji</a>.", + "<strong>Create an admin account</strong>" : "<strong>Ustvari skrbniški račun</strong>", + "New admin account name" : "Ime računa novega skrbnika", + "New admin password" : "Geslo novega skrbnika", "Show password" : "Pokaži geslo", "Toggle password visibility" : "Preklopi vidnost gesla", "Configure the database" : "Nastavi podatkovno zbirko", diff --git a/core/register_command.php b/core/register_command.php index 62305d75a30..72a4b70f059 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -8,150 +8,241 @@ declare(strict_types=1); * SPDX-License-Identifier: AGPL-3.0-only */ use OC\Core\Command; +use OC\Core\Command\App\Disable; +use OC\Core\Command\App\Enable; +use OC\Core\Command\App\GetPath; +use OC\Core\Command\App\Install; +use OC\Core\Command\App\ListApps; +use OC\Core\Command\App\Remove; +use OC\Core\Command\App\Update; +use OC\Core\Command\Background\Delete; +use OC\Core\Command\Background\Job; +use OC\Core\Command\Background\JobWorker; +use OC\Core\Command\Background\ListCommand; +use OC\Core\Command\Background\Mode; +use OC\Core\Command\Broadcast\Test; +use OC\Core\Command\Check; +use OC\Core\Command\Config\App\DeleteConfig; +use OC\Core\Command\Config\App\GetConfig; +use OC\Core\Command\Config\App\SetConfig; +use OC\Core\Command\Config\Import; +use OC\Core\Command\Config\ListConfigs; +use OC\Core\Command\Db\AddMissingColumns; +use OC\Core\Command\Db\AddMissingIndices; +use OC\Core\Command\Db\AddMissingPrimaryKeys; +use OC\Core\Command\Db\ConvertFilecacheBigInt; +use OC\Core\Command\Db\ConvertMysqlToMB4; +use OC\Core\Command\Db\ConvertType; +use OC\Core\Command\Db\ExpectedSchema; +use OC\Core\Command\Db\ExportSchema; +use OC\Core\Command\Db\Migrations\ExecuteCommand; +use OC\Core\Command\Db\Migrations\GenerateCommand; +use OC\Core\Command\Db\Migrations\GenerateMetadataCommand; +use OC\Core\Command\Db\Migrations\MigrateCommand; +use OC\Core\Command\Db\Migrations\PreviewCommand; +use OC\Core\Command\Db\Migrations\StatusCommand; +use OC\Core\Command\Encryption\ChangeKeyStorageRoot; +use OC\Core\Command\Encryption\DecryptAll; +use OC\Core\Command\Encryption\EncryptAll; +use OC\Core\Command\Encryption\ListModules; +use OC\Core\Command\Encryption\MigrateKeyStorage; +use OC\Core\Command\Encryption\SetDefaultModule; +use OC\Core\Command\Encryption\ShowKeyStorageRoot; +use OC\Core\Command\FilesMetadata\Get; +use OC\Core\Command\Group\AddUser; +use OC\Core\Command\Group\RemoveUser; +use OC\Core\Command\Info\File; +use OC\Core\Command\Info\Space; +use OC\Core\Command\Info\Storage; +use OC\Core\Command\Info\Storages; +use OC\Core\Command\Integrity\CheckApp; +use OC\Core\Command\Integrity\CheckCore; +use OC\Core\Command\Integrity\SignApp; +use OC\Core\Command\Integrity\SignCore; +use OC\Core\Command\L10n\CreateJs; +use OC\Core\Command\Log\Manage; +use OC\Core\Command\Maintenance\DataFingerprint; +use OC\Core\Command\Maintenance\Mimetype\UpdateDB; +use OC\Core\Command\Maintenance\Mimetype\UpdateJS; +use OC\Core\Command\Maintenance\Repair; +use OC\Core\Command\Maintenance\RepairShareOwnership; +use OC\Core\Command\Maintenance\UpdateHtaccess; +use OC\Core\Command\Maintenance\UpdateTheme; +use OC\Core\Command\Memcache\RedisCommand; +use OC\Core\Command\Preview\Generate; +use OC\Core\Command\Preview\ResetRenderedTexts; +use OC\Core\Command\Security\BruteforceAttempts; +use OC\Core\Command\Security\BruteforceResetAttempts; +use OC\Core\Command\Security\ExportCertificates; +use OC\Core\Command\Security\ImportCertificate; +use OC\Core\Command\Security\ListCertificates; +use OC\Core\Command\Security\RemoveCertificate; +use OC\Core\Command\SetupChecks; +use OC\Core\Command\Status; +use OC\Core\Command\SystemTag\Edit; +use OC\Core\Command\TaskProcessing\EnabledCommand; +use OC\Core\Command\TaskProcessing\GetCommand; +use OC\Core\Command\TaskProcessing\Statistics; +use OC\Core\Command\TwoFactorAuth\Cleanup; +use OC\Core\Command\TwoFactorAuth\Enforce; +use OC\Core\Command\TwoFactorAuth\State; +use OC\Core\Command\Upgrade; +use OC\Core\Command\User\Add; +use OC\Core\Command\User\ClearGeneratedAvatarCacheCommand; +use OC\Core\Command\User\Info; +use OC\Core\Command\User\Keys\Verify; +use OC\Core\Command\User\LastSeen; +use OC\Core\Command\User\Report; +use OC\Core\Command\User\ResetPassword; +use OC\Core\Command\User\Setting; +use OC\Core\Command\User\SyncAccountDataCommand; +use OC\Core\Command\User\Welcome; use OCP\IConfig; use OCP\Server; use Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand; $application->add(new CompletionCommand()); -$application->add(Server::get(Command\Status::class)); -$application->add(Server::get(Command\Check::class)); -$application->add(Server::get(Command\L10n\CreateJs::class)); -$application->add(Server::get(Command\Integrity\SignApp::class)); -$application->add(Server::get(Command\Integrity\SignCore::class)); -$application->add(Server::get(Command\Integrity\CheckApp::class)); -$application->add(Server::get(Command\Integrity\CheckCore::class)); +$application->add(Server::get(Status::class)); +$application->add(Server::get(Check::class)); +$application->add(Server::get(CreateJs::class)); +$application->add(Server::get(SignApp::class)); +$application->add(Server::get(SignCore::class)); +$application->add(Server::get(CheckApp::class)); +$application->add(Server::get(CheckCore::class)); $config = Server::get(IConfig::class); if ($config->getSystemValueBool('installed', false)) { - $application->add(Server::get(Command\App\Disable::class)); - $application->add(Server::get(Command\App\Enable::class)); - $application->add(Server::get(Command\App\Install::class)); - $application->add(Server::get(Command\App\GetPath::class)); - $application->add(Server::get(Command\App\ListApps::class)); - $application->add(Server::get(Command\App\Remove::class)); - $application->add(Server::get(Command\App\Update::class)); - - $application->add(Server::get(Command\TwoFactorAuth\Cleanup::class)); - $application->add(Server::get(Command\TwoFactorAuth\Enforce::class)); + $application->add(Server::get(Disable::class)); + $application->add(Server::get(Enable::class)); + $application->add(Server::get(Install::class)); + $application->add(Server::get(GetPath::class)); + $application->add(Server::get(ListApps::class)); + $application->add(Server::get(Remove::class)); + $application->add(Server::get(Update::class)); + + $application->add(Server::get(Cleanup::class)); + $application->add(Server::get(Enforce::class)); $application->add(Server::get(Command\TwoFactorAuth\Enable::class)); $application->add(Server::get(Command\TwoFactorAuth\Disable::class)); - $application->add(Server::get(Command\TwoFactorAuth\State::class)); + $application->add(Server::get(State::class)); - $application->add(Server::get(Command\Background\Mode::class)); - $application->add(Server::get(Command\Background\Job::class)); - $application->add(Server::get(Command\Background\ListCommand::class)); - $application->add(Server::get(Command\Background\Delete::class)); - $application->add(Server::get(Command\Background\JobWorker::class)); + $application->add(Server::get(Mode::class)); + $application->add(Server::get(Job::class)); + $application->add(Server::get(ListCommand::class)); + $application->add(Server::get(Delete::class)); + $application->add(Server::get(JobWorker::class)); - $application->add(Server::get(Command\Broadcast\Test::class)); + $application->add(Server::get(Test::class)); - $application->add(Server::get(Command\Config\App\DeleteConfig::class)); - $application->add(Server::get(Command\Config\App\GetConfig::class)); - $application->add(Server::get(Command\Config\App\SetConfig::class)); - $application->add(Server::get(Command\Config\Import::class)); - $application->add(Server::get(Command\Config\ListConfigs::class)); + $application->add(Server::get(DeleteConfig::class)); + $application->add(Server::get(GetConfig::class)); + $application->add(Server::get(SetConfig::class)); + $application->add(Server::get(Import::class)); + $application->add(Server::get(ListConfigs::class)); $application->add(Server::get(Command\Config\System\DeleteConfig::class)); $application->add(Server::get(Command\Config\System\GetConfig::class)); $application->add(Server::get(Command\Config\System\SetConfig::class)); - $application->add(Server::get(Command\Info\File::class)); - $application->add(Server::get(Command\Info\Space::class)); - - $application->add(Server::get(Command\Db\ConvertType::class)); - $application->add(Server::get(Command\Db\ConvertMysqlToMB4::class)); - $application->add(Server::get(Command\Db\ConvertFilecacheBigInt::class)); - $application->add(Server::get(Command\Db\AddMissingColumns::class)); - $application->add(Server::get(Command\Db\AddMissingIndices::class)); - $application->add(Server::get(Command\Db\AddMissingPrimaryKeys::class)); - $application->add(Server::get(Command\Db\ExpectedSchema::class)); - $application->add(Server::get(Command\Db\ExportSchema::class)); - - $application->add(Server::get(Command\Db\Migrations\GenerateMetadataCommand::class)); - $application->add(Server::get(Command\Db\Migrations\PreviewCommand::class)); + $application->add(Server::get(File::class)); + $application->add(Server::get(Space::class)); + $application->add(Server::get(Storage::class)); + $application->add(Server::get(Storages::class)); + + $application->add(Server::get(ConvertType::class)); + $application->add(Server::get(ConvertMysqlToMB4::class)); + $application->add(Server::get(ConvertFilecacheBigInt::class)); + $application->add(Server::get(AddMissingColumns::class)); + $application->add(Server::get(AddMissingIndices::class)); + $application->add(Server::get(AddMissingPrimaryKeys::class)); + $application->add(Server::get(ExpectedSchema::class)); + $application->add(Server::get(ExportSchema::class)); + + $application->add(Server::get(GenerateMetadataCommand::class)); + $application->add(Server::get(PreviewCommand::class)); if ($config->getSystemValueBool('debug', false)) { - $application->add(Server::get(Command\Db\Migrations\StatusCommand::class)); - $application->add(Server::get(Command\Db\Migrations\MigrateCommand::class)); - $application->add(Server::get(Command\Db\Migrations\GenerateCommand::class)); - $application->add(Server::get(Command\Db\Migrations\ExecuteCommand::class)); + $application->add(Server::get(StatusCommand::class)); + $application->add(Server::get(MigrateCommand::class)); + $application->add(Server::get(GenerateCommand::class)); + $application->add(Server::get(ExecuteCommand::class)); } $application->add(Server::get(Command\Encryption\Disable::class)); $application->add(Server::get(Command\Encryption\Enable::class)); - $application->add(Server::get(Command\Encryption\ListModules::class)); - $application->add(Server::get(Command\Encryption\SetDefaultModule::class)); + $application->add(Server::get(ListModules::class)); + $application->add(Server::get(SetDefaultModule::class)); $application->add(Server::get(Command\Encryption\Status::class)); - $application->add(Server::get(Command\Encryption\EncryptAll::class)); - $application->add(Server::get(Command\Encryption\DecryptAll::class)); + $application->add(Server::get(EncryptAll::class)); + $application->add(Server::get(DecryptAll::class)); - $application->add(Server::get(Command\Log\Manage::class)); + $application->add(Server::get(Manage::class)); $application->add(Server::get(Command\Log\File::class)); - $application->add(Server::get(Command\Encryption\ChangeKeyStorageRoot::class)); - $application->add(Server::get(Command\Encryption\ShowKeyStorageRoot::class)); - $application->add(Server::get(Command\Encryption\MigrateKeyStorage::class)); + $application->add(Server::get(ChangeKeyStorageRoot::class)); + $application->add(Server::get(ShowKeyStorageRoot::class)); + $application->add(Server::get(MigrateKeyStorage::class)); - $application->add(Server::get(Command\Maintenance\DataFingerprint::class)); - $application->add(Server::get(Command\Maintenance\Mimetype\UpdateDB::class)); - $application->add(Server::get(Command\Maintenance\Mimetype\UpdateJS::class)); + $application->add(Server::get(DataFingerprint::class)); + $application->add(Server::get(UpdateDB::class)); + $application->add(Server::get(UpdateJS::class)); $application->add(Server::get(Command\Maintenance\Mode::class)); - $application->add(Server::get(Command\Maintenance\UpdateHtaccess::class)); - $application->add(Server::get(Command\Maintenance\UpdateTheme::class)); + $application->add(Server::get(UpdateHtaccess::class)); + $application->add(Server::get(UpdateTheme::class)); - $application->add(Server::get(Command\Upgrade::class)); - $application->add(Server::get(Command\Maintenance\Repair::class)); - $application->add(Server::get(Command\Maintenance\RepairShareOwnership::class)); + $application->add(Server::get(Upgrade::class)); + $application->add(Server::get(Repair::class)); + $application->add(Server::get(RepairShareOwnership::class)); $application->add(Server::get(Command\Preview\Cleanup::class)); - $application->add(Server::get(Command\Preview\Generate::class)); + $application->add(Server::get(Generate::class)); $application->add(Server::get(Command\Preview\Repair::class)); - $application->add(Server::get(Command\Preview\ResetRenderedTexts::class)); + $application->add(Server::get(ResetRenderedTexts::class)); - $application->add(Server::get(Command\User\Add::class)); + $application->add(Server::get(Add::class)); $application->add(Server::get(Command\User\Delete::class)); $application->add(Server::get(Command\User\Disable::class)); $application->add(Server::get(Command\User\Enable::class)); - $application->add(Server::get(Command\User\LastSeen::class)); - $application->add(Server::get(Command\User\Report::class)); - $application->add(Server::get(Command\User\ResetPassword::class)); - $application->add(Server::get(Command\User\Setting::class)); + $application->add(Server::get(LastSeen::class)); + $application->add(Server::get(Report::class)); + $application->add(Server::get(ResetPassword::class)); + $application->add(Server::get(Setting::class)); $application->add(Server::get(Command\User\ListCommand::class)); - $application->add(Server::get(Command\User\ClearGeneratedAvatarCacheCommand::class)); - $application->add(Server::get(Command\User\Info::class)); - $application->add(Server::get(Command\User\SyncAccountDataCommand::class)); + $application->add(Server::get(ClearGeneratedAvatarCacheCommand::class)); + $application->add(Server::get(Info::class)); + $application->add(Server::get(SyncAccountDataCommand::class)); $application->add(Server::get(Command\User\AuthTokens\Add::class)); $application->add(Server::get(Command\User\AuthTokens\ListCommand::class)); $application->add(Server::get(Command\User\AuthTokens\Delete::class)); - $application->add(Server::get(Command\User\Keys\Verify::class)); - $application->add(Server::get(Command\User\Welcome::class)); + $application->add(Server::get(Verify::class)); + $application->add(Server::get(Welcome::class)); $application->add(Server::get(Command\Group\Add::class)); $application->add(Server::get(Command\Group\Delete::class)); $application->add(Server::get(Command\Group\ListCommand::class)); - $application->add(Server::get(Command\Group\AddUser::class)); - $application->add(Server::get(Command\Group\RemoveUser::class)); + $application->add(Server::get(AddUser::class)); + $application->add(Server::get(RemoveUser::class)); $application->add(Server::get(Command\Group\Info::class)); $application->add(Server::get(Command\SystemTag\ListCommand::class)); $application->add(Server::get(Command\SystemTag\Delete::class)); $application->add(Server::get(Command\SystemTag\Add::class)); - $application->add(Server::get(Command\SystemTag\Edit::class)); - - $application->add(Server::get(Command\Security\ListCertificates::class)); - $application->add(Server::get(Command\Security\ExportCertificates::class)); - $application->add(Server::get(Command\Security\ImportCertificate::class)); - $application->add(Server::get(Command\Security\RemoveCertificate::class)); - $application->add(Server::get(Command\Security\BruteforceAttempts::class)); - $application->add(Server::get(Command\Security\BruteforceResetAttempts::class)); - $application->add(Server::get(Command\SetupChecks::class)); - $application->add(Server::get(Command\FilesMetadata\Get::class)); - - $application->add(Server::get(Command\TaskProcessing\GetCommand::class)); - $application->add(Server::get(Command\TaskProcessing\EnabledCommand::class)); + $application->add(Server::get(Edit::class)); + + $application->add(Server::get(ListCertificates::class)); + $application->add(Server::get(ExportCertificates::class)); + $application->add(Server::get(ImportCertificate::class)); + $application->add(Server::get(RemoveCertificate::class)); + $application->add(Server::get(BruteforceAttempts::class)); + $application->add(Server::get(BruteforceResetAttempts::class)); + $application->add(Server::get(SetupChecks::class)); + $application->add(Server::get(Get::class)); + + $application->add(Server::get(GetCommand::class)); + $application->add(Server::get(EnabledCommand::class)); $application->add(Server::get(Command\TaskProcessing\ListCommand::class)); - $application->add(Server::get(Command\TaskProcessing\Statistics::class)); + $application->add(Server::get(Statistics::class)); - $application->add(Server::get(Command\Memcache\RedisCommand::class)); + $application->add(Server::get(RedisCommand::class)); } else { $application->add(Server::get(Command\Maintenance\Install::class)); } diff --git a/core/strings.php b/core/strings.php index 3feab3af888..a4bd2007b3b 100644 --- a/core/strings.php +++ b/core/strings.php @@ -2,13 +2,15 @@ declare(strict_types=1); +use OCP\Util; + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2011-2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ //some strings that are used in /lib but won't be translatable unless they are in /core too -$l = \OCP\Util::getL10N('core'); +$l = Util::getL10N('core'); $l->t('Personal'); $l->t('Accounts'); $l->t('Apps'); diff --git a/core/templates/403.php b/core/templates/403.php index 091db720b16..17866e670af 100644 --- a/core/templates/403.php +++ b/core/templates/403.php @@ -8,7 +8,7 @@ if (!isset($_)) {//standalone page is not supported anymore - redirect to / require_once '../../lib/base.php'; - $urlGenerator = \OC::$server->getURLGenerator(); + $urlGenerator = \OCP\Server::get(\OCP\IURLGenerator::class); header('Location: ' . $urlGenerator->getAbsoluteURL('/')); exit; } diff --git a/core/templates/404.php b/core/templates/404.php index d2dc10f9aa8..3dcce4d26d3 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -11,7 +11,7 @@ if (!isset($_)) {//standalone page is not supported anymore - redirect to / require_once '../../lib/base.php'; - $urlGenerator = \OC::$server->getURLGenerator(); + $urlGenerator = \OCP\Server::get(\OCP\IURLGenerator::class); header('Location: ' . $urlGenerator->getAbsoluteURL('/')); exit; } @@ -24,7 +24,7 @@ if (!isset($_)) {//standalone page is not supported anymore - redirect to / <div class="icon-big icon-search"></div> <h2><?php p($l->t('Page not found')); ?></h2> <p class="infogroup"><?php p($l->t('The page could not be found on the server or you may not be allowed to view it.')); ?></p> - <p><a class="button primary" href="<?php p(\OC::$server->getURLGenerator()->linkTo('', 'index.php')) ?>"> + <p><a class="button primary" href="<?php p(\OCP\Server::get(\OCP\IURLGenerator::class)->linkTo('', 'index.php')) ?>"> <?php p($l->t('Back to %s', [$theme->getName()])); ?> </a></p> </div> diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 2998727ee8d..47cced308bc 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -11,7 +11,7 @@ */ $getUserAvatar = static function (int $size) use ($_): string { - return \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [ + return \OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('core.avatar.getAvatar', [ 'userId' => $_['user_uid'], 'size' => $size, 'v' => $_['userAvatarVersion'] diff --git a/core/templates/login.php b/core/templates/login.php index 949916872de..251e4cd288e 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -7,7 +7,7 @@ * * @var \OCP\IL10N $l */ -script('core', 'login'); +\OCP\Util::addScript('core', 'login', 'core'); ?> <div> <div id="login"></div> diff --git a/core/templates/loginflow/authpicker.php b/core/templates/loginflow/authpicker.php index 47e3113604d..265cb04a20f 100644 --- a/core/templates/loginflow/authpicker.php +++ b/core/templates/loginflow/authpicker.php @@ -4,7 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -script('core', 'login/authpicker'); +\OCP\Util::addScript('core', 'login/authpicker', 'core'); style('core', 'login/authpicker'); /** @var array $_ */ diff --git a/core/templates/loginflow/grant.php b/core/templates/loginflow/grant.php index 6beafccc96e..8d092f8e005 100644 --- a/core/templates/loginflow/grant.php +++ b/core/templates/loginflow/grant.php @@ -4,7 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -script('core', 'login/grant'); +\OCP\Util::addScript('core', 'login/grant', 'core'); style('core', 'login/authpicker'); /** @var array $_ */ diff --git a/core/templates/loginflowv2/authpicker.php b/core/templates/loginflowv2/authpicker.php index 9c77409ed05..c60aa81d3ea 100644 --- a/core/templates/loginflowv2/authpicker.php +++ b/core/templates/loginflowv2/authpicker.php @@ -5,7 +5,7 @@ */ style('core', 'login/authpicker'); -script('core', 'login/authpicker'); +\OCP\Util::addScript('core', 'login/authpicker', 'core'); /** @var array $_ */ /** @var \OCP\IURLGenerator $urlGenerator */ diff --git a/core/templates/loginflowv2/grant.php b/core/templates/loginflowv2/grant.php index 2fec49942d5..dea4ed27d6c 100644 --- a/core/templates/loginflowv2/grant.php +++ b/core/templates/loginflowv2/grant.php @@ -4,7 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -script('core', 'login/grant'); +\OCP\Util::addScript('core', 'login/grant', 'core'); style('core', 'login/authpicker'); /** @var array $_ */ diff --git a/core/templates/print_exception.php b/core/templates/print_exception.php index 2def6d4e9d9..bb66d5abce3 100644 --- a/core/templates/print_exception.php +++ b/core/templates/print_exception.php @@ -1,11 +1,13 @@ <?php + +use OCP\IL10N; + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ - -function print_exception(Throwable $e, \OCP\IL10N $l): void { +function print_exception(Throwable $e, IL10N $l): void { print_unescaped('<pre>'); p($e->getTraceAsString()); print_unescaped('</pre>'); diff --git a/core/templates/print_xml_exception.php b/core/templates/print_xml_exception.php index 94452d8ae9d..f103e13545f 100644 --- a/core/templates/print_xml_exception.php +++ b/core/templates/print_xml_exception.php @@ -1,11 +1,13 @@ <?php + +use OCP\IL10N; + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ - -function print_exception(Throwable $e, \OCP\IL10N $l): void { +function print_exception(Throwable $e, IL10N $l): void { p($e->getTraceAsString()); if ($e->getPrevious() !== null) { diff --git a/core/templates/recommendedapps.php b/core/templates/recommendedapps.php index 3654acb317d..dc92694f1b0 100644 --- a/core/templates/recommendedapps.php +++ b/core/templates/recommendedapps.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -script('core', 'recommendedapps'); +\OCP\Util::addScript('core', 'recommendedapps', 'core'); ?> diff --git a/core/templates/success.php b/core/templates/success.php index 2493fe9a095..3d84daf3ef3 100644 --- a/core/templates/success.php +++ b/core/templates/success.php @@ -11,7 +11,7 @@ <div class="update"> <h2><?php p($_['title']) ?></h2> <p><?php p($_['message']) ?></p> - <p><a class="button primary" href="<?php p(\OC::$server->get(\OCP\IURLGenerator::class)->linkTo('', 'index.php')) ?>"> + <p><a class="button primary" href="<?php p(\OCP\Server::get(\OCP\IURLGenerator::class)->linkTo('', 'index.php')) ?>"> <?php p($l->t('Go to %s', [$theme->getName()])); ?> </a></p> </div> diff --git a/core/templates/twofactorselectchallenge.php b/core/templates/twofactorselectchallenge.php index 582f45d70e8..8f31db3f154 100644 --- a/core/templates/twofactorselectchallenge.php +++ b/core/templates/twofactorselectchallenge.php @@ -24,7 +24,7 @@ $noProviders = empty($_['providers']); <strong><?php p($l->t('Two-factor authentication is enforced but has not been configured on your account. Contact your admin for assistance.')) ?></strong> <?php } else { ?> <strong><?php p($l->t('Two-factor authentication is enforced but has not been configured on your account. Please continue to setup two-factor authentication.')) ?></strong> - <a class="button primary two-factor-primary" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.setupProviders', + <a class="button primary two-factor-primary" href="<?php p(\OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('core.TwoFactorChallenge.setupProviders', [ 'redirect_url' => $_['redirect_url'], ] @@ -41,7 +41,7 @@ $noProviders = empty($_['providers']); <?php foreach ($_['providers'] as $provider): ?> <li> <a class="two-factor-provider" - href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', + href="<?php p(\OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('core.TwoFactorChallenge.showChallenge', [ 'challengeProviderId' => $provider->getId(), 'redirect_url' => $_['redirect_url'], @@ -66,7 +66,7 @@ $noProviders = empty($_['providers']); <?php endif ?> <?php if (!is_null($_['backupProvider'])): ?> <p> - <a class="<?php if ($noProviders): ?>button primary two-factor-primary<?php else: ?>two-factor-secondary<?php endif ?>" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', + <a class="<?php if ($noProviders): ?>button primary two-factor-primary<?php else: ?>two-factor-secondary<?php endif ?>" href="<?php p(\OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('core.TwoFactorChallenge.showChallenge', [ 'challengeProviderId' => $_['backupProvider']->getId(), 'redirect_url' => $_['redirect_url'], diff --git a/core/templates/twofactorsetupselection.php b/core/templates/twofactorsetupselection.php index 9633e1faacb..2eeaa49d6af 100644 --- a/core/templates/twofactorsetupselection.php +++ b/core/templates/twofactorsetupselection.php @@ -13,7 +13,7 @@ declare(strict_types=1); <?php foreach ($_['providers'] as $provider): ?> <li> <a class="two-factor-provider" - href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.setupProvider', + href="<?php p(\OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('core.TwoFactorChallenge.setupProvider', [ 'providerId' => $provider->getId(), 'redirect_url' => $_['redirect_url'], diff --git a/core/templates/twofactorshowchallenge.php b/core/templates/twofactorshowchallenge.php index 16f4390f177..c0286c44c9c 100644 --- a/core/templates/twofactorshowchallenge.php +++ b/core/templates/twofactorshowchallenge.php @@ -28,7 +28,7 @@ $template = $_['template']; <?php print_unescaped($template); ?> <?php if (!is_null($_['backupProvider'])): ?> <p> - <a class="two-factor-secondary" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', + <a class="two-factor-secondary" href="<?php p(\OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('core.TwoFactorChallenge.showChallenge', [ 'challengeProviderId' => $_['backupProvider']->getId(), 'redirect_url' => $_['redirect_url'], |