aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command')
-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
17 files changed, 62 insertions, 65 deletions
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;
}
/**