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
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ updates:
- "/vendor-bin/openapi-extractor"
- "/vendor-bin/phpunit"
- "/vendor-bin/psalm"
- "/vendor-bin/rector"
schedule:
interval: weekly
day: saturday
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@

abstract class AbstractPrincipalBackend implements BackendInterface {

/** @var ProxyMapper */
private $proxyMapper;

/** @var string */
private $principalPrefix;

/** @var string */
private $dbTableName;

Expand All @@ -45,13 +39,11 @@ public function __construct(
private IUserSession $userSession,
private IGroupManager $groupManager,
private LoggerInterface $logger,
ProxyMapper $proxyMapper,
string $principalPrefix,
private ProxyMapper $proxyMapper,
private string $principalPrefix,
string $dbPrefix,
private string $cuType,
) {
$this->proxyMapper = $proxyMapper;
$this->principalPrefix = $principalPrefix;
$this->dbTableName = 'calendar_' . $dbPrefix . 's';
$this->dbMetaDataTableName = $this->dbTableName . '_md';
$this->dbForeignKeyName = $dbPrefix . '_id';
Expand Down
6 changes: 1 addition & 5 deletions apps/dav/lib/Connector/Sabre/Principal.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class Principal implements BackendInterface {
/** @var bool */
private $hasCircles;

/** @var ProxyMapper */
private $proxyMapper;

/** @var KnownUserService */
private $knownUserService;

Expand All @@ -54,15 +51,14 @@ public function __construct(
private IShareManager $shareManager,
private IUserSession $userSession,
private IAppManager $appManager,
ProxyMapper $proxyMapper,
private ProxyMapper $proxyMapper,
KnownUserService $knownUserService,
private IConfig $config,
private IFactory $languageFactory,
string $principalPrefix = 'principals/users/',
) {
$this->principalPrefix = trim($principalPrefix, '/');
$this->hasGroups = $this->hasCircles = ($principalPrefix === 'principals/users/');
$this->proxyMapper = $proxyMapper;
$this->knownUserService = $knownUserService;
}

Expand Down
3 changes: 2 additions & 1 deletion apps/dav/lib/Connector/Sabre/ServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCA\DAV\DAV\CustomPropertiesBackend;
use OCA\DAV\DAV\ViewOnlyPlugin;
use OCA\DAV\Files\BrowserErrorPagePlugin;
use OCA\DAV\Files\Sharing\RootCollection;
use OCA\DAV\Upload\CleanupService;
use OCA\Theming\ThemingDefaults;
use OCP\Accounts\IAccountManager;
Expand Down Expand Up @@ -150,7 +151,7 @@ public function createServer(
);

// Mount the share collection at /public.php/dav/shares/<share token>
$rootCollection->addChild(new \OCA\DAV\Files\Sharing\RootCollection(
$rootCollection->addChild(new RootCollection(
$root,
$userPrincipalBackend,
'principals/shares',
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/lib/Events/CalendarShareUpdatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
namespace OCA\DAV\Events;

use OCA\DAV\CalDAV\CalDavBackend;
use OCP\EventDispatcher\Event;

/**
Expand All @@ -16,7 +17,7 @@
* @package OCA\DAV\Events
* @since 20.0.0
*
* @psalm-import-type CalendarInfo from \OCA\DAV\CalDAV\CalDavBackend
* @psalm-import-type CalendarInfo from CalDavBackend
*/
class CalendarShareUpdatedEvent extends Event {
/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/templates/settings-example-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
script('dav', 'settings-example-content');
\OCP\Util::addScript('dav', 'settings-example-content', 'core');

?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

namespace OCA\DAV\Tests\integration\DAV\Sharing;

use OC\Memcache\NullCache;
use OCA\DAV\CalDAV\Calendar;
use OCA\DAV\CalDAV\Sharing\Service;
use OCA\DAV\Connector\Sabre\Principal;
use OCA\DAV\DAV\Sharing\Backend;
use OCA\DAV\DAV\Sharing\SharingMapper;
Expand Down Expand Up @@ -50,11 +52,11 @@ protected function setUp(): void {
$this->principalBackend = $this->createMock(Principal::class);
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->cacheFactory->method('createInMemory')
->willReturn(new \OC\Memcache\NullCache());
->willReturn(new NullCache());
$this->logger = new \Psr\Log\NullLogger();

$this->sharingMapper = new SharingMapper($this->db);
$this->sharingService = new \OCA\DAV\CalDAV\Sharing\Service($this->sharingMapper);
$this->sharingService = new Service($this->sharingMapper);

$this->sharingBackend = new \OCA\DAV\CalDAV\Sharing\Backend(
$this->userManager,
Expand Down
5 changes: 3 additions & 2 deletions apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\Exception\Forbidden;
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
use OCA\Files_Sharing\External\Storage;
use OCP\Constants;
use OCP\Files\ForbiddenException;
use OCP\Files\InvalidPathException;
Expand Down Expand Up @@ -286,7 +287,7 @@ public function testGetQuotaInfoUnlimited(): void {
->willReturnMap([
['\OCA\Files_Sharing\SharedStorage', false],
['\OC\Files\Storage\Wrapper\Quota', false],
[\OCA\Files_Sharing\External\Storage::class, false],
[Storage::class, false],
]);

$storage->expects($this->once())
Expand Down Expand Up @@ -342,7 +343,7 @@ public function testGetQuotaInfoSpecific(): void {
->willReturnMap([
['\OCA\Files_Sharing\SharedStorage', false],
['\OC\Files\Storage\Wrapper\Quota', true],
[\OCA\Files_Sharing\External\Storage::class, false],
[Storage::class, false],
]);

$storage->expects($this->once())
Expand Down
3 changes: 2 additions & 1 deletion apps/files_sharing/lib/External/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
namespace OCA\Files_Sharing\External;

use OC\Files\Cache\CacheEntry;
use OC\ForbiddenException;
use OCP\Files\NotFoundException;
use OCP\Files\StorageInvalidException;
Expand All @@ -29,7 +30,7 @@ public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $loc
* @param string $file file to scan
* @param int $reuseExisting
* @param int $parentId
* @param \OC\Files\Cache\CacheEntry|array|null|false $cacheData existing data in the cache for the file to be scanned
* @param CacheEntry|array|null|false $cacheData existing data in the cache for the file to be scanned
* @param bool $lock set to false to disable getting an additional read lock during scanning
* @param array|null $data the metadata for the file, as returned by the storage
* @return array|null an array of metadata of the scanned file
Expand Down
3 changes: 2 additions & 1 deletion apps/files_trashbin/lib/Command/CleanUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use OCP\IDBConnection;
use OCP\IUserBackend;
use OCP\IUserManager;
use OCP\Util;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\InvalidOptionException;
use Symfony\Component\Console\Input\InputArgument;
Expand Down Expand Up @@ -96,7 +97,7 @@ protected function removeDeletedFiles(string $uid, OutputInterface $output, bool
$node = $this->rootFolder->get($path);

if ($verbose) {
$output->writeln('Deleting <info>' . \OCP\Util::humanFileSize($node->getSize()) . "</info> in trash for <info>$uid</info>.");
$output->writeln('Deleting <info>' . Util::humanFileSize($node->getSize()) . "</info> in trash for <info>$uid</info>.");
}
$node->delete();
if ($this->rootFolder->nodeExists($path)) {
Expand Down
9 changes: 5 additions & 4 deletions apps/files_trashbin/lib/Command/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Util;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -45,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$size = $input->getArgument('size');

if ($size) {
$parsedSize = \OCP\Util::computerFileSize($size);
$parsedSize = Util::computerFileSize($size);
if ($parsedSize === false) {
$output->writeln('<error>Failed to parse input size</error>');
return -1;
Expand All @@ -70,7 +71,7 @@ private function printTrashbinSize(InputInterface $input, OutputInterface $outpu
if ($globalSize < 0) {
$globalHumanSize = 'default (50% of available space)';
} else {
$globalHumanSize = \OCP\Util::humanFileSize($globalSize);
$globalHumanSize = Util::humanFileSize($globalSize);
}

if ($user) {
Expand All @@ -79,7 +80,7 @@ private function printTrashbinSize(InputInterface $input, OutputInterface $outpu
if ($userSize < 0) {
$userHumanSize = ($globalSize < 0) ? $globalHumanSize : "default($globalHumanSize)";
} else {
$userHumanSize = \OCP\Util::humanFileSize($userSize);
$userHumanSize = Util::humanFileSize($userSize);
}

if ($input->getOption('output') == self::OUTPUT_FORMAT_PLAIN) {
Expand All @@ -106,7 +107,7 @@ private function printTrashbinSize(InputInterface $input, OutputInterface $outpu
if (count($userValues)) {
$output->writeln('Per-user sizes:');
$this->writeArrayInOutputFormat($input, $output, array_map(function ($size) {
return \OCP\Util::humanFileSize($size);
return Util::humanFileSize($size);
}, $userValues));
} else {
$output->writeln('No per-user sizes configured');
Expand Down
3 changes: 2 additions & 1 deletion apps/files_trashbin/tests/TrashbinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OC\Files\Storage\Local;
use OC\Files\View;
use OC\SystemConfig;
use OC\User\Database;
use OCA\Files_Sharing\AppInfo\Application;
use OCA\Files_Trashbin\AppInfo\Application as TrashbinApplication;
use OCA\Files_Trashbin\Expiration;
Expand Down Expand Up @@ -59,7 +60,7 @@ public static function setUpBeforeClass(): void {

// reset backend
Server::get(IUserManager::class)->clearBackends();
Server::get(IUserManager::class)->registerBackend(new \OC\User\Database());
Server::get(IUserManager::class)->registerBackend(new Database());

// clear share hooks
\OC_Hook::clear('OCP\\Share');
Expand Down
3 changes: 2 additions & 1 deletion apps/files_versions/lib/Listener/FileEventsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\Files\IMimeTypeLoader;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -378,7 +379,7 @@ private function getPathForNode(Node $node): ?string {

try {
$owner = $node->getOwner()?->getUid();
} catch (\OCP\Files\NotFoundException) {
} catch (NotFoundException) {
$owner = null;
}

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 @@ -808,7 +808,7 @@ private function doTestRestore() {

$eventDispatcher = Server::get(IEventDispatcher::class);
$eventFired = false;
$eventDispatcher->addListener(VersionRestoredEvent::class, function ($event) use (&$eventFired, $t2) {
$eventDispatcher->addListener(VersionRestoredEvent::class, function ($event) use (&$eventFired, $t2): void {
$eventFired = true;
$this->assertEquals('/sub/test.txt', $event->getVersion()->getVersionPath());
$this->assertTrue($event->getVersion()->getRevisionId() > 0);
Expand Down
3 changes: 2 additions & 1 deletion apps/settings/lib/Settings/Admin/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use OCP\IBinaryFinder;
use OCP\IConfig;
use OCP\IL10N;
use OCP\Server;
use OCP\Settings\IDelegatedSettings;

class Mail implements IDelegatedSettings {
Expand All @@ -26,7 +27,7 @@ public function __construct(
* @return TemplateResponse
*/
public function getForm() {
$finder = \OCP\Server::get(IBinaryFinder::class);
$finder = Server::get(IBinaryFinder::class);

$parameters = [
// Mail
Expand Down
5 changes: 3 additions & 2 deletions apps/settings/lib/Settings/Personal/PersonalInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCP\Notification\IManager;
use OCP\Server;
use OCP\Settings\ISettings;
use OCP\Util;

class PersonalInfo implements ISettings {

Expand Down Expand Up @@ -71,7 +72,7 @@ public function getForm(): TemplateResponse {
if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
$totalSpace = $this->l->t('Unlimited');
} else {
$totalSpace = \OCP\Util::humanFileSize($storageInfo['total']);
$totalSpace = Util::humanFileSize($storageInfo['total']);
}

$messageParameters = $this->getMessageParameters($account);
Expand All @@ -88,7 +89,7 @@ public function getForm(): TemplateResponse {
'groups' => $this->getGroups($user),
'quota' => $storageInfo['quota'],
'totalSpace' => $totalSpace,
'usage' => \OCP\Util::humanFileSize($storageInfo['used']),
'usage' => Util::humanFileSize($storageInfo['used']),
'usageRelative' => round($storageInfo['relative']),
'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME),
'emailMap' => $this->getEmailMap($account),
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ public function updateQuota(?string $valueFromLDAP = null): void {
}

private function verifyQuotaValue(string $quotaValue): bool {
return $quotaValue === 'none' || $quotaValue === 'default' || \OCP\Util::computerFileSize($quotaValue) !== false;
return $quotaValue === 'none' || $quotaValue === 'default' || Util::computerFileSize($quotaValue) !== false;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions vendor-bin/rector/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require-dev": {
"rector/rector": "^1.2",
"nextcloud/rector": "^0.3.1"
"rector/rector": "^2.0",
"nextcloud/rector": "^0.4.1"
}
}
Loading
Loading