Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions apps/files/lib/Command/Copy.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
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();
}

Expand Down
7 changes: 3 additions & 4 deletions apps/files/lib/Command/Move.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
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();
}

Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/tests/TrashbinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function setUp(): void {
$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')
Expand Down
2 changes: 1 addition & 1 deletion apps/files_versions/tests/VersioningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function setUp(): void {
$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')
Expand Down
5 changes: 1 addition & 4 deletions apps/settings/lib/UserMigration/AccountMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -49,11 +47,10 @@ public function __construct(
private IAccountManager $accountManager,
private IAvatarManager $avatarManager,
ProfileManager $profileManager,
ProfileConfigMapper $configMapper,
private ProfileConfigMapper $configMapper,
private IL10N $l10n,
) {
$this->profileManager = $profileManager;
$this->configMapper = $configMapper;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion build/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedO
$config = RectorConfig::configure()
->withPaths([
$nextcloudDir . '/apps',
$nextcloudDir . '/core',
$nextcloudDir . '/status.php',
// $nextcloudDir . '/config',
// $nextcloudDir . '/core',
// $nextcloudDir . '/lib',
// $nextcloudDir . '/ocs',
// $nextcloudDir . '/ocs-provider',
Expand Down
4 changes: 2 additions & 2 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct() {
$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',
Expand Down Expand Up @@ -244,7 +244,7 @@ public function __construct() {
);
});

$eventDispatcher->addListener(AddMissingPrimaryKeyEvent::class, function (AddMissingPrimaryKeyEvent $event) {
$eventDispatcher->addListener(AddMissingPrimaryKeyEvent::class, function (AddMissingPrimaryKeyEvent $event): void {
$event->addMissingPrimaryKey(
'federated_reshares',
'federated_res_pk',
Expand Down
2 changes: 1 addition & 1 deletion core/BackgroundJobs/CheckForUserCertificates.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
*/
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);
Expand Down
3 changes: 2 additions & 1 deletion core/BackgroundJobs/GenerateMetadataJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace OC\Core\BackgroundJobs;

use OC\Files\Mount\MoveableMount;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\TimedJob;
Expand Down Expand Up @@ -83,7 +84,7 @@ private function scanFilesForUser(string $userId): void {

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
* @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', '') === '') {
Expand Down
3 changes: 2 additions & 1 deletion core/Command/App/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand Down Expand Up @@ -64,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$apps = [$singleAppId];
try {
$this->manager->getAppPath($singleAppId);
} catch (\OCP\App\AppPathNotFoundException $e) {
} catch (AppPathNotFoundException $e) {
$output->writeln($singleAppId . ' not installed');
return 1;
}
Expand Down
8 changes: 5 additions & 3 deletions core/Command/Background/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

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;
Expand Down Expand Up @@ -75,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('<info>Job executed!</info>');
$output->writeln('');

if ($job instanceof \OCP\BackgroundJob\TimedJob) {
if ($job instanceof TimedJob) {
$this->printJobInfo($jobId, $job, $output);
}
} else {
Expand All @@ -99,10 +101,10 @@ protected function printJobInfo(int $jobId, IJob $job, OutputInterface $output):
$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');
Expand Down
9 changes: 6 additions & 3 deletions core/Command/Background/JobBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@

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,
Expand All @@ -41,10 +44,10 @@ protected function printJobInfo(int $jobId, IJob $job, OutputInterface $output):
$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');
Expand Down
13 changes: 4 additions & 9 deletions core/Command/Broadcast/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$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 {
Expand Down
6 changes: 4 additions & 2 deletions core/Command/Db/ConvertType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
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;
Expand Down Expand Up @@ -159,7 +161,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$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')) {
Expand Down Expand Up @@ -401,7 +403,7 @@ protected function convertDB(Connection $fromDB, Connection $toDB, array $tables
$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
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Encryption/ListModules.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
*/
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 {
Expand Down
3 changes: 2 additions & 1 deletion core/Command/Info/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

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;
Expand Down Expand Up @@ -176,7 +177,7 @@ private function outputStorageDetails(IMountPoint $mountPoint, Node $node, Input
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()) . ')';
}
Expand Down
6 changes: 4 additions & 2 deletions core/Command/Info/FileUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

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;
Expand All @@ -21,6 +22,7 @@
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;
Expand All @@ -35,8 +37,8 @@ public function __construct(
/**
* @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();
Expand Down
5 changes: 3 additions & 2 deletions core/Command/Log/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,7 +62,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if (($rotateSize = $input->getOption('rotate-size')) !== null) {
$rotateSize = \OCP\Util::computerFileSize($rotateSize);
$rotateSize = Util::computerFileSize($rotateSize);
$this->validateRotateSize($rotateSize);
$toBeSet['log_rotate_size'] = $rotateSize;
}
Expand All @@ -87,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$rotateSize = $this->config->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
if ($rotateSize) {
$rotateString = \OCP\Util::humanFileSize($rotateSize);
$rotateString = Util::humanFileSize($rotateSize);
} else {
$rotateString = 'disabled';
}
Expand Down
3 changes: 2 additions & 1 deletion core/Command/Maintenance/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;
Expand Down Expand Up @@ -51,7 +52,7 @@ protected function configure(): void {

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) {
Expand Down
3 changes: 2 additions & 1 deletion core/Command/Maintenance/UpdateHtaccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,7 +20,7 @@ protected function configure() {
}

protected function execute(InputInterface $input, OutputInterface $output): int {
if (\OC\Setup::updateHtaccess()) {
if (Setup::updateHtaccess()) {
$output->writeln('.htaccess has been updated');
return 0;
} else {
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Preview/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$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();
Expand Down
Loading
Loading