aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2025-05-14 15:51:42 +0200
committerprovokateurin <kate@provokateurin.de>2025-05-15 00:16:54 +0200
commit82fb8f850828d24f551ad5ef3b8523486e5104df (patch)
tree4b7bf5bcd5e8f37b1a70a9dec1f80729b97ef6e6
parentc3ddd1da46c9f75071f61d3cf7381570297a74d6 (diff)
downloadnextcloud-server-refactor/rector-core.tar.gz
nextcloud-server-refactor/rector-core.zip
refactor: Extend rector to core/refactor/rector-core
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r--apps/files/lib/Command/Copy.php7
-rw-r--r--apps/files/lib/Command/Move.php7
-rw-r--r--apps/files_trashbin/tests/TrashbinTest.php2
-rw-r--r--apps/files_versions/tests/VersioningTest.php2
-rw-r--r--apps/settings/lib/UserMigration/AccountMigrator.php5
-rw-r--r--build/rector.php2
-rw-r--r--core/Application.php4
-rw-r--r--core/BackgroundJobs/CheckForUserCertificates.php2
-rw-r--r--core/BackgroundJobs/GenerateMetadataJob.php3
-rw-r--r--core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php2
-rw-r--r--core/Command/App/Update.php3
-rw-r--r--core/Command/Background/Job.php8
-rw-r--r--core/Command/Background/JobBase.php9
-rw-r--r--core/Command/Broadcast/Test.php13
-rw-r--r--core/Command/Db/ConvertType.php6
-rw-r--r--core/Command/Encryption/ListModules.php2
-rw-r--r--core/Command/Info/File.php3
-rw-r--r--core/Command/Info/FileUtils.php6
-rw-r--r--core/Command/Log/File.php5
-rw-r--r--core/Command/Maintenance/Install.php3
-rw-r--r--core/Command/Maintenance/UpdateHtaccess.php3
-rw-r--r--core/Command/Preview/Repair.php2
-rw-r--r--core/Command/Upgrade.php37
-rw-r--r--core/Command/User/Info.php3
-rw-r--r--core/Command/User/LastSeen.php2
-rw-r--r--core/Command/User/SyncAccountDataCommand.php9
-rw-r--r--core/Command/User/Welcome.php13
-rw-r--r--core/Controller/AppPasswordController.php3
-rw-r--r--core/Controller/AvatarController.php13
-rw-r--r--core/Controller/ClientFlowLoginController.php10
-rw-r--r--core/Controller/ClientFlowLoginV2Controller.php3
-rw-r--r--core/Controller/ErrorController.php3
-rw-r--r--core/Controller/GuestAvatarController.php2
-rw-r--r--core/Controller/HoverCardController.php3
-rw-r--r--core/Controller/LoginController.php6
-rw-r--r--core/Controller/LostController.php15
-rw-r--r--core/Controller/OCMController.php3
-rw-r--r--core/Controller/OCSController.php3
-rw-r--r--core/Controller/PreviewController.php5
-rw-r--r--core/Controller/ReferenceApiController.php3
-rw-r--r--core/Controller/SetupController.php6
-rw-r--r--core/Controller/TaskProcessingApiController.php14
-rw-r--r--core/Controller/TeamsApiController.php3
-rw-r--r--core/Controller/TextProcessingApiController.php3
-rw-r--r--core/Controller/TextToImageApiController.php3
-rw-r--r--core/Controller/TranslationApiController.php3
-rw-r--r--core/Controller/WhatsNewController.php3
-rw-r--r--core/Migrations/Version14000Date20180626223656.php3
-rw-r--r--core/Migrations/Version14000Date20180712153140.php3
-rw-r--r--core/ajax/update.php54
-rw-r--r--core/register_command.php267
-rw-r--r--core/strings.php4
-rw-r--r--core/templates/403.php2
-rw-r--r--core/templates/404.php4
-rw-r--r--core/templates/layout.user.php2
-rw-r--r--core/templates/login.php2
-rw-r--r--core/templates/loginflow/authpicker.php2
-rw-r--r--core/templates/loginflow/grant.php2
-rw-r--r--core/templates/loginflowv2/authpicker.php2
-rw-r--r--core/templates/loginflowv2/grant.php2
-rw-r--r--core/templates/print_exception.php6
-rw-r--r--core/templates/print_xml_exception.php6
-rw-r--r--core/templates/recommendedapps.php2
-rw-r--r--core/templates/success.php2
-rw-r--r--core/templates/twofactorselectchallenge.php6
-rw-r--r--core/templates/twofactorsetupselection.php2
-rw-r--r--core/templates/twofactorshowchallenge.php2
67 files changed, 382 insertions, 263 deletions
diff --git a/apps/files/lib/Command/Copy.php b/apps/files/lib/Command/Copy.php
index e51a1689907..ad0dfa90de1 100644
--- a/apps/files/lib/Command/Copy.php
+++ b/apps/files/lib/Command/Copy.php
@@ -19,10 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
class Copy extends Command {
- private FileUtils $fileUtils;
-
- public function __construct(FileUtils $fileUtils) {
- $this->fileUtils = $fileUtils;
+ public function __construct(
+ private FileUtils $fileUtils,
+ ) {
parent::__construct();
}
diff --git a/apps/files/lib/Command/Move.php b/apps/files/lib/Command/Move.php
index cd9e56f8e29..29dd8860b2a 100644
--- a/apps/files/lib/Command/Move.php
+++ b/apps/files/lib/Command/Move.php
@@ -20,10 +20,9 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
class Move extends Command {
- private FileUtils $fileUtils;
-
- public function __construct(FileUtils $fileUtils) {
- $this->fileUtils = $fileUtils;
+ public function __construct(
+ private FileUtils $fileUtils,
+ ) {
parent::__construct();
}
diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php
index 42054fc48a6..3d2ceee0dcd 100644
--- a/apps/files_trashbin/tests/TrashbinTest.php
+++ b/apps/files_trashbin/tests/TrashbinTest.php
@@ -118,7 +118,7 @@ class TrashbinTest extends \Test\TestCase {
$config = Server::get(IConfig::class);
$mockConfig = $this->getMockBuilder(AllConfig::class)
->onlyMethods(['getSystemValue'])
- ->setConstructorArgs([Server::get(\OC\SystemConfig::class)])
+ ->setConstructorArgs([Server::get(SystemConfig::class)])
->getMock();
$mockConfig->expects($this->any())
->method('getSystemValue')
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index 7d027ca566f..eaa0a02e261 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -85,7 +85,7 @@ class VersioningTest extends \Test\TestCase {
$config = Server::get(IConfig::class);
$mockConfig = $this->getMockBuilder(AllConfig::class)
->onlyMethods(['getSystemValue'])
- ->setConstructorArgs([Server::get(\OC\SystemConfig::class)])
+ ->setConstructorArgs([Server::get(SystemConfig::class)])
->getMock();
$mockConfig->expects($this->any())
->method('getSystemValue')
diff --git a/apps/settings/lib/UserMigration/AccountMigrator.php b/apps/settings/lib/UserMigration/AccountMigrator.php
index 15ac06687b6..1c51aec5104 100644
--- a/apps/settings/lib/UserMigration/AccountMigrator.php
+++ b/apps/settings/lib/UserMigration/AccountMigrator.php
@@ -35,8 +35,6 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
private ProfileManager $profileManager;
- private ProfileConfigMapper $configMapper;
-
private const PATH_ROOT = Application::APP_ID . '/';
private const PATH_ACCOUNT_FILE = AccountMigrator::PATH_ROOT . 'account.json';
@@ -49,11 +47,10 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
private IAccountManager $accountManager,
private IAvatarManager $avatarManager,
ProfileManager $profileManager,
- ProfileConfigMapper $configMapper,
+ private ProfileConfigMapper $configMapper,
private IL10N $l10n,
) {
$this->profileManager = $profileManager;
- $this->configMapper = $configMapper;
}
/**
diff --git a/build/rector.php b/build/rector.php
index a119d84fd59..03e6eab0e87 100644
--- a/build/rector.php
+++ b/build/rector.php
@@ -52,9 +52,9 @@ class NextcloudNamespaceSkipVoter implements ClassNameImportSkipVoterInterface {
$config = RectorConfig::configure()
->withPaths([
$nextcloudDir . '/apps',
+ $nextcloudDir . '/core',
$nextcloudDir . '/status.php',
// $nextcloudDir . '/config',
- // $nextcloudDir . '/core',
// $nextcloudDir . '/lib',
// $nextcloudDir . '/ocs',
// $nextcloudDir . '/ocs-provider',
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/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..4de0fbd5faa 100644
--- a/core/Command/Info/FileUtils.php
+++ b/core/Command/Info/FileUtils.php
@@ -8,6 +8,7 @@ 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;
@@ -21,6 +22,7 @@ use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
+use OCP\Files\NotPermittedException;
use OCP\Share\IShare;
use OCP\Util;
use Symfony\Component\Console\Output\OutputInterface;
@@ -35,8 +37,8 @@ class FileUtils {
/**
* @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();
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/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/register_command.php b/core/register_command.php
index 62305d75a30..a276cd58bfd 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -8,150 +8,237 @@ 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\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(File::class));
+ $application->add(Server::get(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(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(Command\Db\Migrations\GenerateMetadataCommand::class));
- $application->add(Server::get(Command\Db\Migrations\PreviewCommand::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'],