Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 1 addition & 4 deletions apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@

class RateLimitingPlugin extends ServerPlugin {

private Limiter $limiter;

public function __construct(
Limiter $limiter,
private Limiter $limiter,
private IUserManager $userManager,
private CalDavBackend $calDavBackend,
private LoggerInterface $logger,
private IAppConfig $config,
private ?string $userId,
) {
$this->limiter = $limiter;
}

public function initialize(DAV\Server $server): void {
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 @@ -42,9 +42,6 @@ class Principal implements BackendInterface {
/** @var bool */
private $hasCircles;

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

public function __construct(
private IUserManager $userManager,
private IGroupManager $groupManager,
Expand All @@ -53,14 +50,13 @@ public function __construct(
private IUserSession $userSession,
private IAppManager $appManager,
private ProxyMapper $proxyMapper,
KnownUserService $knownUserService,
private KnownUserService $knownUserService,
private IConfig $config,
private IFactory $languageFactory,
string $principalPrefix = 'principals/users/',
) {
$this->principalPrefix = trim($principalPrefix, '/');
$this->hasGroups = $this->hasCircles = ($principalPrefix === 'principals/users/');
$this->knownUserService = $knownUserService;
}

use PrincipalProxyTrait {
Expand Down
20 changes: 11 additions & 9 deletions apps/dav/lib/Connector/Sabre/TagsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin {
* @var \Sabre\DAV\Server
*/
private $server;

/**
* @var ITags
*/
private $tagger;
private ?ITags $tagger = null;

/**
* Array of file id to tags array
Expand Down Expand Up @@ -105,11 +101,17 @@ public function initialize(\Sabre\DAV\Server $server) {
*
* @return ITags tagger
*/
private function getTagger() {
if (!$this->tagger) {
$this->tagger = $this->tagManager->load('files');
private function getTagger(): ITags {
if ($this->tagger) {
return $this->tagger;
}

$tagger = $this->tagManager->load('files');
if ($tagger === null) {
throw new \RuntimeException('Tagger not found for files');
}
return $this->tagger;
$this->tagger = $tagger;
return $tagger;
}

/**
Expand Down
17 changes: 3 additions & 14 deletions apps/dav/lib/Migration/RemoveObjectProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,16 @@ class RemoveObjectProperties implements IRepairStep {
private const ME_CARD_PROPERTY = '{http://calendarserver.org/ns/}me-card';
private const CALENDAR_TRANSP_PROPERTY = '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp';

/**
* RemoveObjectProperties constructor.
*
* @param IDBConnection $connection
*/
public function __construct(
private IDBConnection $connection,
private readonly IDBConnection $connection,
) {
}

/**
* @inheritdoc
*/
public function getName() {
public function getName(): string {
return 'Remove invalid object properties';
}

/**
* @inheritdoc
*/
public function run(IOutput $output) {
public function run(IOutput $output): void {
$query = $this->connection->getQueryBuilder();
$updated = $query->delete('properties')
->where($query->expr()->in('propertyname', $query->createNamedParameter([self::RESOURCE_TYPE_PROPERTY, self::ME_CARD_PROPERTY, self::CALENDAR_TRANSP_PROPERTY], IQueryBuilder::PARAM_STR_ARRAY)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,17 @@ class AppleProvisioningPlugin extends ServerPlugin {
*/
protected $server;

/**
* @var \OC_Defaults
*/
protected $themingDefaults;

/**
* AppleProvisioningPlugin constructor.
*/
public function __construct(
protected IUserSession $userSession,
protected IURLGenerator $urlGenerator,
\OC_Defaults $themingDefaults,
protected \OC_Defaults $themingDefaults,
protected IRequest $request,
protected IL10N $l10n,
protected \Closure $uuidClosure,
) {
$this->themingDefaults = $themingDefaults;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions apps/dav/lib/SystemTag/SystemTagsInUseCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@
use Sabre\DAV\SimpleCollection;

class SystemTagsInUseCollection extends SimpleCollection {
protected SystemTagsInFilesDetector $systemTagsInFilesDetector;

/** @noinspection PhpMissingParentConstructorInspection */
public function __construct(
protected IUserSession $userSession,
protected IRootFolder $rootFolder,
protected ISystemTagManager $systemTagManager,
protected ISystemTagObjectMapper $tagMapper,
SystemTagsInFilesDetector $systemTagsInFilesDetector,
protected SystemTagsInFilesDetector $systemTagsInFilesDetector,
protected string $mediaType = '',
) {
$this->systemTagsInFilesDetector = $systemTagsInFilesDetector;
$this->name = 'systemtags-assigned';
if ($this->mediaType != '') {
$this->name .= '/' . $this->mediaType;
Expand Down
14 changes: 5 additions & 9 deletions apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IShare;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

/**
* Class LegacyPublicAuthTest
*
*
* @package OCA\DAV\Tests\unit\Connector
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
class LegacyPublicAuthTest extends \Test\TestCase {
#[Group('DB')]
class LegacyPublicAuthTest extends TestCase {
private ISession&MockObject $session;
private IRequest&MockObject $request;
private IManager&MockObject $shareManager;
Expand Down Expand Up @@ -55,7 +51,7 @@ protected function tearDown(): void {
\OC_User::setIncognitoMode(false);

// Set old user
\OC_User::setUserId($this->oldUser);
\OC_User::setUserId($this->oldUser ?: null);
if ($this->oldUser !== false) {
\OC_Util::setupFS($this->oldUser);
}
Expand Down
8 changes: 4 additions & 4 deletions apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testGetPrincipalsByPrefixWithoutPrefix(): void {
}

public function testGetPrincipalsByPrefixWithUsers(): void {
$fooUser = $this->createMock(User::class);
$fooUser = $this->createMock(IUser::class);
$fooUser
->expects($this->once())
->method('getUID')
Expand All @@ -91,7 +91,7 @@ public function testGetPrincipalsByPrefixWithUsers(): void {
->expects($this->once())
->method('getSystemEMailAddress')
->willReturn('');
$barUser = $this->createMock(User::class);
$barUser = $this->createMock(IUser::class);
$barUser
->expects($this->once())
->method('getUID')
Expand Down Expand Up @@ -183,7 +183,7 @@ public function testGetPrincipalsByPrefixEmpty(): void {
}

public function testGetPrincipalsByPathWithoutMail(): void {
$fooUser = $this->createMock(User::class);
$fooUser = $this->createMock(IUser::class);
$fooUser
->expects($this->once())
->method('getUID')
Expand Down Expand Up @@ -211,7 +211,7 @@ public function testGetPrincipalsByPathWithoutMail(): void {
}

public function testGetPrincipalsByPathWithMail(): void {
$fooUser = $this->createMock(User::class);
$fooUser = $this->createMock(IUser::class);
$fooUser
->expects($this->once())
->method('getSystemEMailAddress')
Expand Down
5 changes: 3 additions & 2 deletions apps/federatedfilesharing/lib/Notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
namespace OCA\FederatedFileSharing;

use OC\ServerNotAvailableException;
use OCA\FederatedFileSharing\Events\FederatedShareAddedEvent;
use OCP\AppFramework\Http;
use OCP\BackgroundJob\IJobList;
Expand Down Expand Up @@ -47,7 +48,7 @@ public function __construct(
* @param int $shareType (can be a remote user or group share)
* @return bool
* @throws HintException
* @throws \OC\ServerNotAvailableException
* @throws ServerNotAvailableException
*/
public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId, $shareType) {
[$user, $remote] = $this->addressHandler->splitUserRemote($shareWith);
Expand Down Expand Up @@ -106,7 +107,7 @@ public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $o
* @param string $filename
* @return array|false
* @throws HintException
* @throws \OC\ServerNotAvailableException
* @throws ServerNotAvailableException
*/
public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission, $filename, $shareType) {
$fields = [
Expand Down
6 changes: 1 addition & 5 deletions apps/federation/lib/SyncFederationAddressBooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@
*/
namespace OCA\Federation;

use OC\OCS\DiscoveryService;
use OCA\DAV\CardDAV\SyncService;
use OCP\AppFramework\Http;
use OCP\OCS\IDiscoveryService;
use Psr\Log\LoggerInterface;

class SyncFederationAddressBooks {
private DiscoveryService $ocsDiscoveryService;

public function __construct(
protected DbHandler $dbHandler,
private SyncService $syncService,
IDiscoveryService $ocsDiscoveryService,
private IDiscoveryService $ocsDiscoveryService,
private LoggerInterface $logger,
) {
$this->ocsDiscoveryService = $ocsDiscoveryService;
}

/**
Expand Down
27 changes: 11 additions & 16 deletions apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,16 @@ private function mapChange(\Icewind\SMB\Change $change) {
return $result;
}

private function mapNotifyType($smbType) {
switch ($smbType) {
case \Icewind\SMB\INotifyHandler::NOTIFY_ADDED:
return IChange::ADDED;
case \Icewind\SMB\INotifyHandler::NOTIFY_REMOVED:
return IChange::REMOVED;
case \Icewind\SMB\INotifyHandler::NOTIFY_MODIFIED:
case \Icewind\SMB\INotifyHandler::NOTIFY_ADDED_STREAM:
case \Icewind\SMB\INotifyHandler::NOTIFY_MODIFIED_STREAM:
case \Icewind\SMB\INotifyHandler::NOTIFY_REMOVED_STREAM:
return IChange::MODIFIED;
case \Icewind\SMB\INotifyHandler::NOTIFY_RENAMED_NEW:
return IChange::RENAMED;
default:
return null;
}
/**
* @return IChange::ADDED|IChange::REMOVED|IChange::MODIFIED|IChange::RENAMED|null
*/
private function mapNotifyType($smbType): ?int {
return match ($smbType) {
\Icewind\SMB\INotifyHandler::NOTIFY_ADDED => IChange::ADDED,
\Icewind\SMB\INotifyHandler::NOTIFY_REMOVED => IChange::REMOVED,
\Icewind\SMB\INotifyHandler::NOTIFY_MODIFIED, \Icewind\SMB\INotifyHandler::NOTIFY_ADDED_STREAM, \Icewind\SMB\INotifyHandler::NOTIFY_MODIFIED_STREAM, \Icewind\SMB\INotifyHandler::NOTIFY_REMOVED_STREAM => IChange::MODIFIED,
\Icewind\SMB\INotifyHandler::NOTIFY_RENAMED_NEW => IChange::RENAMED,
default => null,
};
}
}
3 changes: 2 additions & 1 deletion apps/files_sharing/lib/Controller/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace OCA\Files_Sharing\Controller;

use OC\Security\CSP\ContentSecurityPolicy;
use OC\ServerNotAvailableException;
use OCA\DAV\Connector\Sabre\PublicAuth;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent;
Expand Down Expand Up @@ -219,7 +220,7 @@ protected function authFailed() {
* @param string $errorMessage
*
* @throws HintException
* @throws \OC\ServerNotAvailableException
* @throws ServerNotAvailableException
*
* @deprecated use OCP\Files_Sharing\Event\ShareLinkAccessedEvent
*/
Expand Down
3 changes: 2 additions & 1 deletion apps/files_sharing/lib/External/Mount.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use OC\Files\Mount\MountPoint;
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
use OC\Files\Storage\StorageFactory;
use OCA\Files_Sharing\ISharedMountPoint;

class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
Expand All @@ -19,7 +20,7 @@ class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
* @param string $mountpoint
* @param array $options
* @param \OCA\Files_Sharing\External\Manager $manager
* @param \OC\Files\Storage\StorageFactory $loader
* @param StorageFactory $loader
*/
public function __construct(
$storage,
Expand Down
6 changes: 3 additions & 3 deletions apps/files_sharing/lib/External/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
use OCP\Files\StorageInvalidException;
use OCP\Files\StorageNotAvailableException;

/**
* @property Storage $storage
*/
class Scanner extends \OC\Files\Cache\Scanner {
/** @var Storage */
protected $storage;

public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
// Disable locking for federated shares
parent::scan($path, $recursive, $reuse, false);
Expand Down
11 changes: 4 additions & 7 deletions apps/files_sharing/lib/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@

use OC\Files\ObjectStore\ObjectStoreScanner;
use OC\Files\Storage\Storage;
use OCP\Files\Cache\IScanner;

/**
* Scanner for SharedStorage
* @property SharedStorage $storage
*/
class Scanner extends \OC\Files\Cache\Scanner {
/**
* @var SharedStorage $storage
*/
protected $storage;

private $sourceScanner;
private ?IScanner $sourceScanner = null;

/**
* Returns metadata from the shared storage, but
Expand All @@ -40,7 +37,7 @@ public function getData($path) {
return $data;
}

private function getSourceScanner() {
private function getSourceScanner(): ?IScanner {
if ($this->sourceScanner) {
return $this->sourceScanner;
}
Expand Down
4 changes: 1 addition & 3 deletions apps/files_sharing/lib/SharedMount.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
* Shared mount points can be moved by the user
*/
class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint {
/**
* @var SharedStorage $storage
*/
/** @var ?SharedStorage $storage */
protected $storage = null;

/** @var IShare */
Expand Down
Loading
Loading