Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/dav/lib/Command/CreateCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use OCP\IGroupManager;
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Server;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -66,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
Server::get(ProxyMapper::class),
Server::get(KnownUserService::class),
Server::get(IConfig::class),
\OC::$server->getL10NFactory(),
Server::get(IFactory::class),
);
$random = Server::get(ISecureRandom::class);
$logger = Server::get(LoggerInterface::class);
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/lib/Files/RootCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace OCA\DAV\Files;

use OCP\Files\FileInfo;
use OCP\Files\IRootFolder;
use OCP\IUserSession;
use OCP\Server;
use Sabre\DAV\INode;
Expand Down Expand Up @@ -35,7 +36,7 @@ public function getChildForPrincipal(array $principalInfo) {
// in the future this could be considered to be used for accessing shared files
return new SimpleCollection($name);
}
$userFolder = \OC::$server->getUserFolder();
$userFolder = Server::get(IRootFolder::class)->getUserFolder($user->getUID());
if (!($userFolder instanceof FileInfo)) {
throw new \Exception('Home does not exist');
}
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/lib/RootCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use OCP\IGroupManager;
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Server;
use OCP\SystemTag\ISystemTagManager;
Expand Down Expand Up @@ -75,7 +76,7 @@ public function __construct() {
$proxyMapper,
Server::get(KnownUserService::class),
Server::get(IConfig::class),
\OC::$server->getL10NFactory()
Server::get(IFactory::class)
);

$groupPrincipalBackend = new GroupPrincipalBackend($groupManager, $userSession, $shareManager, $config);
Expand Down
6 changes: 4 additions & 2 deletions apps/files_sharing/tests/ExternalStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\ICertificateManager;
use OCP\Server;

/**
* Tests for the external Storage class for remote shares.
*/
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ExternalStorageTest extends \Test\TestCase {
public static function optionsProvider() {
public static function optionsProvider(): array {
return [
[
'http://remoteserver:8080/owncloud',
Expand Down Expand Up @@ -54,7 +56,7 @@ public static function optionsProvider() {
}

private function getTestStorage($uri) {
$certificateManager = \OC::$server->getCertificateManager();
$certificateManager = Server::get(ICertificateManager::class);
$httpClientService = $this->createMock(IClientService::class);
$manager = $this->createMock(ExternalShareManager::class);
$client = $this->createMock(IClient::class);
Expand Down
8 changes: 5 additions & 3 deletions apps/testing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\IAppConfig;
use OCP\IGroupManager;
use OCP\IUserManager;
use OCP\Settings\Events\DeclarativeSettingsGetValueEvent;
use OCP\Settings\Events\DeclarativeSettingsRegisterFormEvent;
use OCP\Settings\Events\DeclarativeSettingsSetValueEvent;
Expand Down Expand Up @@ -67,9 +69,9 @@ public function register(IRegistrationContext $context): void {

public function boot(IBootContext $context): void {
$server = $context->getServerContainer();
$config = $server->getConfig();
if ($config->getAppValue(self::APP_ID, 'enable_alt_user_backend', 'no') === 'yes') {
$userManager = $server->getUserManager();
$config = $server->get(IAppConfig::class);
if ($config->getValueBool(self::APP_ID, 'enable_alt_user_backend')) {
$userManager = $server->get(IUserManager::class);

// replace all user backends with this one
$userManager->clearBackends();
Expand Down
24 changes: 0 additions & 24 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,6 @@
<code><![CDATA[$this->principalUri]]></code>
</InvalidArgument>
</file>
<file src="apps/dav/lib/Command/CreateCalendar.php">
<DeprecatedMethod>
<code><![CDATA[getL10NFactory]]></code>
</DeprecatedMethod>
</file>
<file src="apps/dav/lib/Command/SendEventReminders.php">
<DeprecatedMethod>
<code><![CDATA[getAppValue]]></code>
Expand Down Expand Up @@ -775,11 +770,6 @@
<code><![CDATA[bool]]></code>
</InvalidReturnType>
</file>
<file src="apps/dav/lib/Files/RootCollection.php">
<DeprecatedMethod>
<code><![CDATA[getUserFolder]]></code>
</DeprecatedMethod>
</file>
<file src="apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php">
<DeprecatedMethod>
<code><![CDATA[deleteUserValue]]></code>
Expand Down Expand Up @@ -830,7 +820,6 @@
<file src="apps/dav/lib/RootCollection.php">
<DeprecatedMethod>
<code><![CDATA[getL10N]]></code>
<code><![CDATA[getL10NFactory]]></code>
</DeprecatedMethod>
</file>
<file src="apps/dav/lib/Search/ContactsSearchProvider.php">
Expand Down Expand Up @@ -2345,13 +2334,6 @@
<code><![CDATA[AlternativeHomeUserBackend]]></code>
</DeprecatedInterface>
</file>
<file src="apps/testing/lib/AppInfo/Application.php">
<DeprecatedMethod>
<code><![CDATA[getAppValue]]></code>
<code><![CDATA[getConfig]]></code>
<code><![CDATA[getUserManager]]></code>
</DeprecatedMethod>
</file>
<file src="apps/testing/lib/Controller/ConfigController.php">
<DeprecatedMethod>
<code><![CDATA[deleteAppValue]]></code>
Expand Down Expand Up @@ -3951,12 +3933,6 @@
<code><![CDATA[array{X-Request-Id: string, Cache-Control: string, Content-Security-Policy: string, Feature-Policy: string, X-Robots-Tag: string, Last-Modified?: string, ETag?: string, ...H}]]></code>
</MoreSpecificReturnType>
</file>
<file src="ocs-provider/index.php">
<DeprecatedMethod>
<code><![CDATA[getAppManager]]></code>
<code><![CDATA[getRequest]]></code>
</DeprecatedMethod>
</file>
<file src="public.php">
<DeprecatedMethod>
<code><![CDATA[getAppValue]]></code>
Expand Down
12 changes: 7 additions & 5 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

use OC\Profiler\BuiltInProfiler;
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
use OC\Share20\GroupDeletedListener;
use OC\Share20\Hooks;
use OC\Share20\UserDeletedListener;
Expand All @@ -22,6 +23,7 @@
use OCP\IInitialStateService;
use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Security\Bruteforce\IThrottler;
Expand Down Expand Up @@ -298,7 +300,7 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void {
Util::addScript('core', 'update');

$initialState = Server::get(IInitialStateService::class);
$serverVersion = \OCP\Server::get(\OCP\ServerVersion::class);
$serverVersion = Server::get(\OCP\ServerVersion::class);
if ($disableWebUpdater || ($tooBig && !$ignoreTooBigWarning)) {
// send http status 503
http_response_code(503);
Expand Down Expand Up @@ -621,7 +623,7 @@ private static function addSecurityHeaders(): void {
* @see \OCP\AppFramework\Http\Response::getHeaders
*/
$policy = 'default-src \'self\'; '
. 'script-src \'self\' \'nonce-' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '\'; '
. 'script-src \'self\' \'nonce-' . Server::get(ContentSecurityPolicyNonceManager::class)->getNonce() . '\'; '
. 'style-src \'self\' \'unsafe-inline\'; '
. 'frame-src *; '
. 'img-src * data: blob:; '
Expand Down Expand Up @@ -727,7 +729,7 @@ public static function init(): void {
$config = Server::get(IConfig::class);
if (!defined('PHPUNIT_RUN')) {
$errorHandler = new OC\Log\ErrorHandler(
\OCP\Server::get(\Psr\Log\LoggerInterface::class),
Server::get(\Psr\Log\LoggerInterface::class),
);
$exceptionHandler = [$errorHandler, 'onException'];
if ($config->getSystemValueBool('debug', false)) {
Expand Down Expand Up @@ -812,7 +814,7 @@ public static function init(): void {

// User and Groups
if (!$systemConfig->getValue('installed', false)) {
self::$server->getSession()->set('user_id', '');
Server::get(ISession::class)->set('user_id', '');
}

$eventLogger->start('setup_backends', 'Setup group and user backends');
Expand Down Expand Up @@ -1076,7 +1078,7 @@ public static function handleRequest(): void {

// Check if Nextcloud is installed or in maintenance (update) mode
if (!$systemConfig->getValue('installed', false)) {
\OC::$server->getSession()->clear();
Server::get(ISession::class)->clear();
$controller = Server::get(\OC\Core\Controller\SetupController::class);
$controller->run($_POST);
exit();
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function __construct(array $parameters) {
}
if ($this->secure === true) {
// inject mock for testing
$this->certManager = \OC::$server->getCertificateManager();
$this->certManager = Server::get(ICertificateManager::class);
}
$this->root = rawurldecode($parameters['root'] ?? '/');
$this->root = '/' . ltrim($this->root, '/');
Expand Down
Loading
Loading