mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
Merge pull request #56496 from nextcloud/carl/rector
Run rector on lib/private
This commit is contained in:
commit
1dbaf178c3
471 changed files with 3512 additions and 5686 deletions
|
|
@ -24,17 +24,14 @@ use function explode;
|
|||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -53,14 +50,13 @@ class Principal implements BackendInterface {
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -105,11 +101,17 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
*
|
||||
* @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;
|
||||
}
|
||||
return $this->tagger;
|
||||
|
||||
$tagger = $this->tagManager->load('files');
|
||||
if ($tagger === null) {
|
||||
throw new \RuntimeException('Tagger not found for files');
|
||||
}
|
||||
$this->tagger = $tagger;
|
||||
return $tagger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,18 +22,15 @@ use Sabre\DAV\Exception\NotFound;
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -15,16 +15,12 @@ use OCP\Security\Bruteforce\IThrottler;
|
|||
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(name: 'DB')]
|
||||
class LegacyPublicAuthTest extends \Test\TestCase {
|
||||
#[Group(name: 'DB')]
|
||||
class LegacyPublicAuthTest extends TestCase {
|
||||
private ISession&MockObject $session;
|
||||
private IRequest&MockObject $request;
|
||||
private IManager&MockObject $shareManager;
|
||||
|
|
@ -55,7 +51,7 @@ class LegacyPublicAuthTest extends \Test\TestCase {
|
|||
\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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class PrincipalTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGetPrincipalsByPrefixWithUsers(): void {
|
||||
$fooUser = $this->createMock(User::class);
|
||||
$fooUser = $this->createMock(IUser::class);
|
||||
$fooUser
|
||||
->expects($this->once())
|
||||
->method('getUID')
|
||||
|
|
@ -91,7 +91,7 @@ class PrincipalTest extends TestCase {
|
|||
->expects($this->once())
|
||||
->method('getSystemEMailAddress')
|
||||
->willReturn('');
|
||||
$barUser = $this->createMock(User::class);
|
||||
$barUser = $this->createMock(IUser::class);
|
||||
$barUser
|
||||
->expects($this->once())
|
||||
->method('getUID')
|
||||
|
|
@ -183,7 +183,7 @@ class PrincipalTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGetPrincipalsByPathWithoutMail(): void {
|
||||
$fooUser = $this->createMock(User::class);
|
||||
$fooUser = $this->createMock(IUser::class);
|
||||
$fooUser
|
||||
->expects($this->once())
|
||||
->method('getUID')
|
||||
|
|
@ -211,7 +211,7 @@ class PrincipalTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGetPrincipalsByPathWithMail(): void {
|
||||
$fooUser = $this->createMock(User::class);
|
||||
$fooUser = $this->createMock(IUser::class);
|
||||
$fooUser
|
||||
->expects($this->once())
|
||||
->method('getSystemEMailAddress')
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace OCA\FederatedFileSharing;
|
||||
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCA\FederatedFileSharing\Events\FederatedShareAddedEvent;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\BackgroundJob\IJobList;
|
||||
|
|
@ -47,7 +48,7 @@ class Notifications {
|
|||
* @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);
|
||||
|
|
@ -106,7 +107,7 @@ class Notifications {
|
|||
* @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 = [
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -110,21 +110,16 @@ class SMBNotifyHandler implements INotifyHandler {
|
|||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -219,7 +220,7 @@ class ShareController extends AuthPublicShareController {
|
|||
* @param string $errorMessage
|
||||
*
|
||||
* @throws HintException
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*
|
||||
* @deprecated use OCP\Files_Sharing\Event\ShareLinkAccessedEvent
|
||||
*/
|
||||
|
|
|
|||
6
apps/files_sharing/lib/External/Scanner.php
vendored
6
apps/files_sharing/lib/External/Scanner.php
vendored
|
|
@ -13,10 +13,10 @@ use OCP\Files\NotFoundException;
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -10,17 +10,14 @@ namespace OCA\Files_Sharing;
|
|||
|
||||
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
|
||||
|
|
@ -40,7 +37,7 @@ class Scanner extends \OC\Files\Cache\Scanner {
|
|||
return $data;
|
||||
}
|
||||
|
||||
private function getSourceScanner() {
|
||||
private function getSourceScanner(): ?IScanner {
|
||||
if ($this->sourceScanner) {
|
||||
return $this->sourceScanner;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,7 @@ use Psr\Log\LoggerInterface;
|
|||
* 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 */
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ class ShareAPIControllerTest extends TestCase {
|
|||
return $fileInfo->getMimeType() === 'mimeWithPreview';
|
||||
});
|
||||
$this->dateTimeZone = $this->createMock(IDateTimeZone::class);
|
||||
$this->dateTimeZone->method('getTimeZone')
|
||||
->willReturn(new \DateTimeZone('UTC'));
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->factory = $this->createMock(IProviderFactory::class);
|
||||
$this->mailer = $this->createMock(IMailer::class);
|
||||
|
|
@ -158,10 +160,7 @@ class ShareAPIControllerTest extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShareAPIController&MockObject
|
||||
*/
|
||||
private function mockFormatShare() {
|
||||
private function mockFormatShare(): ShareAPIController&MockObject {
|
||||
return $this->getMockBuilder(ShareAPIController::class)
|
||||
->setConstructorArgs([
|
||||
$this->appName,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ use OCP\IUserManager;
|
|||
|
||||
class RetryJob extends Job {
|
||||
private string $lookupServer;
|
||||
private Signer $signer;
|
||||
protected int $retries = 0;
|
||||
protected bool $retainJob = false;
|
||||
|
||||
|
|
@ -38,10 +37,9 @@ class RetryJob extends Job {
|
|||
private IConfig $config,
|
||||
private IUserManager $userManager,
|
||||
private IAccountManager $accountManager,
|
||||
Signer $signer,
|
||||
private Signer $signer,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
$this->signer = $signer;
|
||||
|
||||
$this->lookupServer = $this->config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com');
|
||||
if (!empty($this->lookupServer)) {
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ use OCP\Security\VerificationToken\IVerificationToken;
|
|||
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
||||
class VerificationController extends Controller {
|
||||
|
||||
/** @var Crypto */
|
||||
private $crypto;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
|
|
@ -39,10 +36,9 @@ class VerificationController extends Controller {
|
|||
private IL10N $l10n,
|
||||
private IUserSession $userSession,
|
||||
private IAccountManager $accountManager,
|
||||
Crypto $crypto,
|
||||
private Crypto $crypto,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->crypto = $crypto;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,11 +16,9 @@ use OCP\User\Events\UserDeletedEvent;
|
|||
/** @template-implements IEventListener<UserDeletedEvent> */
|
||||
class UserDeletedListener implements IEventListener {
|
||||
|
||||
/** @var KnownUserService */
|
||||
private $service;
|
||||
|
||||
public function __construct(KnownUserService $service) {
|
||||
$this->service = $service;
|
||||
public function __construct(
|
||||
private KnownUserService $service,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace OCA\Settings\AppInfo;
|
|||
use OC\AppFramework\Utility\TimeFactory;
|
||||
use OC\Authentication\Events\AppPasswordCreatedEvent;
|
||||
use OC\Authentication\Token\IProvider;
|
||||
use OC\Server;
|
||||
use OC\Settings\Manager;
|
||||
use OCA\Settings\ConfigLexicon;
|
||||
use OCA\Settings\Hooks;
|
||||
use OCA\Settings\Listener\AppPasswordCreatedActivityListener;
|
||||
|
|
@ -85,25 +85,28 @@ use OCP\AppFramework\App;
|
|||
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||
use OCP\AppFramework\IAppContainer;
|
||||
use OCP\Defaults;
|
||||
use OCP\Group\Events\GroupDeletedEvent;
|
||||
use OCP\Group\Events\UserAddedEvent;
|
||||
use OCP\Group\Events\UserRemovedEvent;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IConfig;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Mail\IMailer;
|
||||
use OCP\Security\ICrypto;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\Server;
|
||||
use OCP\Settings\Events\DeclarativeSettingsGetValueEvent;
|
||||
use OCP\Settings\Events\DeclarativeSettingsSetValueEvent;
|
||||
use OCP\Settings\IManager;
|
||||
use OCP\User\Events\PasswordUpdatedEvent;
|
||||
use OCP\User\Events\UserChangedEvent;
|
||||
use OCP\Util;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class Application extends App implements IBootstrap {
|
||||
public const APP_ID = 'settings';
|
||||
|
||||
/**
|
||||
* @param array $urlParams
|
||||
*/
|
||||
public function __construct(array $urlParams = []) {
|
||||
parent::__construct(self::APP_ID, $urlParams);
|
||||
}
|
||||
|
|
@ -140,32 +143,23 @@ class Application extends App implements IBootstrap {
|
|||
/**
|
||||
* Core class wrappers
|
||||
*/
|
||||
$context->registerService(IProvider::class, function (IAppContainer $appContainer) {
|
||||
/** @var IServerContainer $serverContainer */
|
||||
$serverContainer = $appContainer->query(IServerContainer::class);
|
||||
return $serverContainer->query(IProvider::class);
|
||||
$context->registerService(IProvider::class, function (): IProvider {
|
||||
return Server::get(IProvider::class);
|
||||
});
|
||||
$context->registerService(IManager::class, function (IAppContainer $appContainer) {
|
||||
/** @var IServerContainer $serverContainer */
|
||||
$serverContainer = $appContainer->query(IServerContainer::class);
|
||||
return $serverContainer->getSettingsManager();
|
||||
$context->registerService(IManager::class, function (): Manager {
|
||||
return Server::get(Manager::class);
|
||||
});
|
||||
|
||||
$context->registerService(NewUserMailHelper::class, function (IAppContainer $appContainer) {
|
||||
/** @var Server $server */
|
||||
$server = $appContainer->query(IServerContainer::class);
|
||||
/** @var Defaults $defaults */
|
||||
$defaults = $server->query(Defaults::class);
|
||||
|
||||
$context->registerService(NewUserMailHelper::class, function (ContainerInterface $appContainer) {
|
||||
return new NewUserMailHelper(
|
||||
$defaults,
|
||||
$server->getURLGenerator(),
|
||||
$server->getL10NFactory(),
|
||||
$server->getMailer(),
|
||||
$server->getSecureRandom(),
|
||||
Server::get(Defaults::class),
|
||||
$appContainer->get(IURLGenerator::class),
|
||||
$appContainer->get(IFactory::class),
|
||||
$appContainer->get(IMailer::class),
|
||||
$appContainer->get(ISecureRandom::class),
|
||||
new TimeFactory(),
|
||||
$server->getConfig(),
|
||||
$server->getCrypto(),
|
||||
$appContainer->get(IConfig::class),
|
||||
$appContainer->get(ICrypto::class),
|
||||
Util::getDefaultEmailAddress('no-reply')
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ use OCP\Session\Exceptions\SessionNotAvailableException;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AuthSettingsController extends Controller {
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
|
|
|
|||
|
|
@ -25,24 +25,20 @@ use OCP\IL10N;
|
|||
use OCP\IRequest;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Server;
|
||||
|
||||
class ChangePasswordController extends Controller {
|
||||
private Session $userSession;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
private ?string $userId,
|
||||
private IUserManager $userManager,
|
||||
IUserSession $userSession,
|
||||
private Session $userSession,
|
||||
private GroupManager $groupManager,
|
||||
private IAppManager $appManager,
|
||||
private IL10N $l,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->userSession = $userSession;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,21 +27,17 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
||||
class CheckSetupController extends Controller {
|
||||
/** @var Checker */
|
||||
private $checker;
|
||||
|
||||
public function __construct(
|
||||
$appName,
|
||||
IRequest $request,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private IL10N $l10n,
|
||||
Checker $checker,
|
||||
private Checker $checker,
|
||||
private LoggerInterface $logger,
|
||||
private ISetupCheckManager $setupCheckManager,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->checker = $checker;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ use OCP\IRequest;
|
|||
|
||||
class LogSettingsController extends Controller {
|
||||
|
||||
/** @var Log */
|
||||
private $log;
|
||||
|
||||
public function __construct(string $appName, IRequest $request, Log $logger) {
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
private Log $log,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->log = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,15 +16,12 @@ use OCP\IRequest;
|
|||
|
||||
class TwoFactorSettingsController extends Controller {
|
||||
|
||||
/** @var MandatoryTwoFactor */
|
||||
private $mandatoryTwoFactor;
|
||||
|
||||
public function __construct(string $appName,
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
MandatoryTwoFactor $mandatoryTwoFactor) {
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
|
||||
}
|
||||
|
||||
public function index(): JSONResponse {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use OCP\IUserSession;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OC\Authentication\Events\AppPasswordCreatedEvent>
|
||||
* @template-implements IEventListener<AppPasswordCreatedEvent>
|
||||
*/
|
||||
class AppPasswordCreatedActivityListener implements IEventListener {
|
||||
public function __construct(
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ use OCP\AppFramework\Middleware;
|
|||
use OCP\Group\ISubAdmin;
|
||||
use OCP\IL10N;
|
||||
use OCP\IUserSession;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Verifies whether an user has at least subadmin rights.
|
||||
* Verifies whether a user has at least sub-admin rights.
|
||||
* To bypass use the `@NoSubAdminRequired` annotation
|
||||
*/
|
||||
class SubadminMiddleware extends Middleware {
|
||||
|
|
@ -41,13 +42,8 @@ class SubadminMiddleware extends Middleware {
|
|||
return $this->subAdminManager->isSubAdmin($userObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if sharing is enabled before the controllers is executed
|
||||
* @param Controller $controller
|
||||
* @param string $methodName
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function beforeController($controller, $methodName) {
|
||||
#[Override]
|
||||
public function beforeController(Controller $controller, string $methodName): void {
|
||||
if (!$this->reflector->hasAnnotation('NoSubAdminRequired') && !$this->reflector->hasAnnotation('AuthorizedAdminSetting')) {
|
||||
if (!$this->isSubAdmin()) {
|
||||
throw new NotAdminException($this->l10n->t('Logged in account must be a sub admin'));
|
||||
|
|
@ -55,15 +51,8 @@ class SubadminMiddleware extends Middleware {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return 403 page in case of an exception
|
||||
* @param Controller $controller
|
||||
* @param string $methodName
|
||||
* @param \Exception $exception
|
||||
* @return TemplateResponse
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function afterException($controller, $methodName, \Exception $exception) {
|
||||
#[Override]
|
||||
public function afterException(Controller $controller, string $methodName, \Exception $exception): TemplateResponse {
|
||||
if ($exception instanceof NotAdminException) {
|
||||
$response = new TemplateResponse('core', '403', [], 'guest');
|
||||
$response->setStatus(Http::STATUS_FORBIDDEN);
|
||||
|
|
|
|||
|
|
@ -15,16 +15,13 @@ use OCP\IUserManager;
|
|||
use OCP\Settings\ISettings;
|
||||
|
||||
class Security implements ISettings {
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor;
|
||||
|
||||
public function __construct(
|
||||
private IManager $manager,
|
||||
private IUserManager $userManager,
|
||||
MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private IInitialState $initialState,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,23 +35,19 @@ use OCP\Util;
|
|||
|
||||
class PersonalInfo implements ISettings {
|
||||
|
||||
/** @var ProfileManager */
|
||||
private $profileManager;
|
||||
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private IUserManager $userManager,
|
||||
private IGroupManager $groupManager,
|
||||
private ITeamManager $teamManager,
|
||||
private IAccountManager $accountManager,
|
||||
ProfileManager $profileManager,
|
||||
private ProfileManager $profileManager,
|
||||
private IAppManager $appManager,
|
||||
private IFactory $l10nFactory,
|
||||
private IL10N $l,
|
||||
private IInitialState $initialStateService,
|
||||
private IManager $manager,
|
||||
) {
|
||||
$this->profileManager = $profileManager;
|
||||
}
|
||||
|
||||
public function getForm(): TemplateResponse {
|
||||
|
|
|
|||
|
|
@ -24,21 +24,13 @@ use function is_null;
|
|||
|
||||
class TwoFactor implements ISettings {
|
||||
|
||||
/** @var ProviderLoader */
|
||||
private $providerLoader;
|
||||
|
||||
/** @var MandatoryTwoFactor */
|
||||
private $mandatoryTwoFactor;
|
||||
|
||||
public function __construct(
|
||||
ProviderLoader $providerLoader,
|
||||
MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private ProviderLoader $providerLoader,
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor,
|
||||
private IUserSession $userSession,
|
||||
private IConfig $config,
|
||||
private ?string $userId,
|
||||
) {
|
||||
$this->providerLoader = $providerLoader;
|
||||
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
|
||||
}
|
||||
|
||||
public function getForm(): TemplateResponse {
|
||||
|
|
|
|||
|
|
@ -17,20 +17,12 @@ use OCP\Settings\ISettings;
|
|||
|
||||
class WebAuthn implements ISettings {
|
||||
|
||||
/** @var PublicKeyCredentialMapper */
|
||||
private $mapper;
|
||||
|
||||
/** @var Manager */
|
||||
private $manager;
|
||||
|
||||
public function __construct(
|
||||
PublicKeyCredentialMapper $mapper,
|
||||
private PublicKeyCredentialMapper $mapper,
|
||||
private string $userId,
|
||||
private IInitialStateService $initialStateService,
|
||||
Manager $manager,
|
||||
private Manager $manager,
|
||||
) {
|
||||
$this->mapper = $mapper;
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
public function getForm() {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
|
|||
|
||||
use TAccountsHelper;
|
||||
|
||||
private ProfileManager $profileManager;
|
||||
|
||||
private const PATH_ROOT = Application::APP_ID . '/';
|
||||
|
||||
private const PATH_ACCOUNT_FILE = AccountMigrator::PATH_ROOT . 'account.json';
|
||||
|
|
@ -46,11 +44,10 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
|
|||
public function __construct(
|
||||
private IAccountManager $accountManager,
|
||||
private IAvatarManager $avatarManager,
|
||||
ProfileManager $profileManager,
|
||||
private ProfileManager $profileManager,
|
||||
private ProfileConfigMapper $configMapper,
|
||||
private IL10N $l10n,
|
||||
) {
|
||||
$this->profileManager = $profileManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ use OCP\IConfig;
|
|||
use OCP\IRequest;
|
||||
|
||||
class IconController extends Controller {
|
||||
/** @var FileAccessHelper */
|
||||
private $fileAccessHelper;
|
||||
|
||||
public function __construct(
|
||||
$appName,
|
||||
IRequest $request,
|
||||
|
|
@ -35,11 +32,10 @@ class IconController extends Controller {
|
|||
private ThemingDefaults $themingDefaults,
|
||||
private IconBuilder $iconBuilder,
|
||||
private ImageManager $imageManager,
|
||||
FileAccessHelper $fileAccessHelper,
|
||||
private FileAccessHelper $fileAccessHelper,
|
||||
private IAppManager $appManager,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->fileAccessHelper = $fileAccessHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,18 +18,14 @@ use OCP\IUserManager;
|
|||
|
||||
class CheckBackupCodes extends QueuedJob {
|
||||
|
||||
/** @var Manager */
|
||||
private $twofactorManager;
|
||||
|
||||
public function __construct(
|
||||
ITimeFactory $timeFactory,
|
||||
private IUserManager $userManager,
|
||||
private IJobList $jobList,
|
||||
Manager $twofactorManager,
|
||||
private Manager $twofactorManager,
|
||||
private IRegistry $registry,
|
||||
) {
|
||||
parent::__construct($timeFactory);
|
||||
$this->twofactorManager = $twofactorManager;
|
||||
}
|
||||
|
||||
protected function run($argument) {
|
||||
|
|
|
|||
|
|
@ -1048,13 +1048,9 @@ class Access extends LDAPUtility {
|
|||
/**
|
||||
* Returns the LDAP handler
|
||||
*
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param mixed[] $arguments
|
||||
* @return mixed
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
private function invokeLDAPMethod(string $command, ...$arguments) {
|
||||
if ($command == 'controlPagedResultResponse') {
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ class Connection extends LDAPUtility {
|
|||
/**
|
||||
* @param string $host
|
||||
* @param string $port
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
private function doConnect($host, $port): bool {
|
||||
if ($host === '') {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace OCA\User_LDAP\User;
|
|||
|
||||
use InvalidArgumentException;
|
||||
use OC\Accounts\AccountManager;
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCA\User_LDAP\Access;
|
||||
use OCA\User_LDAP\Connection;
|
||||
use OCA\User_LDAP\Exceptions\AttributeNotSet;
|
||||
|
|
@ -693,7 +694,7 @@ class User {
|
|||
|
||||
/**
|
||||
* @throws AttributeNotSet
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
* @throws PreConditionNotMetException
|
||||
*/
|
||||
public function getExtStorageHome():string {
|
||||
|
|
@ -714,7 +715,7 @@ class User {
|
|||
|
||||
/**
|
||||
* @throws PreConditionNotMetException
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
public function updateExtStorageHome(?string $valueFromLDAP = null):string {
|
||||
if ($valueFromLDAP === null) {
|
||||
|
|
|
|||
|
|
@ -262,10 +262,9 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
|
|||
/**
|
||||
* checks whether a user is still available on LDAP
|
||||
*
|
||||
* @param string|User $user either the Nextcloud user
|
||||
* name or an instance of that user
|
||||
* @param string|User $user either the Nextcloud user id or an instance of that user
|
||||
* @throws \Exception
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
public function userExistsOnLDAP($user, bool $ignoreCache = false): bool {
|
||||
if (is_string($user)) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace OCA\User_LDAP\Tests\Integration\Lib\User;
|
||||
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCA\User_LDAP\Mapping\UserMapping;
|
||||
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
|
||||
use OCA\User_LDAP\User\DeletedUsersIndex;
|
||||
|
|
@ -108,7 +109,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
|
|||
*
|
||||
* @param string $dn
|
||||
* @param string $image An image read via file_get_contents
|
||||
* @throws \OC\ServerNotAvailableException
|
||||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
private function setJpegPhotoAttribute($dn, $image) {
|
||||
$changeSet = ['jpegphoto' => $image];
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@ use OCP\Util;
|
|||
/** @template-implements IEventListener<BeforeTemplateRenderedEvent> */
|
||||
class BeforeTemplateRenderedListener implements IEventListener {
|
||||
|
||||
/** @var ProfileManager */
|
||||
private $profileManager;
|
||||
|
||||
/**
|
||||
* BeforeTemplateRenderedListener constructor.
|
||||
*
|
||||
|
|
@ -35,12 +32,11 @@ class BeforeTemplateRenderedListener implements IEventListener {
|
|||
* @param JSDataService $jsDataService
|
||||
*/
|
||||
public function __construct(
|
||||
ProfileManager $profileManager,
|
||||
private ProfileManager $profileManager,
|
||||
private IUserSession $userSession,
|
||||
private IInitialStateService $initialState,
|
||||
private JSDataService $jsDataService,
|
||||
) {
|
||||
$this->profileManager = $profileManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2175,31 +2175,6 @@
|
|||
<code><![CDATA[Response]]></code>
|
||||
</InvalidReturnType>
|
||||
</file>
|
||||
<file src="apps/settings/lib/AppInfo/Application.php">
|
||||
<DeprecatedInterface>
|
||||
<code><![CDATA[$serverContainer]]></code>
|
||||
<code><![CDATA[$serverContainer]]></code>
|
||||
<code><![CDATA[IAppContainer]]></code>
|
||||
<code><![CDATA[IAppContainer]]></code>
|
||||
<code><![CDATA[IAppContainer]]></code>
|
||||
</DeprecatedInterface>
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[getConfig]]></code>
|
||||
<code><![CDATA[getCrypto]]></code>
|
||||
<code><![CDATA[getL10NFactory]]></code>
|
||||
<code><![CDATA[getMailer]]></code>
|
||||
<code><![CDATA[getSecureRandom]]></code>
|
||||
<code><![CDATA[getURLGenerator]]></code>
|
||||
<code><![CDATA[query]]></code>
|
||||
<code><![CDATA[query]]></code>
|
||||
<code><![CDATA[query]]></code>
|
||||
<code><![CDATA[query]]></code>
|
||||
<code><![CDATA[query]]></code>
|
||||
</DeprecatedMethod>
|
||||
<UndefinedInterfaceMethod>
|
||||
<code><![CDATA[getSettingsManager]]></code>
|
||||
</UndefinedInterfaceMethod>
|
||||
</file>
|
||||
<file src="apps/settings/lib/BackgroundJobs/VerifyUserData.php">
|
||||
<DeprecatedConstant>
|
||||
<code><![CDATA[IAccountManager::PROPERTY_TWITTER]]></code>
|
||||
|
|
@ -3214,14 +3189,6 @@
|
|||
<code><![CDATA[getName]]></code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="lib/private/AppFramework/DependencyInjection/DIContainer.php">
|
||||
<InvalidReturnStatement>
|
||||
<code><![CDATA[$this->server]]></code>
|
||||
</InvalidReturnStatement>
|
||||
<InvalidReturnType>
|
||||
<code><![CDATA[\OCP\IServerContainer]]></code>
|
||||
</InvalidReturnType>
|
||||
</file>
|
||||
<file src="lib/private/AppFramework/Http/Output.php">
|
||||
<InvalidReturnStatement>
|
||||
<code><![CDATA[@readfile($path)]]></code>
|
||||
|
|
@ -3261,9 +3228,6 @@
|
|||
<NoInterfaceProperties>
|
||||
<code><![CDATA[$this->request->server]]></code>
|
||||
</NoInterfaceProperties>
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[\OCA\Talk\Controller\PageController]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/private/AppFramework/Services/AppConfig.php">
|
||||
<MoreSpecificImplementedParamType>
|
||||
|
|
@ -3371,16 +3335,16 @@
|
|||
</file>
|
||||
<file src="lib/private/Command/CommandJob.php">
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[\Test\Command\FilesystemCommand]]></code>
|
||||
<code><![CDATA[\Test\Command\SimpleCommand]]></code>
|
||||
<code><![CDATA[\Test\Command\StateFullCommand]]></code>
|
||||
<code><![CDATA[FilesystemCommand]]></code>
|
||||
<code><![CDATA[SimpleCommand]]></code>
|
||||
<code><![CDATA[StateFullCommand]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/private/Command/QueueBus.php">
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[\Test\Command\FilesystemCommand]]></code>
|
||||
<code><![CDATA[\Test\Command\SimpleCommand]]></code>
|
||||
<code><![CDATA[\Test\Command\StateFullCommand]]></code>
|
||||
<code><![CDATA[FilesystemCommand]]></code>
|
||||
<code><![CDATA[SimpleCommand]]></code>
|
||||
<code><![CDATA[StateFullCommand]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/private/Comments/Manager.php">
|
||||
|
|
@ -3483,16 +3447,6 @@
|
|||
<code><![CDATA[string]]></code>
|
||||
</InvalidReturnType>
|
||||
</file>
|
||||
<file src="lib/private/Diagnostics/Query.php">
|
||||
<ImplementedReturnTypeMismatch>
|
||||
<code><![CDATA[float]]></code>
|
||||
</ImplementedReturnTypeMismatch>
|
||||
</file>
|
||||
<file src="lib/private/Diagnostics/QueryLogger.php">
|
||||
<InvalidArgument>
|
||||
<code><![CDATA[microtime(true)]]></code>
|
||||
</InvalidArgument>
|
||||
</file>
|
||||
<file src="lib/private/DirectEditing/Manager.php">
|
||||
<InvalidReturnType>
|
||||
<code><![CDATA[TemplateResponse]]></code>
|
||||
|
|
@ -3581,11 +3535,6 @@
|
|||
<code><![CDATA[self::getGlobalCache()->getStorageInfo($storageId)]]></code>
|
||||
</NullableReturnStatement>
|
||||
</file>
|
||||
<file src="lib/private/Files/Cache/Updater.php">
|
||||
<RedundantCondition>
|
||||
<code><![CDATA[$this->cache instanceof Cache]]></code>
|
||||
</RedundantCondition>
|
||||
</file>
|
||||
<file src="lib/private/Files/Cache/Wrapper/CacheWrapper.php">
|
||||
<LessSpecificImplementedReturnType>
|
||||
<code><![CDATA[array]]></code>
|
||||
|
|
@ -3612,18 +3561,6 @@
|
|||
<code><![CDATA[array{int, string, int}]]></code>
|
||||
</MoreSpecificReturnType>
|
||||
</file>
|
||||
<file src="lib/private/Files/Filesystem.php">
|
||||
<LessSpecificReturnStatement>
|
||||
<code><![CDATA[$mount->getStorage()]]></code>
|
||||
<code><![CDATA[self::getMountManager()->findByNumericId($id)]]></code>
|
||||
<code><![CDATA[self::getMountManager()->findByStorageId($id)]]></code>
|
||||
</LessSpecificReturnStatement>
|
||||
<MoreSpecificReturnType>
|
||||
<code><![CDATA[Mount\MountPoint[]]]></code>
|
||||
<code><![CDATA[Mount\MountPoint[]]]></code>
|
||||
<code><![CDATA[\OC\Files\Storage\Storage|null]]></code>
|
||||
</MoreSpecificReturnType>
|
||||
</file>
|
||||
<file src="lib/private/Files/Mount/MountPoint.php">
|
||||
<UndefinedInterfaceMethod>
|
||||
<code><![CDATA[wrap]]></code>
|
||||
|
|
@ -3799,32 +3736,7 @@
|
|||
<code><![CDATA[is_null($this->getContent())]]></code>
|
||||
</TypeDoesNotContainNull>
|
||||
</file>
|
||||
<file src="lib/private/Group/Group.php">
|
||||
<LessSpecificReturnStatement>
|
||||
<code><![CDATA[$users]]></code>
|
||||
</LessSpecificReturnStatement>
|
||||
<MoreSpecificReturnType>
|
||||
<code><![CDATA[\OC\User\User[]]]></code>
|
||||
</MoreSpecificReturnType>
|
||||
<RedundantCondition>
|
||||
<code><![CDATA[$this->emitter]]></code>
|
||||
<code><![CDATA[$this->emitter]]></code>
|
||||
<code><![CDATA[$this->emitter]]></code>
|
||||
</RedundantCondition>
|
||||
<UndefinedMethod>
|
||||
<code><![CDATA[addToGroup]]></code>
|
||||
<code><![CDATA[countUsersInGroup]]></code>
|
||||
<code><![CDATA[deleteGroup]]></code>
|
||||
<code><![CDATA[removeFromGroup]]></code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="lib/private/Group/Manager.php">
|
||||
<LessSpecificReturnStatement>
|
||||
<code><![CDATA[$groups]]></code>
|
||||
</LessSpecificReturnStatement>
|
||||
<MoreSpecificReturnType>
|
||||
<code><![CDATA[\OC\Group\Group[]]]></code>
|
||||
</MoreSpecificReturnType>
|
||||
<UndefinedInterfaceMethod>
|
||||
<code><![CDATA[createGroup]]></code>
|
||||
<code><![CDATA[getGroupDetails]]></code>
|
||||
|
|
@ -3913,11 +3825,6 @@
|
|||
<code><![CDATA[mixed]]></code>
|
||||
</LessSpecificImplementedReturnType>
|
||||
</file>
|
||||
<file src="lib/private/Notification/Manager.php">
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[\OCA\Notifications\App]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/private/Profile/Actions/FediverseAction.php">
|
||||
<NoValue>
|
||||
<code><![CDATA[$instance]]></code>
|
||||
|
|
@ -3936,16 +3843,6 @@
|
|||
<code><![CDATA[array]]></code>
|
||||
</ImplementedReturnTypeMismatch>
|
||||
</file>
|
||||
<file src="lib/private/Remote/Instance.php">
|
||||
<InvalidScalarArgument>
|
||||
<code><![CDATA[$response]]></code>
|
||||
</InvalidScalarArgument>
|
||||
</file>
|
||||
<file src="lib/private/Repair/Owncloud/CleanPreviews.php">
|
||||
<InvalidArgument>
|
||||
<code><![CDATA[false]]></code>
|
||||
</InvalidArgument>
|
||||
</file>
|
||||
<file src="lib/private/Repair/RemoveLinkShares.php">
|
||||
<InvalidPropertyAssignmentValue>
|
||||
<code><![CDATA[$this->userToNotify]]></code>
|
||||
|
|
@ -3979,25 +3876,6 @@
|
|||
<code><![CDATA[setPassword]]></code>
|
||||
</InternalMethod>
|
||||
</file>
|
||||
<file src="lib/private/Server.php">
|
||||
<ImplementedReturnTypeMismatch>
|
||||
<code><![CDATA[\OCP\Files\Folder|null]]></code>
|
||||
</ImplementedReturnTypeMismatch>
|
||||
<LessSpecificReturnStatement>
|
||||
<code><![CDATA[$this->get(IFile::class)]]></code>
|
||||
<code><![CDATA[$this->get(IGroupManager::class)]]></code>
|
||||
<code><![CDATA[$this->get(IUserManager::class)]]></code>
|
||||
<code><![CDATA[$this->get(IUserSession::class)]]></code>
|
||||
<code><![CDATA[$this->get(\OCP\Encryption\IManager::class)]]></code>
|
||||
</LessSpecificReturnStatement>
|
||||
<MoreSpecificReturnType>
|
||||
<code><![CDATA[\OC\Encryption\File]]></code>
|
||||
<code><![CDATA[\OC\Encryption\Manager]]></code>
|
||||
<code><![CDATA[\OC\Group\Manager]]></code>
|
||||
<code><![CDATA[\OC\User\Manager]]></code>
|
||||
<code><![CDATA[\OC\User\Session]]></code>
|
||||
</MoreSpecificReturnType>
|
||||
</file>
|
||||
<file src="lib/private/ServerContainer.php">
|
||||
<InvalidPropertyAssignmentValue>
|
||||
<code><![CDATA[$this->hasNoAppContainer]]></code>
|
||||
|
|
@ -4035,11 +3913,6 @@
|
|||
<code><![CDATA[$this->dbprettyname]]></code>
|
||||
</UndefinedThisPropertyFetch>
|
||||
</file>
|
||||
<file src="lib/private/Share20/Manager.php">
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/private/Share20/ProviderFactory.php">
|
||||
<InvalidReturnStatement>
|
||||
<code><![CDATA[$provider]]></code>
|
||||
|
|
@ -4065,14 +3938,6 @@
|
|||
<code><![CDATA[getSupportedApps]]></code>
|
||||
</UndefinedInterfaceMethod>
|
||||
</file>
|
||||
<file src="lib/private/TagManager.php">
|
||||
<InvalidNullableReturnType>
|
||||
<code><![CDATA[\OCP\ITags]]></code>
|
||||
</InvalidNullableReturnType>
|
||||
<NullableReturnStatement>
|
||||
<code><![CDATA[null]]></code>
|
||||
</NullableReturnStatement>
|
||||
</file>
|
||||
<file src="lib/private/Tags.php">
|
||||
<InvalidScalarArgument>
|
||||
<code><![CDATA[$from]]></code>
|
||||
|
|
|
|||
|
|
@ -23,11 +23,9 @@ return (require 'rector-shared.php')
|
|||
$nextcloudDir . '/remote.php',
|
||||
$nextcloudDir . '/status.php',
|
||||
$nextcloudDir . '/version.php',
|
||||
$nextcloudDir . '/lib/private/Share20/ProviderFactory.php',
|
||||
$nextcloudDir . '/lib/private/Template',
|
||||
$nextcloudDir . '/lib/private',
|
||||
$nextcloudDir . '/tests',
|
||||
// $nextcloudDir . '/config',
|
||||
// $nextcloudDir . '/lib',
|
||||
// $nextcloudDir . '/themes',
|
||||
])
|
||||
->withTypeCoverageLevel(0);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Repair extends Command {
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
protected function configure(): void {
|
||||
$this
|
||||
->setName('maintenance:repair')
|
||||
->setDescription('repair this installation')
|
||||
|
|
@ -81,20 +81,18 @@ class Repair extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$maintenanceMode = $this->config->getSystemValueBool('maintenance');
|
||||
$this->config->setSystemValue('maintenance', true);
|
||||
|
||||
$this->progress = new ProgressBar($output);
|
||||
$this->output = $output;
|
||||
$this->dispatcher->addListener(RepairStartEvent::class, [$this, 'handleRepairFeedBack']);
|
||||
$this->dispatcher->addListener(RepairAdvanceEvent::class, [$this, 'handleRepairFeedBack']);
|
||||
$this->dispatcher->addListener(RepairFinishEvent::class, [$this, 'handleRepairFeedBack']);
|
||||
$this->dispatcher->addListener(RepairStepEvent::class, [$this, 'handleRepairFeedBack']);
|
||||
$this->dispatcher->addListener(RepairInfoEvent::class, [$this, 'handleRepairFeedBack']);
|
||||
$this->dispatcher->addListener(RepairWarningEvent::class, [$this, 'handleRepairFeedBack']);
|
||||
$this->dispatcher->addListener(RepairErrorEvent::class, [$this, 'handleRepairFeedBack']);
|
||||
$this->dispatcher->addListener(RepairStartEvent::class, $this->handleRepairFeedBack(...));
|
||||
$this->dispatcher->addListener(RepairAdvanceEvent::class, $this->handleRepairFeedBack(...));
|
||||
$this->dispatcher->addListener(RepairFinishEvent::class, $this->handleRepairFeedBack(...));
|
||||
$this->dispatcher->addListener(RepairStepEvent::class, $this->handleRepairFeedBack(...));
|
||||
$this->dispatcher->addListener(RepairInfoEvent::class, $this->handleRepairFeedBack(...));
|
||||
$this->dispatcher->addListener(RepairWarningEvent::class, $this->handleRepairFeedBack(...));
|
||||
$this->dispatcher->addListener(RepairErrorEvent::class, $this->handleRepairFeedBack(...));
|
||||
|
||||
$this->repair->run();
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ class RedisCommand extends Base {
|
|||
return 1;
|
||||
}
|
||||
|
||||
$redis->setOption(\Redis::OPT_REPLY_LITERAL, true);
|
||||
if ($redis instanceof \Redis) {
|
||||
$redis->setOption(\Redis::OPT_REPLY_LITERAL, true);
|
||||
}
|
||||
$result = $redis->rawCommand(...$command);
|
||||
if ($result === false) {
|
||||
$output->writeln('<error>Redis command failed</error>');
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use OC\Route\Router;
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016-2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2012-2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/** @var OC\Route\Router $this */
|
||||
/** @var Router $this */
|
||||
// Core ajax actions
|
||||
// Routing
|
||||
$this->create('core_ajax_update', '/core/ajax/update.php')
|
||||
|
|
|
|||
|
|
@ -2182,7 +2182,6 @@ return array(
|
|||
'OC\\Share20\\UserDeletedListener' => $baseDir . '/lib/private/Share20/UserDeletedListener.php',
|
||||
'OC\\Share20\\UserRemovedListener' => $baseDir . '/lib/private/Share20/UserRemovedListener.php',
|
||||
'OC\\Share\\Constants' => $baseDir . '/lib/private/Share/Constants.php',
|
||||
'OC\\Share\\Helper' => $baseDir . '/lib/private/Share/Helper.php',
|
||||
'OC\\Share\\Share' => $baseDir . '/lib/private/Share/Share.php',
|
||||
'OC\\Snowflake\\APCuSequence' => $baseDir . '/lib/private/Snowflake/APCuSequence.php',
|
||||
'OC\\Snowflake\\FileSequence' => $baseDir . '/lib/private/Snowflake/FileSequence.php',
|
||||
|
|
|
|||
|
|
@ -2223,7 +2223,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OC\\Share20\\UserDeletedListener' => __DIR__ . '/../../..' . '/lib/private/Share20/UserDeletedListener.php',
|
||||
'OC\\Share20\\UserRemovedListener' => __DIR__ . '/../../..' . '/lib/private/Share20/UserRemovedListener.php',
|
||||
'OC\\Share\\Constants' => __DIR__ . '/../../..' . '/lib/private/Share/Constants.php',
|
||||
'OC\\Share\\Helper' => __DIR__ . '/../../..' . '/lib/private/Share/Helper.php',
|
||||
'OC\\Share\\Share' => __DIR__ . '/../../..' . '/lib/private/Share/Share.php',
|
||||
'OC\\Snowflake\\APCuSequence' => __DIR__ . '/../../..' . '/lib/private/Snowflake/APCuSequence.php',
|
||||
'OC\\Snowflake\\FileSequence' => __DIR__ . '/../../..' . '/lib/private/Snowflake/FileSequence.php',
|
||||
|
|
|
|||
|
|
@ -11,14 +11,12 @@ use OCP\Activity\IEventMerger;
|
|||
use OCP\IL10N;
|
||||
|
||||
class EventMerger implements IEventMerger {
|
||||
/** @var IL10N */
|
||||
protected $l10n;
|
||||
|
||||
/**
|
||||
* @param IL10N $l10n
|
||||
*/
|
||||
public function __construct(IL10N $l10n) {
|
||||
$this->l10n = $l10n;
|
||||
public function __construct(
|
||||
protected IL10N $l10n,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use OCP\IUser;
|
|||
use OCP\IUserSession;
|
||||
use OCP\RichObjectStrings\IRichTextFormatter;
|
||||
use OCP\RichObjectStrings\IValidator;
|
||||
use OCP\Server;
|
||||
|
||||
class Manager implements IManager {
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ class Manager implements IManager {
|
|||
private $consumers = [];
|
||||
|
||||
/**
|
||||
* @return \OCP\Activity\IConsumer[]
|
||||
* @return IConsumer[]
|
||||
*/
|
||||
protected function getConsumers(): array {
|
||||
if (!empty($this->consumers)) {
|
||||
|
|
@ -183,7 +184,7 @@ class Manager implements IManager {
|
|||
public function getFilters(): array {
|
||||
foreach ($this->filterClasses as $class => $false) {
|
||||
/** @var IFilter $filter */
|
||||
$filter = \OCP\Server::get($class);
|
||||
$filter = Server::get($class);
|
||||
|
||||
if (!$filter instanceof IFilter) {
|
||||
throw new \InvalidArgumentException('Invalid activity filter registered');
|
||||
|
|
@ -230,7 +231,7 @@ class Manager implements IManager {
|
|||
public function getProviders(): array {
|
||||
foreach ($this->providerClasses as $class => $false) {
|
||||
/** @var IProvider $provider */
|
||||
$provider = \OCP\Server::get($class);
|
||||
$provider = Server::get($class);
|
||||
|
||||
if (!$provider instanceof IProvider) {
|
||||
throw new \InvalidArgumentException('Invalid activity provider registered');
|
||||
|
|
@ -264,7 +265,7 @@ class Manager implements IManager {
|
|||
public function getSettings(): array {
|
||||
foreach ($this->settingsClasses as $class => $false) {
|
||||
/** @var ISetting $setting */
|
||||
$setting = \OCP\Server::get($class);
|
||||
$setting = Server::get($class);
|
||||
|
||||
if ($setting instanceof ISetting) {
|
||||
if (!$setting instanceof ActivitySettings) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use OCP\Config\IUserConfig;
|
|||
use OCP\Config\ValueType;
|
||||
use OCP\IConfig;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OCP\Server;
|
||||
|
||||
/**
|
||||
* Class to combine all the configuration options Nextcloud offers
|
||||
|
|
@ -24,7 +25,7 @@ class AllConfig implements IConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets and deletes system-wide values
|
||||
* Sets and deletes system wide values
|
||||
*
|
||||
* @param array $configs Associative array with `key => value` pairs
|
||||
* If value is null, the config key will be deleted
|
||||
|
|
@ -124,7 +125,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 29.0.0 Use {@see IAppConfig} directly
|
||||
*/
|
||||
public function getAppKeys($appName) {
|
||||
return \OC::$server->get(AppConfig::class)->getKeys($appName);
|
||||
return Server::get(AppConfig::class)->getKeys($appName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -136,7 +137,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 29.0.0 Use {@see IAppConfig} directly
|
||||
*/
|
||||
public function setAppValue($appName, $key, $value) {
|
||||
\OC::$server->get(AppConfig::class)->setValue($appName, $key, $value);
|
||||
Server::get(AppConfig::class)->setValue($appName, $key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -149,7 +150,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 29.0.0 Use {@see IAppConfig} directly
|
||||
*/
|
||||
public function getAppValue($appName, $key, $default = '') {
|
||||
return \OC::$server->get(AppConfig::class)->getValue($appName, $key, $default) ?? $default;
|
||||
return Server::get(AppConfig::class)->getValue($appName, $key, $default) ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -160,7 +161,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 29.0.0 Use {@see IAppConfig} directly
|
||||
*/
|
||||
public function deleteAppValue($appName, $key) {
|
||||
\OC::$server->get(AppConfig::class)->deleteKey($appName, $key);
|
||||
Server::get(AppConfig::class)->deleteKey($appName, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -170,7 +171,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 29.0.0 Use {@see IAppConfig} directly
|
||||
*/
|
||||
public function deleteAppValues($appName) {
|
||||
\OC::$server->get(AppConfig::class)->deleteApp($appName);
|
||||
Server::get(AppConfig::class)->deleteApp($appName);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -183,7 +184,7 @@ class AllConfig implements IConfig {
|
|||
* @param string|float|int $value the value that you want to store
|
||||
* @param string $preCondition only update if the config value was previously the value passed as $preCondition
|
||||
*
|
||||
* @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
|
||||
* @throws PreConditionNotMetException if a precondition is specified and is not met
|
||||
* @throws \UnexpectedValueException when trying to store an unexpected value
|
||||
* @deprecated 31.0.0 - use {@see IUserConfig} directly
|
||||
* @see IUserConfig::getValueString
|
||||
|
|
@ -198,7 +199,7 @@ class AllConfig implements IConfig {
|
|||
}
|
||||
|
||||
/** @var UserConfig $userPreferences */
|
||||
$userPreferences = \OCP\Server::get(IUserConfig::class);
|
||||
$userPreferences = Server::get(IUserConfig::class);
|
||||
if ($preCondition !== null) {
|
||||
try {
|
||||
if ($userPreferences->hasKey($userId, $appName, $key) && $userPreferences->getValueMixed($userId, $appName, $key) !== (string)$preCondition) {
|
||||
|
|
@ -232,7 +233,7 @@ class AllConfig implements IConfig {
|
|||
return $default;
|
||||
}
|
||||
/** @var UserConfig $userPreferences */
|
||||
$userPreferences = \OCP\Server::get(IUserConfig::class);
|
||||
$userPreferences = Server::get(IUserConfig::class);
|
||||
// because $default can be null ...
|
||||
if (!$userPreferences->hasKey($userId, $appName, $key)) {
|
||||
return $default;
|
||||
|
|
@ -250,7 +251,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 31.0.0 - use {@see IUserConfig::getKeys} directly
|
||||
*/
|
||||
public function getUserKeys($userId, $appName) {
|
||||
return \OCP\Server::get(IUserConfig::class)->getKeys($userId, $appName);
|
||||
return Server::get(IUserConfig::class)->getKeys($userId, $appName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -263,7 +264,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 31.0.0 - use {@see IUserConfig::deleteUserConfig} directly
|
||||
*/
|
||||
public function deleteUserValue($userId, $appName, $key) {
|
||||
\OCP\Server::get(IUserConfig::class)->deleteUserConfig($userId, $appName, $key);
|
||||
Server::get(IUserConfig::class)->deleteUserConfig($userId, $appName, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -277,7 +278,7 @@ class AllConfig implements IConfig {
|
|||
if ($userId === null) {
|
||||
return;
|
||||
}
|
||||
\OCP\Server::get(IUserConfig::class)->deleteAllUserConfig($userId);
|
||||
Server::get(IUserConfig::class)->deleteAllUserConfig($userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -288,7 +289,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 31.0.0 - use {@see IUserConfig::deleteApp} directly
|
||||
*/
|
||||
public function deleteAppFromAllUsers($appName) {
|
||||
\OCP\Server::get(IUserConfig::class)->deleteApp($appName);
|
||||
Server::get(IUserConfig::class)->deleteApp($appName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -308,7 +309,7 @@ class AllConfig implements IConfig {
|
|||
return [];
|
||||
}
|
||||
|
||||
$values = \OCP\Server::get(IUserConfig::class)->getAllValues($userId);
|
||||
$values = Server::get(IUserConfig::class)->getAllValues($userId);
|
||||
$result = [];
|
||||
foreach ($values as $app => $list) {
|
||||
foreach ($list as $key => $value) {
|
||||
|
|
@ -329,7 +330,7 @@ class AllConfig implements IConfig {
|
|||
* @deprecated 31.0.0 - use {@see IUserConfig::getValuesByUsers} directly
|
||||
*/
|
||||
public function getUserValueForUsers($appName, $key, $userIds) {
|
||||
return \OCP\Server::get(IUserConfig::class)->getValuesByUsers($appName, $key, ValueType::MIXED, $userIds);
|
||||
return Server::get(IUserConfig::class)->getValuesByUsers($appName, $key, ValueType::MIXED, $userIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -344,7 +345,7 @@ class AllConfig implements IConfig {
|
|||
*/
|
||||
public function getUsersForUserValue($appName, $key, $value) {
|
||||
/** @var list<string> $result */
|
||||
$result = iterator_to_array(\OCP\Server::get(IUserConfig::class)->searchUsersByValueString($appName, $key, $value));
|
||||
$result = iterator_to_array(Server::get(IUserConfig::class)->searchUsersByValueString($appName, $key, $value));
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use OC\AppConfig;
|
|||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OC\Config\ConfigManager;
|
||||
use OC\DB\MigrationService;
|
||||
use OC\Migration\BackgroundRepair;
|
||||
use OCP\Activity\IManager as IActivityManager;
|
||||
use OCP\App\AppPathNotFoundException;
|
||||
use OCP\App\Events\AppDisableEvent;
|
||||
|
|
@ -211,7 +212,7 @@ class AppManager implements IAppManager {
|
|||
/**
|
||||
* List all apps enabled for a user
|
||||
*
|
||||
* @param \OCP\IUser $user
|
||||
* @param IUser $user
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getEnabledAppsForUser(IUser $user) {
|
||||
|
|
@ -344,7 +345,7 @@ class AppManager implements IAppManager {
|
|||
* Check if an app is enabled for user
|
||||
*
|
||||
* @param string $appId
|
||||
* @param \OCP\IUser|null $user (optional) if not defined, the currently logged in user will be used
|
||||
* @param IUser|null $user (optional) if not defined, the currently logged in user will be used
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabledForUser($appId, $user = null) {
|
||||
|
|
@ -465,7 +466,7 @@ class AppManager implements IAppManager {
|
|||
]);
|
||||
return;
|
||||
}
|
||||
$eventLogger = \OC::$server->get(IEventLogger::class);
|
||||
$eventLogger = Server::get(IEventLogger::class);
|
||||
$eventLogger->start("bootstrap:load_app:$app", "Load app: $app");
|
||||
|
||||
// in case someone calls loadApp() directly
|
||||
|
|
@ -483,7 +484,7 @@ class AppManager implements IAppManager {
|
|||
$eventLogger->start("bootstrap:load_app:$app:info", "Load info.xml for $app and register any services defined in it");
|
||||
$info = $this->getAppInfo($app);
|
||||
if (!empty($info['activity'])) {
|
||||
$activityManager = \OC::$server->get(IActivityManager::class);
|
||||
$activityManager = Server::get(IActivityManager::class);
|
||||
if (!empty($info['activity']['filters'])) {
|
||||
foreach ($info['activity']['filters'] as $filter) {
|
||||
$activityManager->registerFilter($filter);
|
||||
|
|
@ -502,7 +503,7 @@ class AppManager implements IAppManager {
|
|||
}
|
||||
|
||||
if (!empty($info['settings'])) {
|
||||
$settingsManager = \OCP\Server::get(ISettingsManager::class);
|
||||
$settingsManager = Server::get(ISettingsManager::class);
|
||||
if (!empty($info['settings']['admin'])) {
|
||||
foreach ($info['settings']['admin'] as $setting) {
|
||||
$settingsManager->registerSetting('admin', $setting);
|
||||
|
|
@ -547,10 +548,10 @@ class AppManager implements IAppManager {
|
|||
'shareType' => $plugin['@attributes']['share-type'],
|
||||
'class' => $plugin['@value'],
|
||||
];
|
||||
$collaboratorSearch ??= \OC::$server->get(ICollaboratorSearch::class);
|
||||
$collaboratorSearch ??= Server::get(ICollaboratorSearch::class);
|
||||
$collaboratorSearch->registerPlugin($pluginInfo);
|
||||
} elseif ($plugin['@attributes']['type'] === 'autocomplete-sort') {
|
||||
$autoCompleteManager ??= \OC::$server->get(IAutoCompleteManager::class);
|
||||
$autoCompleteManager ??= Server::get(IAutoCompleteManager::class);
|
||||
$autoCompleteManager->registerSorter($plugin['@value']);
|
||||
}
|
||||
}
|
||||
|
|
@ -1075,7 +1076,7 @@ class AppManager implements IAppManager {
|
|||
\OC_App::executeRepairSteps($appId, $appData['repair-steps']['post-migration']);
|
||||
$queue = Server::get(IJobList::class);
|
||||
foreach ($appData['repair-steps']['live-migration'] as $step) {
|
||||
$queue->add(\OC\Migration\BackgroundRepair::class, [
|
||||
$queue->add(BackgroundRepair::class, [
|
||||
'app' => $appId,
|
||||
'step' => $step]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ namespace OC\App;
|
|||
|
||||
use OCP\IBinaryFinder;
|
||||
use OCP\IConfig;
|
||||
use OCP\Server;
|
||||
use OCP\Util;
|
||||
|
||||
/**
|
||||
* Class Platform
|
||||
|
|
@ -32,7 +34,7 @@ class Platform {
|
|||
}
|
||||
|
||||
public function getOcVersion(): string {
|
||||
$v = \OCP\Util::getVersion();
|
||||
$v = Util::getVersion();
|
||||
return implode('.', $v);
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +55,7 @@ class Platform {
|
|||
* @param $command
|
||||
*/
|
||||
public function isCommandKnown(string $command): bool {
|
||||
return \OCP\Server::get(IBinaryFinder::class)->findBinaryPath($command) !== false;
|
||||
return Server::get(IBinaryFinder::class)->findBinaryPath($command) !== false;
|
||||
}
|
||||
|
||||
public function getLibraryVersion(string $name): ?string {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use OCP\ICacheFactory;
|
|||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Security\ICrypto;
|
||||
use OCP\Server;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -85,7 +86,7 @@ class AppConfig implements IAppConfig {
|
|||
public readonly CacheFactory $cacheFactory,
|
||||
) {
|
||||
if ($config->getSystemValueBool('cache_app_config', true) && $cacheFactory->isLocalCacheAvailable()) {
|
||||
$cacheFactory->withServerVersionPrefix(function (ICacheFactory $factory) {
|
||||
$cacheFactory->withServerVersionPrefix(function (ICacheFactory $factory): void {
|
||||
$this->localCache = $factory->createLocal();
|
||||
});
|
||||
}
|
||||
|
|
@ -1783,7 +1784,7 @@ class AppConfig implements IAppConfig {
|
|||
public function getConfigDetailsFromLexicon(string $appId): array {
|
||||
if (!array_key_exists($appId, $this->configLexiconDetails)) {
|
||||
$entries = $aliases = [];
|
||||
$bootstrapCoordinator = \OCP\Server::get(Coordinator::class);
|
||||
$bootstrapCoordinator = Server::get(Coordinator::class);
|
||||
$configLexicon = $bootstrapCoordinator->getRegistrationContext()?->getConfigLexicon($appId);
|
||||
foreach ($configLexicon?->getAppConfigs() ?? [] as $configEntry) {
|
||||
$entries[$configEntry->getKey()] = $configEntry;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use OCP\Diagnostics\IEventLogger;
|
|||
use OCP\HintException;
|
||||
use OCP\IRequest;
|
||||
use OCP\Profiler\IProfiler;
|
||||
use OCP\Server;
|
||||
|
||||
/**
|
||||
* Entry point for every request in your app. You can consider this as your
|
||||
|
|
@ -46,7 +47,7 @@ class App {
|
|||
return $topNamespace . self::$nameSpaceCache[$appId];
|
||||
}
|
||||
|
||||
$appInfo = \OCP\Server::get(IAppManager::class)->getAppInfo($appId);
|
||||
$appInfo = Server::get(IAppManager::class)->getAppInfo($appId);
|
||||
if (isset($appInfo['namespace'])) {
|
||||
self::$nameSpaceCache[$appId] = trim($appInfo['namespace']);
|
||||
} else {
|
||||
|
|
@ -93,7 +94,7 @@ class App {
|
|||
// Disable profiler on the profiler UI
|
||||
$profiler->setEnabled($profiler->isEnabled() && !is_null($urlParams) && isset($urlParams['_route']) && !str_starts_with($urlParams['_route'], 'profiler.'));
|
||||
if ($profiler->isEnabled()) {
|
||||
\OC::$server->get(IEventLogger::class)->activate();
|
||||
Server::get(IEventLogger::class)->activate();
|
||||
$profiler->add(new RoutingDataCollector($container['appName'], $controllerName, $methodName));
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +186,7 @@ class App {
|
|||
$expireDate,
|
||||
$container->getServer()->getWebRoot(),
|
||||
null,
|
||||
$container->getServer()->getRequest()->getServerProtocol() === 'https',
|
||||
$container->getServer()->get(IRequest::class)->getServerProtocol() === 'https',
|
||||
true,
|
||||
$sameSite
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,11 +12,9 @@ namespace OC\AppFramework\Bootstrap;
|
|||
* @psalm-immutable
|
||||
*/
|
||||
abstract class ARegistration {
|
||||
/** @var string */
|
||||
private $appId;
|
||||
|
||||
public function __construct(string $appId) {
|
||||
$this->appId = $appId;
|
||||
public function __construct(
|
||||
private string $appId,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ use OCP\AppFramework\IAppContainer;
|
|||
use OCP\IServerContainer;
|
||||
|
||||
class BootContext implements IBootContext {
|
||||
/** @var IAppContainer */
|
||||
private $appContainer;
|
||||
|
||||
public function __construct(IAppContainer $appContainer) {
|
||||
$this->appContainer = $appContainer;
|
||||
public function __construct(
|
||||
private IAppContainer $appContainer,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getAppContainer(): IAppContainer {
|
||||
|
|
|
|||
|
|
@ -8,24 +8,20 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OC\AppFramework\Bootstrap;
|
||||
|
||||
use OCP\EventDispatcher\IEventListener;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
* @template-extends ServiceRegistration<\OCP\EventDispatcher\IEventListener>
|
||||
* @template-extends ServiceRegistration<IEventListener>
|
||||
*/
|
||||
class EventListenerRegistration extends ServiceRegistration {
|
||||
/** @var string */
|
||||
private $event;
|
||||
|
||||
/** @var int */
|
||||
private $priority;
|
||||
|
||||
public function __construct(string $appId,
|
||||
string $event,
|
||||
public function __construct(
|
||||
string $appId,
|
||||
private string $event,
|
||||
string $service,
|
||||
int $priority) {
|
||||
private int $priority,
|
||||
) {
|
||||
parent::__construct($appId, $service);
|
||||
$this->event = $event;
|
||||
$this->priority = $priority;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,11 +16,9 @@ use ReflectionParameter;
|
|||
use function array_map;
|
||||
|
||||
class FunctionInjector {
|
||||
/** @var ContainerInterface */
|
||||
private $container;
|
||||
|
||||
public function __construct(ContainerInterface $container) {
|
||||
$this->container = $container;
|
||||
public function __construct(
|
||||
private ContainerInterface $container,
|
||||
) {
|
||||
}
|
||||
|
||||
public function injectFn(callable $fn) {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@ use OCP\AppFramework\Middleware;
|
|||
* @template-extends ServiceRegistration<Middleware>
|
||||
*/
|
||||
class MiddlewareRegistration extends ServiceRegistration {
|
||||
private bool $global;
|
||||
|
||||
public function __construct(string $appId, string $service, bool $global) {
|
||||
public function __construct(
|
||||
string $appId,
|
||||
string $service,
|
||||
private bool $global,
|
||||
) {
|
||||
parent::__construct($appId, $service);
|
||||
$this->global = $global;
|
||||
}
|
||||
|
||||
public function isGlobal(): bool {
|
||||
|
|
|
|||
|
|
@ -12,18 +12,15 @@ namespace OC\AppFramework\Bootstrap;
|
|||
* @psalm-immutable
|
||||
*/
|
||||
final class ParameterRegistration extends ARegistration {
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var mixed */
|
||||
private $value;
|
||||
|
||||
public function __construct(string $appId,
|
||||
string $name,
|
||||
$value) {
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __construct(
|
||||
string $appId,
|
||||
private string $name,
|
||||
private $value,
|
||||
) {
|
||||
parent::__construct($appId);
|
||||
$this->name = $name;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace OC\AppFramework\Bootstrap;
|
||||
|
||||
use OCP\Preview\IProviderV2;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
* @template-extends ServiceRegistration<\OCP\Preview\IProviderV2>
|
||||
* @template-extends ServiceRegistration<IProviderV2>
|
||||
*/
|
||||
class PreviewProviderRegistration extends ServiceRegistration {
|
||||
/** @var string */
|
||||
private $mimeTypeRegex;
|
||||
|
||||
public function __construct(string $appId,
|
||||
public function __construct(
|
||||
string $appId,
|
||||
string $service,
|
||||
string $mimeTypeRegex) {
|
||||
private string $mimeTypeRegex,
|
||||
) {
|
||||
parent::__construct($appId, $service);
|
||||
$this->mimeTypeRegex = $mimeTypeRegex;
|
||||
}
|
||||
|
||||
public function getMimeTypeRegex(): string {
|
||||
|
|
|
|||
|
|
@ -25,18 +25,21 @@ use OCP\Config\Lexicon\ILexicon;
|
|||
use OCP\Dashboard\IManager;
|
||||
use OCP\Dashboard\IWidget;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Conversion\IConversionProvider;
|
||||
use OCP\Files\Template\ICustomTemplateProvider;
|
||||
use OCP\Http\WellKnown\IHandler;
|
||||
use OCP\Mail\Provider\IProvider as IMailProvider;
|
||||
use OCP\Notification\INotifier;
|
||||
use OCP\Profile\ILinkAction;
|
||||
use OCP\Search\IProvider;
|
||||
use OCP\Server;
|
||||
use OCP\Settings\IDeclarativeSettingsForm;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\Share\IPublicShareTemplateProvider;
|
||||
use OCP\SpeechToText\ISpeechToTextProvider;
|
||||
use OCP\Support\CrashReport\IReporter;
|
||||
use OCP\Talk\ITalkBackend;
|
||||
use OCP\TaskProcessing\ITaskType;
|
||||
use OCP\Teams\ITeamResourceProvider;
|
||||
use OCP\TextProcessing\IProvider as ITextProcessingProvider;
|
||||
use OCP\Translation\ITranslationProvider;
|
||||
|
|
@ -131,8 +134,6 @@ class RegistrationContext {
|
|||
/** @var ServiceRegistration<IPublicShareTemplateProvider>[] */
|
||||
private $publicShareTemplateProviders = [];
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/** @var ServiceRegistration<ISetupCheck>[] */
|
||||
private array $setupChecks = [];
|
||||
|
||||
|
|
@ -151,30 +152,26 @@ class RegistrationContext {
|
|||
/** @var ServiceRegistration<\OCP\TaskProcessing\IProvider>[] */
|
||||
private array $taskProcessingProviders = [];
|
||||
|
||||
/** @var ServiceRegistration<\OCP\TaskProcessing\ITaskType>[] */
|
||||
/** @var ServiceRegistration<ITaskType>[] */
|
||||
private array $taskProcessingTaskTypes = [];
|
||||
|
||||
/** @var ServiceRegistration<\OCP\Files\Conversion\IConversionProvider>[] */
|
||||
/** @var ServiceRegistration<IConversionProvider>[] */
|
||||
private array $fileConversionProviders = [];
|
||||
|
||||
/** @var ServiceRegistration<IMailProvider>[] */
|
||||
private $mailProviders = [];
|
||||
|
||||
public function __construct(LoggerInterface $logger) {
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function for(string $appId): IRegistrationContext {
|
||||
return new class($appId, $this) implements IRegistrationContext {
|
||||
/** @var string */
|
||||
private $appId;
|
||||
|
||||
/** @var RegistrationContext */
|
||||
private $context;
|
||||
|
||||
public function __construct(string $appId, RegistrationContext $context) {
|
||||
$this->appId = $appId;
|
||||
$this->context = $context;
|
||||
public function __construct(
|
||||
private string $appId,
|
||||
private RegistrationContext $context,
|
||||
) {
|
||||
}
|
||||
|
||||
public function registerCapability(string $capability): void {
|
||||
|
|
@ -630,14 +627,14 @@ class RegistrationContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* @psalm-param class-string<\OCP\TaskProcessing\ITaskType> $declarativeSettingsClass
|
||||
* @psalm-param class-string<ITaskType> $declarativeSettingsClass
|
||||
*/
|
||||
public function registerTaskProcessingTaskType(string $appId, string $taskProcessingTaskTypeClass) {
|
||||
$this->taskProcessingTaskTypes[] = new ServiceRegistration($appId, $taskProcessingTaskTypeClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param class-string<\OCP\Files\Conversion\IConversionProvider> $class
|
||||
* @psalm-param class-string<IConversionProvider> $class
|
||||
*/
|
||||
public function registerFileConversionProvider(string $appId, string $class): void {
|
||||
$this->fileConversionProviders[] = new ServiceRegistration($appId, $class);
|
||||
|
|
@ -996,14 +993,14 @@ class RegistrationContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return ServiceRegistration<\OCP\TaskProcessing\ITaskType>[]
|
||||
* @return ServiceRegistration<ITaskType>[]
|
||||
*/
|
||||
public function getTaskProcessingTaskTypes(): array {
|
||||
return $this->taskProcessingTaskTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ServiceRegistration<\OCP\Files\Conversion\IConversionProvider>[]
|
||||
* @return ServiceRegistration<IConversionProvider>[]
|
||||
*/
|
||||
public function getFileConversionProviders(): array {
|
||||
return $this->fileConversionProviders;
|
||||
|
|
@ -1029,6 +1026,6 @@ class RegistrationContext {
|
|||
return null;
|
||||
}
|
||||
|
||||
return \OCP\Server::get($this->configLexiconClasses[$appId]);
|
||||
return Server::get($this->configLexiconClasses[$appId]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,38 +13,26 @@ namespace OC\AppFramework\Bootstrap;
|
|||
*/
|
||||
class ServiceAliasRegistration extends ARegistration {
|
||||
/**
|
||||
* @var string
|
||||
* @psalm-var string|class-string
|
||||
* @param class-string $alias
|
||||
* @param class-string $target
|
||||
*/
|
||||
private $alias;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @psalm-var string|class-string
|
||||
*/
|
||||
private $target;
|
||||
|
||||
/**
|
||||
* @psalm-param string|class-string $alias
|
||||
* @paslm-param string|class-string $target
|
||||
*/
|
||||
public function __construct(string $appId,
|
||||
string $alias,
|
||||
string $target) {
|
||||
public function __construct(
|
||||
string $appId,
|
||||
private readonly string $alias,
|
||||
private readonly string $target,
|
||||
) {
|
||||
parent::__construct($appId);
|
||||
$this->alias = $alias;
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-return string|class-string
|
||||
* @return class-string
|
||||
*/
|
||||
public function getAlias(): string {
|
||||
return $this->alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-return string|class-string
|
||||
* @return class-string
|
||||
*/
|
||||
public function getTarget(): string {
|
||||
return $this->target;
|
||||
|
|
|
|||
|
|
@ -12,29 +12,23 @@ namespace OC\AppFramework\Bootstrap;
|
|||
* @psalm-immutable
|
||||
*/
|
||||
class ServiceFactoryRegistration extends ARegistration {
|
||||
/**
|
||||
* @var string
|
||||
* @psalm-var string|class-string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var callable
|
||||
* @psalm-var callable(\Psr\Container\ContainerInterface): mixed
|
||||
*/
|
||||
private $factory;
|
||||
|
||||
/** @var bool */
|
||||
private $shared;
|
||||
|
||||
public function __construct(string $appId,
|
||||
string $alias,
|
||||
/**
|
||||
* @param class-string $name
|
||||
*/
|
||||
public function __construct(
|
||||
string $appId,
|
||||
private string $name,
|
||||
callable $target,
|
||||
bool $shared) {
|
||||
private bool $shared,
|
||||
) {
|
||||
parent::__construct($appId);
|
||||
$this->name = $alias;
|
||||
$this->factory = $target;
|
||||
$this->shared = $shared;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
|
|
|
|||
|
|
@ -13,18 +13,14 @@ namespace OC\AppFramework\Bootstrap;
|
|||
* @template T
|
||||
*/
|
||||
class ServiceRegistration extends ARegistration {
|
||||
/**
|
||||
* @var string
|
||||
* @psalm-var class-string<T>
|
||||
*/
|
||||
private $service;
|
||||
|
||||
/**
|
||||
* @psalm-param class-string<T> $service
|
||||
*/
|
||||
public function __construct(string $appId, string $service) {
|
||||
public function __construct(
|
||||
string $appId,
|
||||
private string $service,
|
||||
) {
|
||||
parent::__construct($appId);
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OC\AppFramework\DependencyInjection;
|
||||
|
||||
use OC\AppFramework\App;
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OC\AppFramework\Http;
|
||||
use OC\AppFramework\Http\Dispatcher;
|
||||
use OC\AppFramework\Http\Output;
|
||||
|
|
@ -32,6 +34,8 @@ use OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware;
|
|||
use OC\AppFramework\Middleware\Security\SecurityMiddleware;
|
||||
use OC\AppFramework\Middleware\SessionMiddleware;
|
||||
use OC\AppFramework\ScopedPsrLogger;
|
||||
use OC\AppFramework\Services\AppConfig;
|
||||
use OC\AppFramework\Services\InitialState;
|
||||
use OC\AppFramework\Utility\ControllerMethodReflector;
|
||||
use OC\AppFramework\Utility\SimpleContainer;
|
||||
use OC\Core\Middleware\TwoFactorMiddleware;
|
||||
|
|
@ -39,6 +43,7 @@ use OC\Diagnostics\EventLogger;
|
|||
use OC\Log\PsrLoggerAdapter;
|
||||
use OC\ServerContainer;
|
||||
use OC\Settings\AuthorizedGroupMapper;
|
||||
use OC\User\Session;
|
||||
use OCA\WorkflowEngine\Manager;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Http\IOutput;
|
||||
|
|
@ -49,6 +54,7 @@ use OCP\AppFramework\Services\IInitialState;
|
|||
use OCP\Files\AppData\IAppDataFactory;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\Files\IAppData;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Group\ISubAdmin;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
|
|
@ -60,19 +66,23 @@ use OCP\IServerContainer;
|
|||
use OCP\ISession;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUserSession;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Security\Ip\IRemoteAddress;
|
||||
use OCP\Server;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class DIContainer extends SimpleContainer implements IAppContainer {
|
||||
protected string $appName;
|
||||
private array $middleWares = [];
|
||||
private ServerContainer $server;
|
||||
|
||||
public function __construct(string $appName, array $urlParams = [], ?ServerContainer $server = null) {
|
||||
public function __construct(
|
||||
protected string $appName,
|
||||
array $urlParams = [],
|
||||
?ServerContainer $server = null,
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->appName = $appName;
|
||||
$this->registerParameter('appName', $appName);
|
||||
$this->registerParameter('appName', $this->appName);
|
||||
$this->registerParameter('urlParams', $urlParams);
|
||||
|
||||
/** @deprecated 32.0.0 */
|
||||
|
|
@ -82,7 +92,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
$server = \OC::$server;
|
||||
}
|
||||
$this->server = $server;
|
||||
$this->server->registerAppContainer($appName, $this);
|
||||
$this->server->registerAppContainer($this->appName, $this);
|
||||
|
||||
// aliases
|
||||
/** @deprecated 26.0.0 inject $appName */
|
||||
|
|
@ -99,7 +109,11 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
$this->registerService(IOutput::class, fn (ContainerInterface $c): IOutput => new Output($c->get('webRoot')));
|
||||
|
||||
$this->registerService(Folder::class, function () {
|
||||
return $this->getServer()->getUserFolder();
|
||||
$user = $this->get(IUserSession::class)->getUser();
|
||||
if ($user === null) {
|
||||
return null;
|
||||
}
|
||||
return $this->getServer()->get(IRootFolder::class)->getUserFolder($user->getUID());
|
||||
});
|
||||
|
||||
$this->registerService(IAppData::class, function (ContainerInterface $c): IAppData {
|
||||
|
|
@ -107,7 +121,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
});
|
||||
|
||||
$this->registerService(IL10N::class, function (ContainerInterface $c) {
|
||||
return $this->getServer()->getL10N($c->get('appName'));
|
||||
return $this->getServer()->get(IFactory::class)->get($c->get('appName'));
|
||||
});
|
||||
|
||||
// Log wrappers
|
||||
|
|
@ -199,11 +213,11 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
$c->get(IURLGenerator::class),
|
||||
$c->get(LoggerInterface::class),
|
||||
$c->get('appName'),
|
||||
$server->getUserSession()->isLoggedIn(),
|
||||
$server->get(IUserSession::class)->isLoggedIn(),
|
||||
$c->get(IGroupManager::class),
|
||||
$c->get(ISubAdmin::class),
|
||||
$c->get(IAppManager::class),
|
||||
$server->getL10N('lib'),
|
||||
$server->get(IFactory::class)->get('lib'),
|
||||
$c->get(AuthorizedGroupMapper::class),
|
||||
$c->get(IUserSession::class),
|
||||
$c->get(IRemoteAddress::class),
|
||||
|
|
@ -218,7 +232,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
$dispatcher->registerMiddleware($c->get(PublicShareMiddleware::class));
|
||||
$dispatcher->registerMiddleware($c->get(AdditionalScriptsMiddleware::class));
|
||||
|
||||
$coordinator = $c->get(\OC\AppFramework\Bootstrap\Coordinator::class);
|
||||
$coordinator = $c->get(Coordinator::class);
|
||||
$registrationContext = $coordinator->getRegistrationContext();
|
||||
if ($registrationContext !== null) {
|
||||
$appId = $this->get('appName');
|
||||
|
|
@ -237,14 +251,11 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
return $dispatcher;
|
||||
});
|
||||
|
||||
$this->registerAlias(IAppConfig::class, \OC\AppFramework\Services\AppConfig::class);
|
||||
$this->registerAlias(IInitialState::class, \OC\AppFramework\Services\InitialState::class);
|
||||
$this->registerAlias(IAppConfig::class, AppConfig::class);
|
||||
$this->registerAlias(IInitialState::class, InitialState::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OCP\IServerContainer
|
||||
*/
|
||||
public function getServer() {
|
||||
public function getServer(): ServerContainer {
|
||||
return $this->server;
|
||||
}
|
||||
|
||||
|
|
@ -272,7 +283,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @return boolean
|
||||
*/
|
||||
public function isLoggedIn() {
|
||||
return \OC::$server->getUserSession()->isLoggedIn();
|
||||
return Server::get(IUserSession::class)->isLoggedIn();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -285,7 +296,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
}
|
||||
|
||||
private function getUserId(): string {
|
||||
return $this->getServer()->getSession()->get('user_id');
|
||||
return $this->getServer()->get(Session::class)->getSession()->get('user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -294,7 +305,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @param string $serviceName e.g. 'OCA\Files\Capabilities'
|
||||
*/
|
||||
public function registerCapability($serviceName) {
|
||||
$this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) {
|
||||
$this->query(\OC\CapabilitiesManager::class)->registerCapability(function () use ($serviceName) {
|
||||
return $this->query($serviceName);
|
||||
});
|
||||
}
|
||||
|
|
@ -357,7 +368,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
return parent::query($name, chain: $chain);
|
||||
} elseif ($this->appName === 'core' && str_starts_with($name, 'OC\\Core\\')) {
|
||||
return parent::query($name, chain: $chain);
|
||||
} elseif (str_starts_with($name, \OC\AppFramework\App::buildAppNamespace($this->appName) . '\\')) {
|
||||
} elseif (str_starts_with($name, App::buildAppNamespace($this->appName) . '\\')) {
|
||||
return parent::query($name, chain: $chain);
|
||||
} elseif (
|
||||
str_starts_with($name, 'OC\\AppFramework\\Services\\')
|
||||
|
|
|
|||
|
|
@ -10,18 +10,16 @@ namespace OC\AppFramework;
|
|||
use OCP\AppFramework\Http as BaseHttp;
|
||||
|
||||
class Http extends BaseHttp {
|
||||
private $server;
|
||||
private $protocolVersion;
|
||||
protected $headers;
|
||||
|
||||
/**
|
||||
* @param array $server $_SERVER
|
||||
* @param string $protocolVersion the http version to use defaults to HTTP/1.1
|
||||
*/
|
||||
public function __construct($server, $protocolVersion = 'HTTP/1.1') {
|
||||
$this->server = $server;
|
||||
$this->protocolVersion = $protocolVersion;
|
||||
|
||||
public function __construct(
|
||||
private $server,
|
||||
private $protocolVersion = 'HTTP/1.1',
|
||||
) {
|
||||
$this->headers = [
|
||||
self::STATUS_CONTINUE => 'Continue',
|
||||
self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols',
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use OC\Security\TrustedDomainHelper;
|
|||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
use OCP\IRequestId;
|
||||
use OCP\Server;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpFoundation\IpUtils;
|
||||
|
||||
|
|
@ -44,8 +45,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
public const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#';
|
||||
public const USER_AGENT_FREEBOX = '#^Mozilla/5\.0$#';
|
||||
public const REGEX_LOCALHOST = '/^(127\.0\.0\.1|localhost|\[::1\])$/';
|
||||
|
||||
protected string $inputStream;
|
||||
private bool $isPutStreamContentAlreadySent = false;
|
||||
protected array $items = [];
|
||||
protected array $allowedKeys = [
|
||||
|
|
@ -60,9 +59,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
'method',
|
||||
'requesttoken',
|
||||
];
|
||||
protected IRequestId $requestId;
|
||||
protected IConfig $config;
|
||||
protected ?CsrfTokenManager $csrfTokenManager;
|
||||
|
||||
protected bool $contentDecoded = false;
|
||||
private ?\JsonException $decodingException = null;
|
||||
|
|
@ -81,19 +77,17 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
* @param IRequestId $requestId
|
||||
* @param IConfig $config
|
||||
* @param CsrfTokenManager|null $csrfTokenManager
|
||||
* @param string $stream
|
||||
* @param string $inputStream
|
||||
* @see https://www.php.net/manual/en/reserved.variables.php
|
||||
*/
|
||||
public function __construct(array $vars,
|
||||
IRequestId $requestId,
|
||||
IConfig $config,
|
||||
?CsrfTokenManager $csrfTokenManager = null,
|
||||
string $stream = 'php://input') {
|
||||
$this->inputStream = $stream;
|
||||
public function __construct(
|
||||
array $vars,
|
||||
protected IRequestId $requestId,
|
||||
protected IConfig $config,
|
||||
protected ?CsrfTokenManager $csrfTokenManager = null,
|
||||
protected string $inputStream = 'php://input',
|
||||
) {
|
||||
$this->items['params'] = [];
|
||||
$this->requestId = $requestId;
|
||||
$this->config = $config;
|
||||
$this->csrfTokenManager = $csrfTokenManager;
|
||||
|
||||
if (!array_key_exists('method', $vars)) {
|
||||
$vars['method'] = 'GET';
|
||||
|
|
@ -660,7 +654,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
|
||||
if ($proto !== 'https' && $proto !== 'http') {
|
||||
// log unrecognized value so admin has a chance to fix it
|
||||
\OCP\Server::get(LoggerInterface::class)->critical(
|
||||
Server::get(LoggerInterface::class)->critical(
|
||||
'Server protocol is malformed [falling back to http] (check overwriteprotocol and/or X-Forwarded-Proto to remedy): ' . $proto,
|
||||
['app' => 'core']
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,13 +11,10 @@ use OCP\IRequestId;
|
|||
use OCP\Security\ISecureRandom;
|
||||
|
||||
class RequestId implements IRequestId {
|
||||
protected ISecureRandom $secureRandom;
|
||||
protected string $requestId;
|
||||
|
||||
public function __construct(string $uniqueId,
|
||||
ISecureRandom $secureRandom) {
|
||||
$this->requestId = $uniqueId;
|
||||
$this->secureRandom = $secureRandom;
|
||||
public function __construct(
|
||||
protected string $requestId,
|
||||
protected ISecureRandom $secureRandom,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,11 +20,9 @@ class CompressionMiddleware extends Middleware {
|
|||
/** @var bool */
|
||||
private $useGZip;
|
||||
|
||||
/** @var IRequest */
|
||||
private $request;
|
||||
|
||||
public function __construct(IRequest $request) {
|
||||
$this->request = $request;
|
||||
public function __construct(
|
||||
private IRequest $request,
|
||||
) {
|
||||
$this->useGZip = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,9 @@ use OCP\AppFramework\Middleware;
|
|||
use OCP\IRequest;
|
||||
|
||||
class NotModifiedMiddleware extends Middleware {
|
||||
/** @var IRequest */
|
||||
private $request;
|
||||
|
||||
public function __construct(IRequest $request) {
|
||||
$this->request = $request;
|
||||
public function __construct(
|
||||
private IRequest $request,
|
||||
) {
|
||||
}
|
||||
|
||||
public function afterController($controller, $methodName, Response $response) {
|
||||
|
|
|
|||
|
|
@ -20,17 +20,15 @@ use OCP\AppFramework\OCSController;
|
|||
use OCP\IRequest;
|
||||
|
||||
class OCSMiddleware extends Middleware {
|
||||
/** @var IRequest */
|
||||
private $request;
|
||||
|
||||
/** @var int */
|
||||
private $ocsVersion;
|
||||
|
||||
/**
|
||||
* @param IRequest $request
|
||||
*/
|
||||
public function __construct(IRequest $request) {
|
||||
$this->request = $request;
|
||||
public function __construct(
|
||||
private IRequest $request,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +57,7 @@ class OCSMiddleware extends Middleware {
|
|||
if ($controller instanceof OCSController && $exception instanceof OCSException) {
|
||||
$code = $exception->getCode();
|
||||
if ($code === 0) {
|
||||
$code = \OCP\AppFramework\OCSController::RESPOND_UNKNOWN_ERROR;
|
||||
$code = OCSController::RESPOND_UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
return $this->buildNewResponse($controller, $code, $exception->getMessage());
|
||||
|
|
@ -72,7 +70,7 @@ class OCSMiddleware extends Middleware {
|
|||
* @param Controller $controller
|
||||
* @param string $methodName
|
||||
* @param Response $response
|
||||
* @return \OCP\AppFramework\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function afterController($controller, $methodName, Response $response) {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -16,11 +16,9 @@ use OCP\AppFramework\Http\Response;
|
|||
use OCP\AppFramework\Middleware;
|
||||
|
||||
class FeaturePolicyMiddleware extends Middleware {
|
||||
/** @var FeaturePolicyManager */
|
||||
private $policyManager;
|
||||
|
||||
public function __construct(FeaturePolicyManager $policyManager) {
|
||||
$this->policyManager = $policyManager;
|
||||
public function __construct(
|
||||
private FeaturePolicyManager $policyManager,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,14 +19,10 @@ use OCP\IURLGenerator;
|
|||
* a reload but if the session variable is set we properly redirect to the login page.
|
||||
*/
|
||||
class ReloadExecutionMiddleware extends Middleware {
|
||||
/** @var ISession */
|
||||
private $session;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
public function __construct(ISession $session, IURLGenerator $urlGenerator) {
|
||||
$this->session = $session;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(
|
||||
private ISession $session,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
public function beforeController($controller, $methodName) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use OC\AppFramework\Middleware\Security\Exceptions\SecurityException;
|
|||
use OC\AppFramework\Middleware\Security\Exceptions\StrictCookieMissingException;
|
||||
use OC\Settings\AuthorizedGroupMapper;
|
||||
use OC\User\Session;
|
||||
use OCA\Talk\Controller\PageController as TalkPageController;
|
||||
use OCP\App\AppPathNotFoundException;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
|
@ -108,7 +109,8 @@ class SecurityMiddleware extends Middleware {
|
|||
// for normal HTML requests and not for AJAX requests
|
||||
$this->navigationManager->setActiveEntry($this->appName);
|
||||
|
||||
if (get_class($controller) === \OCA\Talk\Controller\PageController::class && $methodName === 'showCall') {
|
||||
/** @psalm-suppress UndefinedClass */
|
||||
if (get_class($controller) === TalkPageController::class && $methodName === 'showCall') {
|
||||
$this->navigationManager->setActiveEntry('spreed');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,10 @@ use OCP\ISession;
|
|||
use ReflectionMethod;
|
||||
|
||||
class SessionMiddleware extends Middleware {
|
||||
/** @var ControllerMethodReflector */
|
||||
private $reflector;
|
||||
|
||||
/** @var ISession */
|
||||
private $session;
|
||||
|
||||
public function __construct(ControllerMethodReflector $reflector,
|
||||
ISession $session) {
|
||||
$this->reflector = $reflector;
|
||||
$this->session = $session;
|
||||
public function __construct(
|
||||
private ControllerMethodReflector $reflector,
|
||||
private ISession $session,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,39 +21,20 @@ abstract class BaseResponse extends Response {
|
|||
/** @var array */
|
||||
protected $data;
|
||||
|
||||
/** @var string */
|
||||
protected $format;
|
||||
|
||||
/** @var ?string */
|
||||
protected $statusMessage;
|
||||
|
||||
/** @var ?int */
|
||||
protected $itemsCount;
|
||||
|
||||
/** @var ?int */
|
||||
protected $itemsPerPage;
|
||||
|
||||
/**
|
||||
* BaseResponse constructor.
|
||||
*
|
||||
* @param DataResponse<S, T, H> $dataResponse
|
||||
* @param string $format
|
||||
* @param string|null $statusMessage
|
||||
* @param int|null $itemsCount
|
||||
* @param int|null $itemsPerPage
|
||||
*/
|
||||
public function __construct(DataResponse $dataResponse,
|
||||
$format = 'xml',
|
||||
$statusMessage = null,
|
||||
$itemsCount = null,
|
||||
$itemsPerPage = null) {
|
||||
public function __construct(
|
||||
DataResponse $dataResponse,
|
||||
protected string $format = 'xml',
|
||||
protected ?string $statusMessage = null,
|
||||
protected ?int $itemsCount = null,
|
||||
protected ?int $itemsPerPage = null,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->format = $format;
|
||||
$this->statusMessage = $statusMessage;
|
||||
$this->itemsCount = $itemsCount;
|
||||
$this->itemsPerPage = $itemsPerPage;
|
||||
|
||||
$this->data = $dataResponse->getData();
|
||||
|
||||
$this->setHeaders($dataResponse->getHeaders());
|
||||
|
|
@ -67,7 +48,7 @@ abstract class BaseResponse extends Response {
|
|||
$this->throttle($throttleMetadata);
|
||||
}
|
||||
|
||||
if ($format === 'json') {
|
||||
if ($this->format === 'json') {
|
||||
$this->addHeader(
|
||||
'Content-Type', 'application/json; charset=utf-8'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,18 +11,11 @@ use OC\AppFramework\App;
|
|||
use OC\AppFramework\DependencyInjection\DIContainer;
|
||||
|
||||
class RouteActionHandler {
|
||||
private $controllerName;
|
||||
private $actionName;
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @param string $controllerName
|
||||
* @param string $actionName
|
||||
*/
|
||||
public function __construct(DIContainer $container, $controllerName, $actionName) {
|
||||
$this->controllerName = $controllerName;
|
||||
$this->actionName = $actionName;
|
||||
$this->container = $container;
|
||||
public function __construct(
|
||||
private DIContainer $container,
|
||||
private string $controllerName,
|
||||
private string $actionName,
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke($params) {
|
||||
|
|
|
|||
|
|
@ -12,16 +12,10 @@ use Psr\Log\LoggerInterface;
|
|||
use function array_merge;
|
||||
|
||||
class ScopedPsrLogger implements LoggerInterface {
|
||||
/** @var LoggerInterface */
|
||||
private $inner;
|
||||
|
||||
/** @var string */
|
||||
private $appId;
|
||||
|
||||
public function __construct(LoggerInterface $inner,
|
||||
string $appId) {
|
||||
$this->inner = $inner;
|
||||
$this->appId = $appId;
|
||||
public function __construct(
|
||||
private LoggerInterface $inner,
|
||||
private string $appId,
|
||||
) {
|
||||
}
|
||||
|
||||
public function emergency($message, array $context = []): void {
|
||||
|
|
|
|||
|
|
@ -12,15 +12,10 @@ use OCP\AppFramework\Services\IInitialState;
|
|||
use OCP\IInitialStateService;
|
||||
|
||||
class InitialState implements IInitialState {
|
||||
/** @var IInitialStateService */
|
||||
private $state;
|
||||
|
||||
/** @var string */
|
||||
private $appName;
|
||||
|
||||
public function __construct(IInitialStateService $state, string $appName) {
|
||||
$this->state = $state;
|
||||
$this->appName = $appName;
|
||||
public function __construct(
|
||||
private IInitialStateService $state,
|
||||
private string $appName,
|
||||
) {
|
||||
}
|
||||
|
||||
public function provideInitialState(string $key, $data): void {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,9 @@ use Psr\Log\LoggerInterface;
|
|||
* Implementation based on https://github.com/marcj/topsort.php
|
||||
*/
|
||||
class AppScriptSort {
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(LoggerInterface $logger) {
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
namespace OC\Archive;
|
||||
|
||||
use Icewind\Streams\CallbackWrapper;
|
||||
use OCP\Files;
|
||||
use OCP\ITempManager;
|
||||
use OCP\Server;
|
||||
|
||||
class TAR extends Archive {
|
||||
public const PLAIN = 0;
|
||||
|
|
@ -25,12 +28,11 @@ class TAR extends Archive {
|
|||
|
||||
private \Archive_Tar $tar;
|
||||
|
||||
private string $path;
|
||||
|
||||
public function __construct(string $source) {
|
||||
public function __construct(
|
||||
private string $path,
|
||||
) {
|
||||
$types = [null, 'gz', 'bz2'];
|
||||
$this->path = $source;
|
||||
$this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]);
|
||||
$this->tar = new \Archive_Tar($this->path, $types[self::getTarType($this->path)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +62,7 @@ class TAR extends Archive {
|
|||
* add an empty folder to the archive
|
||||
*/
|
||||
public function addFolder(string $path): bool {
|
||||
$tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
|
||||
$tmpBase = Server::get(ITempManager::class)->getTemporaryFolder();
|
||||
$path = rtrim($path, '/') . '/';
|
||||
if ($this->fileExists($path)) {
|
||||
return false;
|
||||
|
|
@ -103,7 +105,7 @@ class TAR extends Archive {
|
|||
*/
|
||||
public function rename(string $source, string $dest): bool {
|
||||
//no proper way to delete, rename entire archive, rename file and remake archive
|
||||
$tmp = \OC::$server->getTempManager()->getTemporaryFolder();
|
||||
$tmp = Server::get(ITempManager::class)->getTemporaryFolder();
|
||||
$this->tar->extract($tmp);
|
||||
rename($tmp . $source, $tmp . $dest);
|
||||
$this->tar->_close();
|
||||
|
|
@ -216,7 +218,7 @@ class TAR extends Archive {
|
|||
* extract a single file from the archive
|
||||
*/
|
||||
public function extractFile(string $path, string $dest): bool {
|
||||
$tmp = \OC::$server->getTempManager()->getTemporaryFolder();
|
||||
$tmp = Server::get(ITempManager::class)->getTemporaryFolder();
|
||||
if (!$this->fileExists($path)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -228,7 +230,7 @@ class TAR extends Archive {
|
|||
if ($success) {
|
||||
rename($tmp . $path, $dest);
|
||||
}
|
||||
\OCP\Files::rmdirr($tmp);
|
||||
Files::rmdirr($tmp);
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
|
@ -272,9 +274,9 @@ class TAR extends Archive {
|
|||
$this->fileList = false;
|
||||
$this->cachedHeaders = false;
|
||||
//no proper way to delete, extract entire archive, delete file and remake archive
|
||||
$tmp = \OC::$server->getTempManager()->getTemporaryFolder();
|
||||
$tmp = Server::get(ITempManager::class)->getTemporaryFolder();
|
||||
$this->tar->extract($tmp);
|
||||
\OCP\Files::rmdirr($tmp . $path);
|
||||
Files::rmdirr($tmp . $path);
|
||||
unlink($this->path);
|
||||
$this->reopen();
|
||||
$this->tar->createModify([$tmp], '', $tmp);
|
||||
|
|
@ -293,7 +295,7 @@ class TAR extends Archive {
|
|||
} else {
|
||||
$ext = '';
|
||||
}
|
||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
|
||||
$tmpFile = Server::get(ITempManager::class)->getTemporaryFile($ext);
|
||||
if ($this->fileExists($path)) {
|
||||
$this->extractFile($path, $tmpFile);
|
||||
} elseif ($mode === 'r' || $mode === 'rb') {
|
||||
|
|
@ -303,7 +305,7 @@ class TAR extends Archive {
|
|||
return fopen($tmpFile, $mode);
|
||||
} else {
|
||||
$handle = fopen($tmpFile, $mode);
|
||||
return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
|
||||
return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile): void {
|
||||
$this->writeBack($tmpFile, $path);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
namespace OC\Archive;
|
||||
|
||||
use Icewind\Streams\CallbackWrapper;
|
||||
use OCP\ITempManager;
|
||||
use OCP\Server;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ZIP extends Archive {
|
||||
|
|
@ -16,17 +18,13 @@ class ZIP extends Archive {
|
|||
*/
|
||||
private $zip;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
|
||||
public function __construct(string $source) {
|
||||
$this->path = $source;
|
||||
public function __construct(
|
||||
private string $path,
|
||||
) {
|
||||
$this->zip = new \ZipArchive();
|
||||
if ($this->zip->open($source, \ZipArchive::CREATE)) {
|
||||
if ($this->zip->open($this->path, \ZipArchive::CREATE)) {
|
||||
} else {
|
||||
\OC::$server->get(LoggerInterface::class)->warning('Error while opening archive ' . $source, ['app' => 'files_archive']);
|
||||
Server::get(LoggerInterface::class)->warning('Error while opening archive ' . $this->path, ['app' => 'files_archive']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -200,12 +198,12 @@ class ZIP extends Archive {
|
|||
} else {
|
||||
$ext = '';
|
||||
}
|
||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
|
||||
$tmpFile = Server::get(ITempManager::class)->getTemporaryFile($ext);
|
||||
if ($this->fileExists($path)) {
|
||||
$this->extractFile($path, $tmpFile);
|
||||
}
|
||||
$handle = fopen($tmpFile, $mode);
|
||||
return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
|
||||
return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile): void {
|
||||
$this->writeBack($tmpFile, $path);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,10 @@ use OC\Authentication\Token\IToken;
|
|||
use OCP\EventDispatcher\Event;
|
||||
|
||||
abstract class ARemoteWipeEvent extends Event {
|
||||
/** @var IToken */
|
||||
private $token;
|
||||
|
||||
public function __construct(IToken $token) {
|
||||
public function __construct(
|
||||
private IToken $token,
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public function getToken(): IToken {
|
||||
|
|
|
|||
|
|
@ -11,14 +11,11 @@ namespace OC\Authentication\Events;
|
|||
use OCP\EventDispatcher\Event;
|
||||
|
||||
class LoginFailed extends Event {
|
||||
private string $loginName;
|
||||
private ?string $password;
|
||||
|
||||
public function __construct(string $loginName, ?string $password) {
|
||||
public function __construct(
|
||||
private string $loginName,
|
||||
private ?string $password,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->loginName = $loginName;
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
public function getLoginName(): string {
|
||||
|
|
|
|||
|
|
@ -18,18 +18,13 @@ use OCP\IUserManager;
|
|||
use OCP\Util;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OC\Authentication\Events\LoginFailed>
|
||||
* @template-implements IEventListener<LoginFailed>
|
||||
*/
|
||||
class LoginFailedListener implements IEventListener {
|
||||
/** @var IEventDispatcher */
|
||||
private $dispatcher;
|
||||
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
|
||||
public function __construct(IEventDispatcher $dispatcher, IUserManager $userManager) {
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->userManager = $userManager;
|
||||
public function __construct(
|
||||
private IEventDispatcher $dispatcher,
|
||||
private IUserManager $userManager,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
|||
namespace OC\Authentication\Listeners;
|
||||
|
||||
use BadMethodCallException;
|
||||
use OC\Authentication\Events\ARemoteWipeEvent;
|
||||
use OC\Authentication\Events\RemoteWipeFinished;
|
||||
use OC\Authentication\Events\RemoteWipeStarted;
|
||||
use OC\Authentication\Token\IToken;
|
||||
|
|
@ -18,19 +19,13 @@ use OCP\EventDispatcher\IEventListener;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OC\Authentication\Events\ARemoteWipeEvent>
|
||||
* @template-implements IEventListener<ARemoteWipeEvent>
|
||||
*/
|
||||
class RemoteWipeActivityListener implements IEventListener {
|
||||
/** @var IActvityManager */
|
||||
private $activityManager;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(IActvityManager $activityManager,
|
||||
LoggerInterface $logger) {
|
||||
$this->activityManager = $activityManager;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private IActvityManager $activityManager,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
|||
namespace OC\Authentication\Listeners;
|
||||
|
||||
use Exception;
|
||||
use OC\Authentication\Events\ARemoteWipeEvent;
|
||||
use OC\Authentication\Events\RemoteWipeFinished;
|
||||
use OC\Authentication\Events\RemoteWipeStarted;
|
||||
use OCP\EventDispatcher\Event;
|
||||
|
|
@ -23,29 +24,18 @@ use Psr\Log\LoggerInterface;
|
|||
use function substr;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OC\Authentication\Events\ARemoteWipeEvent>
|
||||
* @template-implements IEventListener<ARemoteWipeEvent>
|
||||
*/
|
||||
class RemoteWipeEmailListener implements IEventListener {
|
||||
/** @var IMailer */
|
||||
private $mailer;
|
||||
private IL10N $l10n;
|
||||
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(IMailer $mailer,
|
||||
IUserManager $userManager,
|
||||
public function __construct(
|
||||
private IMailer $mailer,
|
||||
private IUserManager $userManager,
|
||||
IL10nFactory $l10nFactory,
|
||||
LoggerInterface $logger) {
|
||||
$this->mailer = $mailer;
|
||||
$this->userManager = $userManager;
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
$this->l10n = $l10nFactory->get('core');
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OC\Authentication\Listeners;
|
||||
|
||||
use OC\Authentication\Events\ARemoteWipeEvent;
|
||||
use OC\Authentication\Events\RemoteWipeFinished;
|
||||
use OC\Authentication\Events\RemoteWipeStarted;
|
||||
use OC\Authentication\Token\IToken;
|
||||
|
|
@ -17,19 +18,13 @@ use OCP\EventDispatcher\IEventListener;
|
|||
use OCP\Notification\IManager as INotificationManager;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OC\Authentication\Events\ARemoteWipeEvent>
|
||||
* @template-implements IEventListener<ARemoteWipeEvent>
|
||||
*/
|
||||
class RemoteWipeNotificationsListener implements IEventListener {
|
||||
/** @var INotificationManager */
|
||||
private $notificationManager;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
private $timeFactory;
|
||||
|
||||
public function __construct(INotificationManager $notificationManager,
|
||||
ITimeFactory $timeFactory) {
|
||||
$this->notificationManager = $notificationManager;
|
||||
$this->timeFactory = $timeFactory;
|
||||
public function __construct(
|
||||
private INotificationManager $notificationManager,
|
||||
private ITimeFactory $timeFactory,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ use OCP\EventDispatcher\IEventListener;
|
|||
use OCP\User\Events\UserDeletedEvent;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OCP\User\Events\UserDeletedEvent>
|
||||
* @template-implements IEventListener<UserDeletedEvent>
|
||||
*/
|
||||
class UserDeletedStoreCleanupListener implements IEventListener {
|
||||
/** @var Registry */
|
||||
private $registry;
|
||||
|
||||
public function __construct(Registry $registry) {
|
||||
$this->registry = $registry;
|
||||
public function __construct(
|
||||
private Registry $registry,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -16,19 +16,13 @@ use Psr\Log\LoggerInterface;
|
|||
use Throwable;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OCP\User\Events\UserDeletedEvent>
|
||||
* @template-implements IEventListener<UserDeletedEvent>
|
||||
*/
|
||||
class UserDeletedTokenCleanupListener implements IEventListener {
|
||||
/** @var Manager */
|
||||
private $manager;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(Manager $manager,
|
||||
LoggerInterface $logger) {
|
||||
$this->manager = $manager;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private Manager $manager,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,9 @@ use OCP\User\Events\UserDeletedEvent;
|
|||
|
||||
/** @template-implements IEventListener<UserDeletedEvent> */
|
||||
class UserDeletedWebAuthnCleanupListener implements IEventListener {
|
||||
/** @var PublicKeyCredentialMapper */
|
||||
private $credentialMapper;
|
||||
|
||||
public function __construct(PublicKeyCredentialMapper $credentialMapper) {
|
||||
$this->credentialMapper = $credentialMapper;
|
||||
public function __construct(
|
||||
private PublicKeyCredentialMapper $credentialMapper,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ use OCP\EventDispatcher\IEventListener;
|
|||
use OCP\User\Events\PostLoginEvent;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<\OCP\User\Events\PostLoginEvent>
|
||||
* @template-implements IEventListener<PostLoginEvent>
|
||||
*/
|
||||
class UserLoggedInListener implements IEventListener {
|
||||
/** @var Manager */
|
||||
private $manager;
|
||||
|
||||
public function __construct(Manager $manager) {
|
||||
$this->manager = $manager;
|
||||
public function __construct(
|
||||
private Manager $manager,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ abstract class ALoginCommand {
|
|||
if ($this->next !== null) {
|
||||
return $this->next->process($loginData);
|
||||
} else {
|
||||
return LoginResult::success($loginData);
|
||||
return LoginResult::success();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,9 @@ namespace OC\Authentication\Login;
|
|||
use OCP\IConfig;
|
||||
|
||||
class ClearLostPasswordTokensCommand extends ALoginCommand {
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,11 +11,9 @@ namespace OC\Authentication\Login;
|
|||
use OC\User\Session;
|
||||
|
||||
class CompleteLoginCommand extends ALoginCommand {
|
||||
/** @var Session */
|
||||
private $userSession;
|
||||
|
||||
public function __construct(Session $userSession) {
|
||||
$this->userSession = $userSession;
|
||||
public function __construct(
|
||||
private Session $userSession,
|
||||
) {
|
||||
}
|
||||
|
||||
public function process(LoginData $loginData): LoginResult {
|
||||
|
|
|
|||
|
|
@ -13,16 +13,10 @@ use OC\User\Session;
|
|||
use OCP\IConfig;
|
||||
|
||||
class CreateSessionTokenCommand extends ALoginCommand {
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var Session */
|
||||
private $userSession;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
Session $userSession) {
|
||||
$this->config = $config;
|
||||
$this->userSession = $userSession;
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private Session $userSession,
|
||||
) {
|
||||
}
|
||||
|
||||
public function process(LoginData $loginData): LoginResult {
|
||||
|
|
|
|||
|
|
@ -12,14 +12,10 @@ use OC\User\Session;
|
|||
use OCP\IConfig;
|
||||
|
||||
class FinishRememberedLoginCommand extends ALoginCommand {
|
||||
/** @var Session */
|
||||
private $userSession;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
public function __construct(Session $userSession, IConfig $config) {
|
||||
$this->userSession = $userSession;
|
||||
$this->config = $config;
|
||||
public function __construct(
|
||||
private Session $userSession,
|
||||
private IConfig $config,
|
||||
) {
|
||||
}
|
||||
|
||||
public function process(LoginData $loginData): LoginResult {
|
||||
|
|
|
|||
|
|
@ -14,15 +14,10 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class LoggedInCheckCommand extends ALoginCommand {
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var IEventDispatcher */
|
||||
private $dispatcher;
|
||||
|
||||
public function __construct(LoggerInterface $logger,
|
||||
IEventDispatcher $dispatcher) {
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = $dispatcher;
|
||||
public function __construct(
|
||||
private LoggerInterface $logger,
|
||||
private IEventDispatcher $dispatcher,
|
||||
) {
|
||||
}
|
||||
|
||||
public function process(LoginData $loginData): LoginResult {
|
||||
|
|
@ -35,7 +30,7 @@ class LoggedInCheckCommand extends ALoginCommand {
|
|||
|
||||
$this->dispatcher->dispatchTyped(new LoginFailed($loginName, $password));
|
||||
|
||||
return LoginResult::failure($loginData, LoginController::LOGIN_MSG_INVALIDPASSWORD);
|
||||
return LoginResult::failure(LoginController::LOGIN_MSG_INVALIDPASSWORD);
|
||||
}
|
||||
|
||||
return $this->processNextOrFinishSuccessfully($loginData);
|
||||
|
|
|
|||
|
|
@ -11,33 +11,24 @@ namespace OC\Authentication\Login;
|
|||
use OC\Core\Controller\LoginController;
|
||||
|
||||
class LoginResult {
|
||||
/** @var bool */
|
||||
private $success;
|
||||
private ?string $redirectUrl = null;
|
||||
private ?string $errorMessage = null;
|
||||
|
||||
/** @var LoginData */
|
||||
private $loginData;
|
||||
|
||||
/** @var string|null */
|
||||
private $redirectUrl;
|
||||
|
||||
/** @var string|null */
|
||||
private $errorMessage;
|
||||
|
||||
private function __construct(bool $success, LoginData $loginData) {
|
||||
$this->success = $success;
|
||||
$this->loginData = $loginData;
|
||||
private function __construct(
|
||||
private readonly bool $success,
|
||||
) {
|
||||
}
|
||||
|
||||
private function setRedirectUrl(string $url) {
|
||||
private function setRedirectUrl(string $url): void {
|
||||
$this->redirectUrl = $url;
|
||||
}
|
||||
|
||||
private function setErrorMessage(string $msg) {
|
||||
private function setErrorMessage(string $msg): void {
|
||||
$this->errorMessage = $msg;
|
||||
}
|
||||
|
||||
public static function success(LoginData $data, ?string $redirectUrl = null) {
|
||||
$result = new static(true, $data);
|
||||
public static function success(?string $redirectUrl = null): self {
|
||||
$result = new static(true);
|
||||
if ($redirectUrl !== null) {
|
||||
$result->setRedirectUrl($redirectUrl);
|
||||
}
|
||||
|
|
@ -47,8 +38,8 @@ class LoginResult {
|
|||
/**
|
||||
* @param LoginController::LOGIN_MSG_*|null $msg
|
||||
*/
|
||||
public static function failure(LoginData $data, ?string $msg = null): LoginResult {
|
||||
$result = new static(false, $data);
|
||||
public static function failure(?string $msg = null): self {
|
||||
$result = new static(false);
|
||||
if ($msg !== null) {
|
||||
$result->setErrorMessage($msg);
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue