mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
refactor: Apply rector changes
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
ee43b68606
commit
663018455e
58 changed files with 322 additions and 197 deletions
|
|
@ -89,7 +89,7 @@ $server->httpRequest->setUrl(Server::get(IRequest::class)->getRequestUri());
|
|||
/** @var string $baseuri defined in remote.php */
|
||||
$server->setBaseUri($baseuri);
|
||||
// Add plugins
|
||||
$server->addPlugin(new MaintenancePlugin(Server::get(IConfig::class), \OCP\Server::get(IL10nFactory::class)->get('dav')));
|
||||
$server->addPlugin(new MaintenancePlugin(Server::get(IConfig::class), Server::get(IL10nFactory::class)->get('dav')));
|
||||
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
|
||||
$server->addPlugin(new Plugin());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace OCA\DAV\CalDAV\Federation;
|
|||
|
||||
use OCA\DAV\DAV\RemoteUserPrincipalBackend;
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
use OCP\Constants;
|
||||
use OCP\DB\Types;
|
||||
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
|
||||
|
||||
|
|
@ -94,7 +95,7 @@ class FederatedCalendarEntity extends Entity {
|
|||
'{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $this->getSyncTokenForSabre(),
|
||||
'{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => $this->getSupportedCalendarComponentSet(),
|
||||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->getSharedByPrincipal(),
|
||||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => ($this->getPermissions() & \OCP\Constants::PERMISSION_UPDATE) === 0 ? 1 : 0,
|
||||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => ($this->getPermissions() & Constants::PERMISSION_UPDATE) === 0 ? 1 : 0,
|
||||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}permissions' => $this->getPermissions(),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ class Directory extends Node implements
|
|||
}
|
||||
|
||||
if ($info->getMimeType() === FileInfo::MIMETYPE_FOLDER) {
|
||||
$node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager);
|
||||
$node = new Directory($this->fileView, $info, $this->tree, $this->shareManager);
|
||||
} else {
|
||||
// In case reading a directory was allowed but it turns out the node was a not a directory, reject it now.
|
||||
if (!$this->info->isReadable()) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use OCP\Config\IUserConfig;
|
|||
use OCP\IAppConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IL10N;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Security\ISecureRandom;
|
||||
|
|
@ -163,7 +164,7 @@ class IMipServiceTest extends TestCase {
|
|||
|
||||
public function testIsSystemUserWhenUserExists(): void {
|
||||
$email = 'user@example.com';
|
||||
$user = $this->createMock(\OCP\IUser::class);
|
||||
$user = $this->createMock(IUser::class);
|
||||
|
||||
$this->userManager->expects(self::once())
|
||||
->method('getByEmail')
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use OCP\AppFramework\Bootstrap\IBootContext;
|
|||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||
use OCP\Federation\ICloudFederationProviderManager;
|
||||
use OCP\Server;
|
||||
|
||||
class Application extends App implements IBootstrap {
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ class Application extends App implements IBootstrap {
|
|||
$manager->addCloudFederationProvider($type,
|
||||
'Federated Files Sharing',
|
||||
function (): CloudFederationProviderFiles {
|
||||
return \OCP\Server::get(CloudFederationProviderFiles::class);
|
||||
return Server::get(CloudFederationProviderFiles::class);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use OCP\GlobalScale\IConfig;
|
|||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Settings\IDelegatedSettings;
|
||||
use OCP\Util;
|
||||
|
||||
class Admin implements IDelegatedSettings {
|
||||
/**
|
||||
|
|
@ -44,8 +45,8 @@ class Admin implements IDelegatedSettings {
|
|||
$this->initialState->provideInitialState('lookupServerUploadEnabled', $this->fedShareProvider->isLookupServerUploadEnabled());
|
||||
$this->initialState->provideInitialState('federatedTrustedShareAutoAccept', $this->fedShareProvider->isFederatedTrustedShareAutoAccept());
|
||||
|
||||
\OCP\Util::addStyle(Application::APP_ID, 'settings-admin');
|
||||
\OCP\Util::addScript(Application::APP_ID, 'settings-admin');
|
||||
Util::addStyle(Application::APP_ID, 'settings-admin');
|
||||
Util::addScript(Application::APP_ID, 'settings-admin');
|
||||
return new TemplateResponse(Application::APP_ID, 'settings-admin', renderAs: '');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use OCP\Defaults;
|
|||
use OCP\IURLGenerator;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Settings\ISettings;
|
||||
use OCP\Util;
|
||||
|
||||
class Personal implements ISettings {
|
||||
public function __construct(
|
||||
|
|
@ -42,8 +43,8 @@ class Personal implements ISettings {
|
|||
$this->initialState->provideInitialState('cloudId', $cloudID);
|
||||
$this->initialState->provideInitialState('docUrlFederated', $this->urlGenerator->linkToDocs('user-sharing-federated'));
|
||||
|
||||
\OCP\Util::addStyle(Application::APP_ID, 'settings-personal');
|
||||
\OCP\Util::addScript(Application::APP_ID, 'settings-personal');
|
||||
Util::addStyle(Application::APP_ID, 'settings-personal');
|
||||
Util::addScript(Application::APP_ID, 'settings-personal');
|
||||
return new TemplateResponse(Application::APP_ID, 'settings-personal', renderAs: TemplateResponse::RENDER_AS_BLANK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class ScanAppDataTest extends TestCase {
|
|||
$this->scanner->method('getScanner')->willReturn($this->internalScanner);
|
||||
|
||||
$this->scanner->method('initTools')
|
||||
->willReturnCallback(function () {});
|
||||
->willReturnCallback(function (): void {});
|
||||
try {
|
||||
$this->rootFolder->get($this->rootFolder->getAppDataDirectoryName() . '/preview')->delete();
|
||||
} catch (NotFoundException) {
|
||||
|
|
@ -103,7 +103,7 @@ class ScanAppDataTest extends TestCase {
|
|||
}
|
||||
|
||||
$this->input->method('getArgument')->with('folder')->willReturn('');
|
||||
$this->internalScanner->method('scan')->willReturnCallback(function () {
|
||||
$this->internalScanner->method('scan')->willReturnCallback(function (): void {
|
||||
$this->internalScanner->emit('\OC\Files\Utils\Scanner', 'scanFile', ['path42']);
|
||||
$this->internalScanner->emit('\OC\Files\Utils\Scanner', 'scanFolder', ['path42']);
|
||||
$this->internalScanner->emit('\OC\Files\Utils\Scanner', 'scanFolder', ['path42']);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class AdminTest extends TestCase {
|
|||
$this->initialState
|
||||
->expects($this->atLeastOnce())
|
||||
->method('provideInitialState')
|
||||
->willReturnCallback(function () use (&$initialState) {
|
||||
->willReturnCallback(function () use (&$initialState): void {
|
||||
$args = func_get_args();
|
||||
$initialState[$args[0]] = $args[1];
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCA\Files_Sharing\Controller;
|
||||
|
||||
use OCA\Deck\Sharing\ShareAPIHelper;
|
||||
use OCA\Files_Sharing\ResponseDefinitions;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Http;
|
||||
|
|
@ -204,12 +205,12 @@ class DeletedShareAPIController extends OCSController {
|
|||
* @psalm-suppress UndefinedClass
|
||||
* @throws ContainerExceptionInterface
|
||||
*/
|
||||
private function getDeckShareHelper(): \OCA\Deck\Sharing\ShareAPIHelper {
|
||||
private function getDeckShareHelper(): ShareAPIHelper {
|
||||
if (!$this->appManager->isEnabledForUser('deck')) {
|
||||
throw new QueryException();
|
||||
}
|
||||
|
||||
/** @psalm-suppress UndefinedClass */
|
||||
return Server::get(\OCA\Deck\Sharing\ShareAPIHelper::class);
|
||||
return Server::get(ShareAPIHelper::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class ShareTargetValidatorTest extends TestCase {
|
|||
$share = $this->shareManager->getShareById($share->getFullId());
|
||||
$this->assertSame('/foo/bar' . $this->folder, $share->getTarget());
|
||||
|
||||
$this->eventDispatcher->addListener(VerifyMountPointEvent::class, function (VerifyMountPointEvent $event) {
|
||||
$this->eventDispatcher->addListener(VerifyMountPointEvent::class, function (VerifyMountPointEvent $event): void {
|
||||
$event->setCreateParent(true);
|
||||
});
|
||||
$this->targetValidator->verifyMountPoint($this->user2, $share, [], [$share]);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use OC\Files\Node\NonExistingFolder;
|
|||
use OC\Files\View;
|
||||
use OC\User\NoUserException;
|
||||
use OC_User;
|
||||
use OCA\FederatedFileSharing\FederatedShareProvider;
|
||||
use OCA\Files_Trashbin\Command\Expire;
|
||||
use OCA\Files_Trashbin\Events\BeforeNodeRestoredEvent;
|
||||
use OCA\Files_Trashbin\Events\NodeRestoredEvent;
|
||||
|
|
@ -1194,7 +1195,7 @@ class Trashbin implements IEventListener {
|
|||
return $user;
|
||||
}
|
||||
|
||||
$federatedShareProvider = Server::get(\OCA\FederatedFileSharing\FederatedShareProvider::class);
|
||||
$federatedShareProvider = Server::get(FederatedShareProvider::class);
|
||||
$share = $federatedShareProvider->getShareByToken($token);
|
||||
|
||||
return $share->getSharedWith();
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use OCP\AppFramework\Http\TemplateResponse;
|
|||
use OCP\AppFramework\Services\IInitialState;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Settings\ISettings;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Admin implements ISettings {
|
||||
|
|
@ -45,8 +46,8 @@ class Admin implements ISettings {
|
|||
$this->initialState->provideInitialState('clients', $result);
|
||||
$this->initialState->provideInitialState('oauth2-doc-link', $this->urlGenerator->linkToDocs('admin-oauth2'));
|
||||
|
||||
\OCP\Util::addStyle('oauth2', 'settings-admin');
|
||||
\OCP\Util::addScript('oauth2', 'settings-admin', 'core');
|
||||
Util::addStyle('oauth2', 'settings-admin');
|
||||
Util::addScript('oauth2', 'settings-admin', 'core');
|
||||
return new TemplateResponse(
|
||||
'oauth2',
|
||||
'admin',
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class AdminSettingsControllerTest extends TestCase {
|
|||
$initialState = [];
|
||||
$this->initialState->expects(self::atLeastOnce())
|
||||
->method('provideInitialState')
|
||||
->willReturnCallback(function () use (&$initialState) {
|
||||
->willReturnCallback(function () use (&$initialState): void {
|
||||
$initialState[] = func_get_args();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ use OC\Settings\AuthorizedGroup;
|
|||
use OC\Settings\AuthorizedGroupMapper;
|
||||
use OCA\Settings\Service\AuthorizedGroupService;
|
||||
use OCA\Settings\Service\ConflictException;
|
||||
use OCA\Settings\Service\NotFoundException;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
use OCP\Server;
|
||||
use Test\TestCase;
|
||||
|
||||
/**
|
||||
|
|
@ -27,7 +29,7 @@ class DuplicateAssignmentIntegrationTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
// Use real mapper for integration testing
|
||||
$this->mapper = \OCP\Server::get(AuthorizedGroupMapper::class);
|
||||
$this->mapper = Server::get(AuthorizedGroupMapper::class);
|
||||
$this->service = new AuthorizedGroupService($this->mapper);
|
||||
}
|
||||
|
||||
|
|
@ -109,10 +111,10 @@ class DuplicateAssignmentIntegrationTest extends TestCase {
|
|||
$this->service->delete($initialId);
|
||||
|
||||
// Verify it's deleted by trying to find it
|
||||
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
|
||||
$this->expectException(DoesNotExistException::class);
|
||||
try {
|
||||
$this->service->find($initialId);
|
||||
} catch (\OCA\Settings\Service\NotFoundException $e) {
|
||||
} catch (NotFoundException $e) {
|
||||
// Expected - now create the same assignment again, which should succeed
|
||||
$result2 = $this->service->create($groupId, $class);
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class AuthorizedGroupServiceTest extends TestCase {
|
|||
// Mock that no duplicate exists for group1
|
||||
$this->mapper->expects($this->exactly(2))
|
||||
->method('findByGroupIdAndClass')
|
||||
->willReturnCallback(function ($groupId, $classArg) use ($groupId1, $groupId2, $class) {
|
||||
->willReturnCallback(function ($groupId, $classArg) use ($groupId1, $groupId2, $class): void {
|
||||
$this->assertContains($groupId, [$groupId1, $groupId2]);
|
||||
$this->assertEquals($class, $classArg);
|
||||
throw new DoesNotExistException('Not found');
|
||||
|
|
@ -126,7 +126,7 @@ class AuthorizedGroupServiceTest extends TestCase {
|
|||
// Mock that no duplicate exists for either class
|
||||
$this->mapper->expects($this->exactly(2))
|
||||
->method('findByGroupIdAndClass')
|
||||
->willReturnCallback(function ($groupIdArg, $class) use ($groupId, $class1, $class2) {
|
||||
->willReturnCallback(function ($groupIdArg, $class) use ($groupId, $class1, $class2): void {
|
||||
$this->assertEquals($groupId, $groupIdArg);
|
||||
$this->assertContains($class, [$class1, $class2]);
|
||||
throw new DoesNotExistException('Not found');
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use OCP\IL10N;
|
|||
use OCP\Server;
|
||||
use OCP\Settings\IDelegatedSettings;
|
||||
use OCP\Template\ITemplateManager;
|
||||
use OCP\Util;
|
||||
|
||||
class Admin implements IDelegatedSettings {
|
||||
public function __construct(
|
||||
|
|
@ -60,8 +61,8 @@ class Admin implements IDelegatedSettings {
|
|||
$this->initialState->provideInitialState('ldapConfigs', $ldapConfigs);
|
||||
$this->initialState->provideInitialState('ldapModuleInstalled', function_exists('ldap_connect'));
|
||||
|
||||
\OCP\Util::addStyle(Application::APP_ID, 'settings-admin');
|
||||
\OCP\Util::addScript(Application::APP_ID, 'settings-admin');
|
||||
Util::addStyle(Application::APP_ID, 'settings-admin');
|
||||
Util::addScript(Application::APP_ID, 'settings-admin');
|
||||
return new TemplateResponse(Application::APP_ID, 'settings', $parameters);
|
||||
}
|
||||
|
||||
|
|
|
|||
2
composer.lock
generated
2
composer.lock
generated
|
|
@ -96,5 +96,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "8.2"
|
||||
},
|
||||
"plugin-api-version": "2.6.0"
|
||||
"plugin-api-version": "2.9.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ namespace OC\Core\Controller;
|
|||
|
||||
use Exception;
|
||||
use OC\Contacts\ContactsMenu\Manager;
|
||||
use OC\Teams\TeamManager;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||
|
|
@ -37,7 +38,7 @@ class ContactsMenuController extends Controller {
|
|||
public function index(?string $filter = null, ?string $teamId = null): array {
|
||||
$entries = $this->manager->getEntries($this->userSession->getUser(), $filter);
|
||||
if ($teamId !== null) {
|
||||
/** @var \OC\Teams\TeamManager */
|
||||
/** @var TeamManager */
|
||||
$teamManager = $this->teamManager;
|
||||
$memberIds = $teamManager->getMembersOfTeam($teamId, $this->userSession->getUser()->getUID());
|
||||
$entries['contacts'] = array_filter(
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ use OCP\AppFramework\Http;
|
|||
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||
use OCP\AppFramework\Http\Attribute\PublicPage;
|
||||
use OCP\AppFramework\Http\Response;
|
||||
use OCP\AppFramework\Http\StreamTraversableResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
use OCP\OpenMetrics\IMetricFamily;
|
||||
|
|
@ -44,12 +46,12 @@ class OpenMetricsController extends Controller {
|
|||
#[NoCSRFRequired]
|
||||
#[PublicPage]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/metrics')]
|
||||
public function export(): Http\Response {
|
||||
public function export(): Response {
|
||||
if (!$this->isRemoteAddressAllowed()) {
|
||||
return new Http\Response(Http::STATUS_FORBIDDEN);
|
||||
return new Response(Http::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
return new Http\StreamTraversableResponse(
|
||||
return new StreamTraversableResponse(
|
||||
$this->generate(),
|
||||
Http::STATUS_OK,
|
||||
[
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ class InstalledVersions
|
|||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) {
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = include __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
|
|
@ -378,7 +378,7 @@ class InstalledVersions
|
|||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) {
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require __DIR__ . '/installed.php';
|
||||
self::$installed = $required;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,68 @@
|
|||
{
|
||||
"packages": [],
|
||||
"dev": false,
|
||||
"dev-package-names": []
|
||||
"packages": [
|
||||
{
|
||||
"name": "bamarni/composer-bin-plugin",
|
||||
"version": "1.9.1",
|
||||
"version_normalized": "1.9.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bamarni/composer-bin-plugin.git",
|
||||
"reference": "641d0663f5ac270b1aeec4337b7856f76204df47"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/641d0663f5ac270b1aeec4337b7856f76204df47",
|
||||
"reference": "641d0663f5ac270b1aeec4337b7856f76204df47",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^2.0",
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^2.2.26",
|
||||
"ext-json": "*",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.8 || ^2.0",
|
||||
"phpstan/phpstan-phpunit": "^1.1 || ^2.0",
|
||||
"phpunit/phpunit": "^8.5 || ^9.6 || ^10.0",
|
||||
"symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
|
||||
"symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
|
||||
"symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0"
|
||||
},
|
||||
"time": "2026-02-04T10:18:12+00:00",
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "Bamarni\\Composer\\Bin\\BamarniBinPlugin"
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Bamarni\\Composer\\Bin\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "No conflicts for your bin dependencies",
|
||||
"keywords": [
|
||||
"composer",
|
||||
"conflict",
|
||||
"dependency",
|
||||
"executable",
|
||||
"isolation",
|
||||
"tool"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
|
||||
"source": "https://github.com/bamarni/composer-bin-plugin/tree/1.9.1"
|
||||
},
|
||||
"install-path": "../bamarni/composer-bin-plugin"
|
||||
}
|
||||
],
|
||||
"dev": true,
|
||||
"dev-package-names": [
|
||||
"bamarni/composer-bin-plugin"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,21 +3,30 @@
|
|||
'name' => '__root__',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => '8c12590cf6f93ce7aa41f17817b3791e524da39e',
|
||||
'reference' => 'ee43b68606d008d69e41e1b9fe74b30aa9933959',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../../',
|
||||
'aliases' => array(),
|
||||
'dev' => false,
|
||||
'dev' => true,
|
||||
),
|
||||
'versions' => array(
|
||||
'__root__' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => '8c12590cf6f93ce7aa41f17817b3791e524da39e',
|
||||
'reference' => 'ee43b68606d008d69e41e1b9fe74b30aa9933959',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'bamarni/composer-bin-plugin' => array(
|
||||
'pretty_version' => '1.9.1',
|
||||
'version' => '1.9.1.0',
|
||||
'reference' => '641d0663f5ac270b1aeec4337b7856f76204df47',
|
||||
'type' => 'composer-plugin',
|
||||
'install_path' => __DIR__ . '/../bamarni/composer-bin-plugin',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ use OC\AppFramework\Services\AppConfig;
|
|||
use OC\AppFramework\Services\InitialState;
|
||||
use OC\AppFramework\Utility\ControllerMethodReflector;
|
||||
use OC\AppFramework\Utility\SimpleContainer;
|
||||
use OC\CapabilitiesManager;
|
||||
use OC\Core\Middleware\TwoFactorMiddleware;
|
||||
use OC\Diagnostics\EventLogger;
|
||||
use OC\Log\PsrLoggerAdapter;
|
||||
|
|
@ -305,7 +306,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @param string $serviceName e.g. 'OCA\Files\Capabilities'
|
||||
*/
|
||||
public function registerCapability($serviceName) {
|
||||
$this->query(\OC\CapabilitiesManager::class)->registerCapability(function () use ($serviceName) {
|
||||
$this->query(CapabilitiesManager::class)->registerCapability(function () use ($serviceName) {
|
||||
return $this->query($serviceName);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use OC\ForbiddenException;
|
|||
use OC\User\NoUserException;
|
||||
use OCP\Files\LockNotAcquiredException;
|
||||
use OCP\ICache;
|
||||
use OCP\IConfig;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Lock\LockedException;
|
||||
use OCP\Security\ISecureRandom;
|
||||
|
|
@ -161,7 +162,7 @@ class File implements ICache {
|
|||
public function gc() {
|
||||
$storage = $this->getStorage();
|
||||
if ($storage) {
|
||||
$ttl = \OC::$server->getConfig()->getSystemValueInt('cache_chunk_gc_ttl', 60 * 60 * 24);
|
||||
$ttl = Server::get(IConfig::class)->getSystemValueInt('cache_chunk_gc_ttl', 60 * 60 * 24);
|
||||
$now = time() - $ttl;
|
||||
|
||||
$dh = $storage->opendir('/');
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use OCP\Files\Cache\CacheInsertEvent;
|
|||
use OCP\Files\Cache\CacheUpdateEvent;
|
||||
use OCP\Files\Cache\ICache;
|
||||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\Config\IUserMountCache;
|
||||
use OCP\Files\FileInfo;
|
||||
use OCP\Files\IMimeTypeLoader;
|
||||
use OCP\Files\Search\ISearchComparison;
|
||||
|
|
@ -825,7 +826,7 @@ class Cache implements ICache {
|
|||
$this->connection->commit();
|
||||
|
||||
if ($sourceCache->getNumericStorageId() !== $this->getNumericStorageId()) {
|
||||
\OCP\Server::get(\OCP\Files\Config\IUserMountCache::class)->clear();
|
||||
Server::get(IUserMountCache::class)->clear();
|
||||
|
||||
$event = new CacheEntryRemovedEvent($this->storage, $sourcePath, $sourceId, $sourceCache->getNumericStorageId());
|
||||
$this->eventDispatcher->dispatchTyped($event);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace OC\Files;
|
|||
use OC\Files\Mount\HomeMountPoint;
|
||||
use OCA\Files_Sharing\External\Mount;
|
||||
use OCA\Files_Sharing\ISharedMountPoint;
|
||||
use OCP\Constants;
|
||||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\IUser;
|
||||
|
|
@ -18,29 +19,11 @@ use OCP\IUser;
|
|||
* @template-implements \ArrayAccess<string,mixed>
|
||||
*/
|
||||
class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
||||
private array|ICacheEntry $data;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* @var \OC\Files\Storage\Storage $storage
|
||||
*/
|
||||
private $storage;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $internalPath;
|
||||
|
||||
/**
|
||||
* @var \OCP\Files\Mount\IMountPoint
|
||||
*/
|
||||
private $mount;
|
||||
|
||||
private ?IUser $owner;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
|
|
@ -66,13 +49,15 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
|||
* @param IMountPoint $mount
|
||||
* @param ?IUser $owner
|
||||
*/
|
||||
public function __construct($path, $storage, $internalPath, $data, $mount, $owner = null) {
|
||||
$this->path = $path;
|
||||
$this->storage = $storage;
|
||||
$this->internalPath = $internalPath;
|
||||
$this->data = $data;
|
||||
public function __construct(
|
||||
private $path,
|
||||
private $storage,
|
||||
private $internalPath,
|
||||
private array|ICacheEntry $data,
|
||||
$mount,
|
||||
private ?IUser $owner = null
|
||||
) {
|
||||
$this->mount = $mount;
|
||||
$this->owner = $owner;
|
||||
if (isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] !== 0) {
|
||||
$this->rawSize = $this->data['unencrypted_size'];
|
||||
} else {
|
||||
|
|
@ -239,14 +224,14 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
|||
* @return bool
|
||||
*/
|
||||
public function isReadable() {
|
||||
return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
|
||||
return $this->checkPermissions(Constants::PERMISSION_READ);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isUpdateable() {
|
||||
return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
|
||||
return $this->checkPermissions(Constants::PERMISSION_UPDATE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -255,21 +240,21 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
|||
* @return bool
|
||||
*/
|
||||
public function isCreatable() {
|
||||
return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
|
||||
return $this->checkPermissions(Constants::PERMISSION_CREATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDeletable() {
|
||||
return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
|
||||
return $this->checkPermissions(Constants::PERMISSION_DELETE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isShareable() {
|
||||
return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
|
||||
return $this->checkPermissions(Constants::PERMISSION_SHARE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace OC\Files\Node;
|
||||
|
||||
use OCP\Constants;
|
||||
use OCP\Files\GenericFileException;
|
||||
use OCP\Files\NotPermittedException;
|
||||
use OCP\Lock\LockedException;
|
||||
|
|
@ -29,7 +30,7 @@ class File extends Node implements \OCP\Files\File {
|
|||
* @throws LockedException
|
||||
*/
|
||||
public function getContent() {
|
||||
if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) {
|
||||
if ($this->checkPermissions(Constants::PERMISSION_READ)) {
|
||||
$content = $this->view->file_get_contents($this->path);
|
||||
if ($content === false) {
|
||||
throw new GenericFileException();
|
||||
|
|
@ -47,7 +48,7 @@ class File extends Node implements \OCP\Files\File {
|
|||
* @throws LockedException
|
||||
*/
|
||||
public function putContent($data) {
|
||||
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
|
||||
if ($this->checkPermissions(Constants::PERMISSION_UPDATE)) {
|
||||
$this->sendHooks(['preWrite']);
|
||||
if ($this->view->file_put_contents($this->path, $data) === false) {
|
||||
throw new GenericFileException('file_put_contents failed');
|
||||
|
|
@ -68,7 +69,7 @@ class File extends Node implements \OCP\Files\File {
|
|||
public function fopen($mode) {
|
||||
$preHooks = [];
|
||||
$postHooks = [];
|
||||
$requiredPermissions = \OCP\Constants::PERMISSION_READ;
|
||||
$requiredPermissions = Constants::PERMISSION_READ;
|
||||
switch ($mode) {
|
||||
case 'r+':
|
||||
case 'rb+':
|
||||
|
|
@ -86,7 +87,7 @@ class File extends Node implements \OCP\Files\File {
|
|||
case 'ab':
|
||||
$preHooks[] = 'preWrite';
|
||||
$postHooks[] = 'postWrite';
|
||||
$requiredPermissions |= \OCP\Constants::PERMISSION_UPDATE;
|
||||
$requiredPermissions |= Constants::PERMISSION_UPDATE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +107,7 @@ class File extends Node implements \OCP\Files\File {
|
|||
* @throws \OCP\Files\NotFoundException
|
||||
*/
|
||||
public function delete() {
|
||||
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
|
||||
if ($this->checkPermissions(Constants::PERMISSION_DELETE)) {
|
||||
$this->sendHooks(['preDelete']);
|
||||
$fileInfo = $this->getFileInfo();
|
||||
$this->view->unlink($this->path);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use OC\Files\Search\SearchOrder;
|
|||
use OC\Files\Search\SearchQuery;
|
||||
use OC\Files\Utils\PathHelper;
|
||||
use OC\User\LazyUser;
|
||||
use OCP\Constants;
|
||||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\FileInfo;
|
||||
use OCP\Files\Folder as IFolder;
|
||||
|
|
@ -26,7 +27,9 @@ use OCP\Files\Search\ISearchComparison;
|
|||
use OCP\Files\Search\ISearchOperator;
|
||||
use OCP\Files\Search\ISearchOrder;
|
||||
use OCP\Files\Search\ISearchQuery;
|
||||
use OCP\IConfig;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Server;
|
||||
use Override;
|
||||
|
||||
class Folder extends Node implements IFolder {
|
||||
|
|
@ -122,7 +125,7 @@ class Folder extends Node implements IFolder {
|
|||
* @throws \OCP\Files\NotPermittedException
|
||||
*/
|
||||
public function newFolder($path) {
|
||||
if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
|
||||
if ($this->checkPermissions(Constants::PERMISSION_CREATE)) {
|
||||
$fullPath = $this->getFullPath($path);
|
||||
$nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
|
||||
$this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
|
||||
|
|
@ -154,7 +157,7 @@ class Folder extends Node implements IFolder {
|
|||
/**
|
||||
* @param string $path
|
||||
* @param string | resource | null $content
|
||||
* @return \OC\Files\Node\File
|
||||
* @return File
|
||||
* @throws \OCP\Files\NotPermittedException
|
||||
*/
|
||||
public function newFile($path, $content = null) {
|
||||
|
|
@ -162,7 +165,7 @@ class Folder extends Node implements IFolder {
|
|||
throw new NotPermittedException('Could not create as provided path is empty');
|
||||
}
|
||||
$this->recreateIfNeeded();
|
||||
if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
|
||||
if ($this->checkPermissions(Constants::PERMISSION_CREATE)) {
|
||||
$fullPath = $this->getFullPath($path);
|
||||
$nonExisting = new NonExistingFile($this->root, $this->view, $fullPath);
|
||||
$this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
|
||||
|
|
@ -186,7 +189,7 @@ class Folder extends Node implements IFolder {
|
|||
$user = null;
|
||||
} else {
|
||||
/** @var IUserManager $userManager */
|
||||
$userManager = \OCP\Server::get(IUserManager::class);
|
||||
$userManager = Server::get(IUserManager::class);
|
||||
$user = $userManager->get($uid);
|
||||
}
|
||||
return new SearchQuery($operator, $limit, $offset, [], $user);
|
||||
|
|
@ -212,7 +215,7 @@ class Folder extends Node implements IFolder {
|
|||
}
|
||||
|
||||
/** @var QuerySearchHelper $searchHelper */
|
||||
$searchHelper = \OC::$server->get(QuerySearchHelper::class);
|
||||
$searchHelper = Server::get(QuerySearchHelper::class);
|
||||
[$caches, $mountByMountPoint] = $searchHelper->getCachesAndMountPointsForSearch($this->root, $this->path, $limitToHome);
|
||||
$resultsPerCache = $searchHelper->searchInCaches($query, $caches);
|
||||
|
||||
|
|
@ -259,7 +262,7 @@ class Folder extends Node implements IFolder {
|
|||
if ($ownerId !== false) {
|
||||
// Cache the user manager (for performance)
|
||||
if ($this->userManager === null) {
|
||||
$this->userManager = \OCP\Server::get(IUserManager::class);
|
||||
$this->userManager = Server::get(IUserManager::class);
|
||||
}
|
||||
$owner = new LazyUser($ownerId, $this->userManager);
|
||||
}
|
||||
|
|
@ -314,12 +317,12 @@ class Folder extends Node implements IFolder {
|
|||
return $this->root->getByIdInPath((int)$id, $this->getPath());
|
||||
}
|
||||
|
||||
public function getFirstNodeById(int $id): ?\OCP\Files\Node {
|
||||
public function getFirstNodeById(int $id): ?INode {
|
||||
return $this->root->getFirstNodeByIdInPath($id, $this->getPath());
|
||||
}
|
||||
|
||||
public function getAppDataDirectoryName(): string {
|
||||
$instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid');
|
||||
$instanceId = Server::get(IConfig::class)->getSystemValueString('instanceid');
|
||||
return 'appdata_' . $instanceId;
|
||||
}
|
||||
|
||||
|
|
@ -371,7 +374,7 @@ class Folder extends Node implements IFolder {
|
|||
}
|
||||
|
||||
public function delete() {
|
||||
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
|
||||
if ($this->checkPermissions(Constants::PERMISSION_DELETE)) {
|
||||
$this->sendHooks(['preDelete']);
|
||||
$fileInfo = $this->getFileInfo();
|
||||
$this->view->rmdir($this->path);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use OCP\Constants;
|
|||
use OCP\Files\Folder;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\Node;
|
||||
use OCP\Files\NotPermittedException;
|
||||
use Override;
|
||||
|
||||
|
|
@ -25,21 +26,20 @@ use Override;
|
|||
* @package OC\Files\Node
|
||||
*/
|
||||
class LazyFolder implements Folder {
|
||||
/** @var \Closure(): Folder */
|
||||
private \Closure $folderClosure;
|
||||
protected ?Folder $folder = null;
|
||||
protected IRootFolder $rootFolder;
|
||||
protected array $data;
|
||||
|
||||
/**
|
||||
* @param IRootFolder $rootFolder
|
||||
* @param \Closure(): Folder $folderClosure
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(IRootFolder $rootFolder, \Closure $folderClosure, array $data = []) {
|
||||
public function __construct(
|
||||
IRootFolder $rootFolder,
|
||||
private \Closure $folderClosure,
|
||||
protected array $data = []
|
||||
) {
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->folderClosure = $folderClosure;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
protected function getRootFolder(): IRootFolder {
|
||||
|
|
@ -470,7 +470,7 @@ class LazyFolder implements Folder {
|
|||
return $this->getRootFolder()->getByIdInPath((int)$id, $this->getPath());
|
||||
}
|
||||
|
||||
public function getFirstNodeById(int $id): ?\OCP\Files\Node {
|
||||
public function getFirstNodeById(int $id): ?Node {
|
||||
return $this->getRootFolder()->getFirstNodeByIdInPath($id, $this->getPath());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ namespace OC\Files\Node;
|
|||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\Node;
|
||||
use OCP\Files\Node as INode;
|
||||
|
||||
/**
|
||||
|
|
@ -42,7 +41,7 @@ class LazyRoot extends LazyFolder implements IRootFolder {
|
|||
return $this->__call(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
public function getFirstNodeByIdInPath(int $id, string $path): ?Node {
|
||||
public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
|
||||
return $this->__call(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use OCP\Files\IRootFolder;
|
|||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IUser;
|
||||
use OCP\Server;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class LazyUserFolder extends LazyFolder {
|
||||
|
|
@ -48,7 +49,7 @@ class LazyUserFolder extends LazyFolder {
|
|||
$node = $this->getRootFolder()->get($this->path);
|
||||
if ($node instanceof File) {
|
||||
$e = new \RuntimeException();
|
||||
\OCP\Server::get(LoggerInterface::class)->error('User root storage is not a folder: ' . $this->path, [
|
||||
Server::get(LoggerInterface::class)->error('User root storage is not a folder: ' . $this->path, [
|
||||
'exception' => $e,
|
||||
]);
|
||||
throw $e;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ namespace OC\Files\Node;
|
|||
use OC\Files\Filesystem;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Utils\PathHelper;
|
||||
use OC\Files\View;
|
||||
use OCP\Constants;
|
||||
use OCP\EventDispatcher\GenericEvent;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\FileInfo;
|
||||
|
|
@ -20,43 +22,36 @@ use OCP\Files\NotFoundException;
|
|||
use OCP\Files\NotPermittedException;
|
||||
use OCP\Lock\LockedException;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OCP\Server;
|
||||
|
||||
// FIXME: this class really should be abstract (+1)
|
||||
class Node implements INode {
|
||||
/**
|
||||
* @var \OC\Files\View $view
|
||||
* @var View $view
|
||||
*/
|
||||
protected $view;
|
||||
|
||||
protected IRootFolder $root;
|
||||
|
||||
/**
|
||||
* @var string $path Absolute path to the node (e.g. /admin/files/folder/file)
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
protected ?FileInfo $fileInfo;
|
||||
|
||||
protected ?INode $parent;
|
||||
|
||||
private bool $infoHasSubMountsIncluded;
|
||||
|
||||
/**
|
||||
* @param \OC\Files\View $view
|
||||
* @param View $view
|
||||
* @param \OCP\Files\IRootFolder $root
|
||||
* @param string $path
|
||||
* @param FileInfo $fileInfo
|
||||
*/
|
||||
public function __construct(IRootFolder $root, $view, $path, $fileInfo = null, ?INode $parent = null, bool $infoHasSubMountsIncluded = true) {
|
||||
public function __construct(
|
||||
IRootFolder $root,
|
||||
$view,
|
||||
protected $path,
|
||||
protected ?FileInfo $fileInfo = null,
|
||||
protected ?INode $parent = null,
|
||||
private bool $infoHasSubMountsIncluded = true
|
||||
) {
|
||||
if (Filesystem::normalizePath($view->getRoot()) !== '/') {
|
||||
throw new PreConditionNotMetException('The view passed to the node should not have any fake root set');
|
||||
}
|
||||
$this->view = $view;
|
||||
$this->root = $root;
|
||||
$this->path = $path;
|
||||
$this->fileInfo = $fileInfo;
|
||||
$this->parent = $parent;
|
||||
$this->infoHasSubMountsIncluded = $infoHasSubMountsIncluded;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -104,7 +99,7 @@ class Node implements INode {
|
|||
protected function sendHooks($hooks, ?array $args = null) {
|
||||
$args = !empty($args) ? $args : [$this];
|
||||
/** @var IEventDispatcher $dispatcher */
|
||||
$dispatcher = \OC::$server->get(IEventDispatcher::class);
|
||||
$dispatcher = Server::get(IEventDispatcher::class);
|
||||
foreach ($hooks as $hook) {
|
||||
if (method_exists($this->root, 'emit')) {
|
||||
$this->root->emit('\OC\Files', $hook, $args);
|
||||
|
|
@ -140,7 +135,7 @@ class Node implements INode {
|
|||
* @throws NotPermittedException
|
||||
*/
|
||||
public function touch($mtime = null) {
|
||||
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
|
||||
if ($this->checkPermissions(Constants::PERMISSION_UPDATE)) {
|
||||
$this->sendHooks(['preTouch']);
|
||||
$this->view->touch($this->path, $mtime);
|
||||
$this->sendHooks(['postTouch']);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace OC\Files\Node;
|
||||
|
||||
use OCP\Files\Node;
|
||||
use OCP\Files\NotFoundException;
|
||||
use Override;
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ class NonExistingFolder extends Folder {
|
|||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
public function getFirstNodeById(int $id): ?\OCP\Files\Node {
|
||||
public function getFirstNodeById(int $id): ?Node {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace OC\Files\Node;
|
|||
use OC\Files\FileInfo;
|
||||
use OC\Files\Mount\Manager;
|
||||
use OC\Files\Mount\MountPoint;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OC\Files\Utils\PathHelper;
|
||||
use OC\Files\View;
|
||||
use OC\Hooks\PublicEmitter;
|
||||
|
|
@ -18,6 +19,7 @@ use OC\User\NoUserException;
|
|||
use OCA\Files\AppInfo\Application;
|
||||
use OCA\Files\ConfigLexicon;
|
||||
use OCP\Cache\CappedMemoryCache;
|
||||
use OCP\Constants;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\Config\ICachedMountFileInfo;
|
||||
|
|
@ -76,7 +78,7 @@ class Root extends Folder implements IRootFolder {
|
|||
parent::__construct($this, $view, '');
|
||||
$this->emitter = new PublicEmitter();
|
||||
$this->userFolderCache = new CappedMemoryCache();
|
||||
$eventDispatcher->addListener(FilesystemTornDownEvent::class, function () {
|
||||
$eventDispatcher->addListener(FilesystemTornDownEvent::class, function (): void {
|
||||
$this->userFolderCache = new CappedMemoryCache();
|
||||
});
|
||||
$this->pathByIdCache = $cacheFactory->createLocal('path-by-id');
|
||||
|
|
@ -118,7 +120,7 @@ class Root extends Folder implements IRootFolder {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \OC\Files\Storage\Storage $storage
|
||||
* @param Storage $storage
|
||||
* @param string $mountPoint
|
||||
* @param array $arguments
|
||||
*/
|
||||
|
|
@ -133,7 +135,7 @@ class Root extends Folder implements IRootFolder {
|
|||
|
||||
/**
|
||||
* @param string $mountPoint
|
||||
* @return \OC\Files\Mount\MountPoint[]
|
||||
* @return MountPoint[]
|
||||
*/
|
||||
public function getMountsIn(string $mountPoint): array {
|
||||
return $this->mountManager->findIn($mountPoint);
|
||||
|
|
@ -141,7 +143,7 @@ class Root extends Folder implements IRootFolder {
|
|||
|
||||
/**
|
||||
* @param string $storageId
|
||||
* @return \OC\Files\Mount\MountPoint[]
|
||||
* @return MountPoint[]
|
||||
*/
|
||||
public function getMountByStorageId($storageId) {
|
||||
return $this->mountManager->findByStorageId($storageId);
|
||||
|
|
@ -156,7 +158,7 @@ class Root extends Folder implements IRootFolder {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \OC\Files\Mount\MountPoint $mount
|
||||
* @param MountPoint $mount
|
||||
*/
|
||||
public function unMount($mount) {
|
||||
$this->mountManager->remove($mount);
|
||||
|
|
@ -210,7 +212,7 @@ class Root extends Folder implements IRootFolder {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \OC\Files\Storage\Storage
|
||||
* @return Storage
|
||||
* @throws \OCP\Files\NotFoundException
|
||||
*/
|
||||
public function getStorage() {
|
||||
|
|
@ -271,7 +273,7 @@ class Root extends Folder implements IRootFolder {
|
|||
* @return int
|
||||
*/
|
||||
public function getPermissions() {
|
||||
return \OCP\Constants::PERMISSION_CREATE;
|
||||
return Constants::PERMISSION_CREATE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ class SetupManager implements ISetupManager {
|
|||
$this->registerMounts($user, $fullProviderMounts, $currentProviders);
|
||||
}
|
||||
|
||||
$this->setupForUserWith($user, function () use ($fullProviderMounts, $authoritativeMounts) {
|
||||
$this->setupForUserWith($user, function () use ($fullProviderMounts, $authoritativeMounts): void {
|
||||
$allMounts = [...$fullProviderMounts, ...$authoritativeMounts];
|
||||
array_walk($allMounts, $this->mountManager->addMount(...));
|
||||
});
|
||||
|
|
@ -778,7 +778,7 @@ class SetupManager implements ISetupManager {
|
|||
$this->eventDispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event): void {
|
||||
$this->cache->remove($event->getShare()->getSharedWith());
|
||||
});
|
||||
$this->eventDispatcher->addListener(BeforeNodeRenamedEvent::class, function (BeforeNodeRenamedEvent $event) {
|
||||
$this->eventDispatcher->addListener(BeforeNodeRenamedEvent::class, function (BeforeNodeRenamedEvent $event): void {
|
||||
// update cache information that is cached by mount point
|
||||
$from = rtrim($event->getSource()->getPath(), '/') . '/';
|
||||
$to = rtrim($event->getTarget()->getPath(), '/') . '/';
|
||||
|
|
|
|||
|
|
@ -1526,8 +1526,8 @@ class View {
|
|||
$folderId = $data->getId();
|
||||
$contents = $cache->getFolderContentsById($folderId, $mimeTypeFilter);
|
||||
|
||||
$sharingDisabled = \OCP\Util::isSharingDisabledForUser();
|
||||
$permissionsMask = ~\OCP\Constants::PERMISSION_SHARE;
|
||||
$sharingDisabled = Util::isSharingDisabledForUser();
|
||||
$permissionsMask = ~Constants::PERMISSION_SHARE;
|
||||
|
||||
$files = [];
|
||||
foreach ($contents as $content) {
|
||||
|
|
|
|||
|
|
@ -203,13 +203,13 @@ class FilesMetadataManager implements IFilesMetadataManager {
|
|||
public function deleteMetadata(int $fileId): void {
|
||||
try {
|
||||
$this->metadataRequestService->dropMetadata($fileId);
|
||||
} catch (Exception $e) {
|
||||
} catch (DBException $e) {
|
||||
$this->logger->warning('issue while deleteMetadata', ['exception' => $e, 'fileId' => $fileId]);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->indexRequestService->dropIndex($fileId);
|
||||
} catch (Exception $e) {
|
||||
} catch (DBException $e) {
|
||||
$this->logger->warning('issue while deleteMetadata', ['exception' => $e, 'fileId' => $fileId]);
|
||||
}
|
||||
}
|
||||
|
|
@ -217,13 +217,13 @@ class FilesMetadataManager implements IFilesMetadataManager {
|
|||
public function deleteMetadataForFiles(int $storage, array $fileIds): void {
|
||||
try {
|
||||
$this->metadataRequestService->dropMetadataForFiles($storage, $fileIds);
|
||||
} catch (Exception $e) {
|
||||
} catch (DBException $e) {
|
||||
$this->logger->warning('issue while deleteMetadata', ['exception' => $e, 'fileIds' => $fileIds]);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->indexRequestService->dropIndexForFiles($fileIds);
|
||||
} catch (Exception $e) {
|
||||
} catch (DBException $e) {
|
||||
$this->logger->warning('issue while deleteMetadata', ['exception' => $e, 'fileIds' => $fileIds]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use OCP\FilesMetadata\IFilesMetadataManager;
|
|||
use OCP\FilesMetadata\IMetadataQuery;
|
||||
use OCP\FilesMetadata\Model\IFilesMetadata;
|
||||
use OCP\FilesMetadata\Model\IMetadataValueWrapper;
|
||||
use OCP\Server;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -42,7 +43,7 @@ class MetadataQuery implements IMetadataQuery {
|
|||
*
|
||||
* FIXME: remove support for IFilesMetadata
|
||||
*/
|
||||
$logger = \OCP\Server::get(LoggerInterface::class);
|
||||
$logger = Server::get(LoggerInterface::class);
|
||||
$logger->debug('It is deprecated to use IFilesMetadata as second parameter when calling MetadataQuery::__construct()');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ use OCP\FilesMetadata\Model\IMetadataValueWrapper;
|
|||
* @since 28.0.0
|
||||
*/
|
||||
class MetadataValueWrapper implements IMetadataValueWrapper {
|
||||
private string $type;
|
||||
/** @var string|int|float|bool|array|string[]|int[] */
|
||||
private mixed $value = null;
|
||||
private string $etag = '';
|
||||
|
|
@ -38,8 +37,9 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
|
|||
* @see self::TYPE_STRING
|
||||
* @since 28.0.0
|
||||
*/
|
||||
public function __construct(string $type = '') {
|
||||
$this->type = $type;
|
||||
public function __construct(
|
||||
private string $type = ''
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,6 +10,16 @@ declare(strict_types=1);
|
|||
namespace OC\OpenMetrics;
|
||||
|
||||
use Generator;
|
||||
use OC\OpenMetrics\Exporters\ActiveSessions;
|
||||
use OC\OpenMetrics\Exporters\ActiveUsers;
|
||||
use OC\OpenMetrics\Exporters\AppsCount;
|
||||
use OC\OpenMetrics\Exporters\AppsInfo;
|
||||
use OC\OpenMetrics\Exporters\FilesByType;
|
||||
use OC\OpenMetrics\Exporters\InstanceInfo;
|
||||
use OC\OpenMetrics\Exporters\LogLevel;
|
||||
use OC\OpenMetrics\Exporters\Maintenance;
|
||||
use OC\OpenMetrics\Exporters\RunningJobs;
|
||||
use OC\OpenMetrics\Exporters\UsersByBackend;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\IConfig;
|
||||
use OCP\OpenMetrics\IMetricFamily;
|
||||
|
|
@ -33,22 +43,22 @@ class ExporterManager {
|
|||
// Core exporters
|
||||
$exporters = [
|
||||
// Basic exporters
|
||||
Exporters\InstanceInfo::class,
|
||||
Exporters\AppsInfo::class,
|
||||
Exporters\AppsCount::class,
|
||||
Exporters\Maintenance::class,
|
||||
Exporters\LogLevel::class,
|
||||
InstanceInfo::class,
|
||||
AppsInfo::class,
|
||||
AppsCount::class,
|
||||
Maintenance::class,
|
||||
LogLevel::class,
|
||||
|
||||
// File exporters
|
||||
Exporters\FilesByType::class,
|
||||
FilesByType::class,
|
||||
|
||||
// Users exporters
|
||||
Exporters\ActiveUsers::class,
|
||||
Exporters\ActiveSessions::class,
|
||||
Exporters\UsersByBackend::class,
|
||||
ActiveUsers::class,
|
||||
ActiveSessions::class,
|
||||
UsersByBackend::class,
|
||||
|
||||
// Jobs
|
||||
Exporters\RunningJobs::class,
|
||||
RunningJobs::class,
|
||||
];
|
||||
$exporters = array_filter($exporters, fn ($classname) => !isset($this->skippedClasses[$classname]));
|
||||
foreach ($exporters as $classname) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,12 @@ declare(strict_types = 1);
|
|||
|
||||
namespace OC\Profiler;
|
||||
|
||||
use OC\DB\DbDataCollector;
|
||||
use OC\Memcache\ProfilerWrapperCache;
|
||||
use OCA\Profiler\DataCollector\EventLoggerDataProvider;
|
||||
use OCA\Profiler\DataCollector\HttpDataCollector;
|
||||
use OCA\Profiler\DataCollector\MemoryDataCollector;
|
||||
use OCA\User_LDAP\DataCollector\LdapDataCollector;
|
||||
use OCP\Profiler\IProfile;
|
||||
|
||||
/**
|
||||
|
|
@ -16,13 +22,13 @@ use OCP\Profiler\IProfile;
|
|||
class FileProfilerStorage {
|
||||
/** @psalm-suppress UndefinedClass */
|
||||
public const allowedClasses = [
|
||||
\OCA\Profiler\DataCollector\EventLoggerDataProvider::class,
|
||||
\OCA\Profiler\DataCollector\HttpDataCollector::class,
|
||||
\OCA\Profiler\DataCollector\MemoryDataCollector::class,
|
||||
\OCA\User_LDAP\DataCollector\LdapDataCollector::class,
|
||||
\OC\Memcache\ProfilerWrapperCache::class,
|
||||
\OC\Profiler\RoutingDataCollector::class,
|
||||
\OC\DB\DbDataCollector::class,
|
||||
EventLoggerDataProvider::class,
|
||||
HttpDataCollector::class,
|
||||
MemoryDataCollector::class,
|
||||
LdapDataCollector::class,
|
||||
ProfilerWrapperCache::class,
|
||||
RoutingDataCollector::class,
|
||||
DbDataCollector::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace OC;
|
|||
|
||||
use bantu\IniGetWrapper\IniGetWrapper;
|
||||
use OC\Accounts\AccountManager;
|
||||
use OC\Activity\EventMerger;
|
||||
use OC\App\AppManager;
|
||||
use OC\App\AppStore\Bundles\BundleFetcher;
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
|
|
@ -30,6 +31,8 @@ use OC\Collaboration\Collaborators\GroupPlugin;
|
|||
use OC\Collaboration\Collaborators\MailByMailPlugin;
|
||||
use OC\Collaboration\Collaborators\RemoteGroupPlugin;
|
||||
use OC\Collaboration\Collaborators\RemotePlugin;
|
||||
use OC\Collaboration\Collaborators\Search;
|
||||
use OC\Collaboration\Collaborators\SearchResult;
|
||||
use OC\Collaboration\Collaborators\UserByMailPlugin;
|
||||
use OC\Collaboration\Collaborators\UserPlugin;
|
||||
use OC\Collaboration\Reference\ReferenceManager;
|
||||
|
|
@ -39,6 +42,7 @@ use OC\Comments\ManagerFactory as CommentsManagerFactory;
|
|||
use OC\Config\UserConfig;
|
||||
use OC\Contacts\ContactsMenu\ActionFactory;
|
||||
use OC\Contacts\ContactsMenu\ContactsStore;
|
||||
use OC\ContextChat\ContentManager;
|
||||
use OC\DB\Connection;
|
||||
use OC\DB\ConnectionAdapter;
|
||||
use OC\DB\ConnectionFactory;
|
||||
|
|
@ -123,6 +127,9 @@ use OC\Security\CSRF\CsrfTokenManager;
|
|||
use OC\Security\CSRF\TokenStorage\SessionStorage;
|
||||
use OC\Security\Hasher;
|
||||
use OC\Security\Ip\RemoteAddress;
|
||||
use OC\Security\RateLimiting\Backend\DatabaseBackend;
|
||||
use OC\Security\RateLimiting\Backend\IBackend;
|
||||
use OC\Security\RateLimiting\Backend\MemoryCacheBackend;
|
||||
use OC\Security\RateLimiting\Limiter;
|
||||
use OC\Security\RemoteHostValidator;
|
||||
use OC\Security\SecureRandom;
|
||||
|
|
@ -159,6 +166,7 @@ use OCA\Theming\Service\BackgroundService;
|
|||
use OCA\Theming\ThemingDefaults;
|
||||
use OCA\Theming\Util;
|
||||
use OCP\Accounts\IAccountManager;
|
||||
use OCP\Activity\IEventMerger;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Utility\IControllerMethodReflector;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
|
|
@ -167,13 +175,17 @@ use OCP\Authentication\Token\IProvider as OCPIProvider;
|
|||
use OCP\Authentication\TwoFactorAuth\IRegistry;
|
||||
use OCP\AutoloadNotAllowedException;
|
||||
use OCP\BackgroundJob\IJobList;
|
||||
use OCP\Collaboration\Collaborators\ISearch;
|
||||
use OCP\Collaboration\Collaborators\ISearchResult;
|
||||
use OCP\Collaboration\Reference\IReferenceManager;
|
||||
use OCP\Collaboration\Resources\IProviderManager;
|
||||
use OCP\Command\IBus;
|
||||
use OCP\Comments\ICommentsManager;
|
||||
use OCP\Comments\ICommentsManagerFactory;
|
||||
use OCP\Config\IUserConfig;
|
||||
use OCP\Contacts\ContactsMenu\IActionFactory;
|
||||
use OCP\Contacts\ContactsMenu\IContactsStore;
|
||||
use OCP\ContextChat\IContentManager;
|
||||
use OCP\Defaults;
|
||||
use OCP\Diagnostics\IEventLogger;
|
||||
use OCP\Diagnostics\IQueryLogger;
|
||||
|
|
@ -194,6 +206,7 @@ use OCP\Files\IFilenameValidator;
|
|||
use OCP\Files\IMimeTypeDetector;
|
||||
use OCP\Files\IMimeTypeLoader;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\ISetupManager;
|
||||
use OCP\Files\Lock\ILockManager;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\Storage\IStorageFactory;
|
||||
|
|
@ -237,7 +250,10 @@ use OCP\Lockdown\ILockdownManager;
|
|||
use OCP\Log\ILogFactory;
|
||||
use OCP\Mail\IEmailValidator;
|
||||
use OCP\Mail\IMailer;
|
||||
use OCP\OCM\ICapabilityAwareOCMProvider;
|
||||
use OCP\OCM\IOCMDiscoveryService;
|
||||
use OCP\OCM\IOCMProvider;
|
||||
use OCP\OCS\IDiscoveryService;
|
||||
use OCP\Preview\IMimeIconProvider;
|
||||
use OCP\Profile\IProfileManager;
|
||||
use OCP\Profiler\IProfiler;
|
||||
|
|
@ -247,10 +263,12 @@ use OCP\RichObjectStrings\IRichTextFormatter;
|
|||
use OCP\RichObjectStrings\IValidator;
|
||||
use OCP\Route\IRouter;
|
||||
use OCP\Security\Bruteforce\IThrottler;
|
||||
use OCP\Security\IContentSecurityPolicyManager;
|
||||
use OCP\Security\ICredentialsManager;
|
||||
use OCP\Security\ICrypto;
|
||||
use OCP\Security\IHasher;
|
||||
use OCP\Security\Ip\IRemoteAddress;
|
||||
use OCP\Security\IRemoteHostValidator;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\Security\ITrustedDomainHelper;
|
||||
use OCP\Security\RateLimiting\ILimiter;
|
||||
|
|
@ -260,10 +278,12 @@ use OCP\ServerVersion;
|
|||
use OCP\Settings\IDeclarativeManager;
|
||||
use OCP\SetupCheck\ISetupCheckManager;
|
||||
use OCP\Share\IProviderFactory;
|
||||
use OCP\Share\IPublicShareTemplateFactory;
|
||||
use OCP\Share\IShareHelper;
|
||||
use OCP\Snowflake\ISnowflakeDecoder;
|
||||
use OCP\Snowflake\ISnowflakeGenerator;
|
||||
use OCP\SpeechToText\ISpeechToTextManager;
|
||||
use OCP\Support\Subscription\IAssertion;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\ISystemTagObjectMapper;
|
||||
use OCP\Talk\IBroker;
|
||||
|
|
@ -313,8 +333,8 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
|
||||
$this->registerAlias(\OCP\Contacts\IManager::class, ContactsManager::class);
|
||||
|
||||
$this->registerAlias(\OCP\ContextChat\IContentManager::class, \OC\ContextChat\ContentManager::class);
|
||||
$this->registerAlias(\OCP\Files\ISetupManager::class, \OC\Files\SetupManager::class);
|
||||
$this->registerAlias(IContentManager::class, ContentManager::class);
|
||||
$this->registerAlias(ISetupManager::class, SetupManager::class);
|
||||
|
||||
$this->registerAlias(\OCP\DirectEditing\IManager::class, \OC\DirectEditing\Manager::class);
|
||||
$this->registerAlias(ITemplateManager::class, TemplateManager::class);
|
||||
|
|
@ -671,8 +691,8 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
);
|
||||
});
|
||||
|
||||
$this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
|
||||
return new \OC\Activity\EventMerger(
|
||||
$this->registerService(IEventMerger::class, function (Server $c) {
|
||||
return new EventMerger(
|
||||
$c->getL10N('lib')
|
||||
);
|
||||
});
|
||||
|
|
@ -695,7 +715,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
|
||||
$this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class);
|
||||
$this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class);
|
||||
$this->registerAlias(\OCP\Support\Subscription\IAssertion::class, Assertion::class);
|
||||
$this->registerAlias(IAssertion::class, Assertion::class);
|
||||
|
||||
/** Only used by the PsrLoggerAdapter should not be used by apps */
|
||||
$this->registerService(Log::class, function (Server $c) {
|
||||
|
|
@ -726,16 +746,16 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
});
|
||||
$this->registerAlias(IRouter::class, Router::class);
|
||||
|
||||
$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
|
||||
$this->registerService(IBackend::class, function ($c) {
|
||||
$config = $c->get(IConfig::class);
|
||||
if (ltrim($config->getSystemValueString('memcache.distributed', ''), '\\') === Redis::class) {
|
||||
$backend = new \OC\Security\RateLimiting\Backend\MemoryCacheBackend(
|
||||
$backend = new MemoryCacheBackend(
|
||||
$c->get(AllConfig::class),
|
||||
$this->get(ICacheFactory::class),
|
||||
new TimeFactory()
|
||||
);
|
||||
} else {
|
||||
$backend = new \OC\Security\RateLimiting\Backend\DatabaseBackend(
|
||||
$backend = new DatabaseBackend(
|
||||
$c->get(AllConfig::class),
|
||||
$c->get(IDBConnection::class),
|
||||
new TimeFactory()
|
||||
|
|
@ -746,7 +766,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
});
|
||||
|
||||
$this->registerAlias(ISecureRandom::class, SecureRandom::class);
|
||||
$this->registerAlias(\OCP\Security\IRemoteHostValidator::class, RemoteHostValidator::class);
|
||||
$this->registerAlias(IRemoteHostValidator::class, RemoteHostValidator::class);
|
||||
$this->registerAlias(IVerificationToken::class, VerificationToken::class);
|
||||
|
||||
$this->registerAlias(ICrypto::class, Crypto::class);
|
||||
|
|
@ -1127,7 +1147,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$this->registerService(SessionStorage::class, function (ContainerInterface $c) {
|
||||
return new SessionStorage($c->get(ISession::class));
|
||||
});
|
||||
$this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class);
|
||||
$this->registerAlias(IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class);
|
||||
|
||||
$this->registerService(IProviderFactory::class, function (ContainerInterface $c) {
|
||||
$config = $c->get(IConfig::class);
|
||||
|
|
@ -1138,8 +1158,8 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
|
||||
$this->registerAlias(\OCP\Share\IManager::class, \OC\Share20\Manager::class);
|
||||
|
||||
$this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c): \OCP\Collaboration\Collaborators\ISearch {
|
||||
$instance = new \OC\Collaboration\Collaborators\Search($c);
|
||||
$this->registerService(ISearch::class, function (Server $c): ISearch {
|
||||
$instance = new Search($c);
|
||||
|
||||
// register default plugins
|
||||
$instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]);
|
||||
|
|
@ -1151,11 +1171,11 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
|
||||
return $instance;
|
||||
});
|
||||
$this->registerAlias(\OCP\Collaboration\Collaborators\ISearchResult::class, \OC\Collaboration\Collaborators\SearchResult::class);
|
||||
$this->registerAlias(ISearchResult::class, SearchResult::class);
|
||||
|
||||
$this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class);
|
||||
|
||||
$this->registerAlias(\OCP\Collaboration\Resources\IProviderManager::class, ProviderManager::class);
|
||||
$this->registerAlias(IProviderManager::class, ProviderManager::class);
|
||||
$this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class);
|
||||
|
||||
$this->registerAlias(IReferenceManager::class, ReferenceManager::class);
|
||||
|
|
@ -1176,7 +1196,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
});
|
||||
});
|
||||
|
||||
$this->registerService(\OCP\OCS\IDiscoveryService::class, function (ContainerInterface $c): \OCP\OCS\IDiscoveryService {
|
||||
$this->registerService(IDiscoveryService::class, function (ContainerInterface $c): IDiscoveryService {
|
||||
return new DiscoveryService(
|
||||
$c->get(ICacheFactory::class),
|
||||
$c->get(IClientService::class)
|
||||
|
|
@ -1258,7 +1278,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
|
||||
$this->registerAlias(IBinaryFinder::class, BinaryFinder::class);
|
||||
|
||||
$this->registerAlias(\OCP\Share\IPublicShareTemplateFactory::class, PublicShareTemplateFactory::class);
|
||||
$this->registerAlias(IPublicShareTemplateFactory::class, PublicShareTemplateFactory::class);
|
||||
|
||||
$this->registerAlias(ITranslationManager::class, TranslationManager::class);
|
||||
|
||||
|
|
@ -1277,8 +1297,8 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$this->registerAlias(IPhoneNumberUtil::class, PhoneNumberUtil::class);
|
||||
|
||||
// there is no reason for having OCMProvider as a Service (marked as deprecated since 32.0.0)
|
||||
$this->registerDeprecatedAlias(\OCP\OCM\ICapabilityAwareOCMProvider::class, OCMProvider::class);
|
||||
$this->registerDeprecatedAlias(\OCP\OCM\IOCMProvider::class, OCMProvider::class);
|
||||
$this->registerDeprecatedAlias(ICapabilityAwareOCMProvider::class, OCMProvider::class);
|
||||
$this->registerDeprecatedAlias(IOCMProvider::class, OCMProvider::class);
|
||||
|
||||
$this->registerAlias(ISetupCheckManager::class, SetupCheckManager::class);
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ use OCP\Share\IPartialShareProvider;
|
|||
use OCP\Share\IProviderFactory;
|
||||
use OCP\Share\IShare;
|
||||
use OCP\Share\IShareProvider;
|
||||
use OCP\Share\IShareProviderGetUsers;
|
||||
use OCP\Share\IShareProviderSupportsAccept;
|
||||
use OCP\Share\IShareProviderSupportsAllSharesInFolder;
|
||||
use OCP\Share\IShareProviderWithNotification;
|
||||
|
|
@ -1547,7 +1548,7 @@ class Manager implements IManager {
|
|||
}
|
||||
|
||||
#[\Override]
|
||||
public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false): array {
|
||||
public function getAccessList(Node $path, $recursive = true, $currentAccess = false): array {
|
||||
$owner = $path->getOwner();
|
||||
|
||||
if ($owner === null) {
|
||||
|
|
@ -1942,7 +1943,7 @@ class Manager implements IManager {
|
|||
|
||||
public function getUsersForShare(IShare $share): iterable {
|
||||
$provider = $this->factory->getProviderForType($share->getShareType());
|
||||
if ($provider instanceof Share\IShareProviderGetUsers) {
|
||||
if ($provider instanceof IShareProviderGetUsers) {
|
||||
return $provider->getUsersForShare($share);
|
||||
} else {
|
||||
return [];
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ class Manager extends PublicEmitter implements IUserManager {
|
|||
* @internal Only for mocks it in unit tests.
|
||||
*/
|
||||
public function getUserConfig(): IUserConfig {
|
||||
return \OCP\Server::get(IUserConfig::class);
|
||||
return Server::get(IUserConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use OC\Authentication\Token\IProvider;
|
|||
use OC\SystemConfig;
|
||||
use OC\User\Database;
|
||||
use OC\User\DisabledUserException;
|
||||
use OC\User\Session;
|
||||
use OCP\Authentication\Exceptions\InvalidTokenException;
|
||||
use OCP\Authentication\Exceptions\WipeTokenException;
|
||||
use OCP\Authentication\IApacheBackend;
|
||||
|
|
@ -151,7 +152,7 @@ class OC_User {
|
|||
if ($uid) {
|
||||
if (self::getUser() !== $uid) {
|
||||
self::setUserId($uid);
|
||||
/** @var \OC\User\Session $userSession */
|
||||
/** @var Session $userSession */
|
||||
$userSession = Server::get(IUserSession::class);
|
||||
|
||||
/** @var IEventDispatcher $dispatcher */
|
||||
|
|
@ -234,7 +235,7 @@ class OC_User {
|
|||
|
||||
//setup extra user backends
|
||||
self::setupBackends();
|
||||
/** @var \OC\User\Session $session */
|
||||
/** @var Session $session */
|
||||
$session = Server::get(IUserSession::class);
|
||||
$session->unsetMagicInCookie();
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use OC\Files\Filesystem;
|
|||
use OC\Files\SetupManager;
|
||||
use OC\Setup;
|
||||
use OC\SystemConfig;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\Files\FileInfo;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\Files\NotFoundException;
|
||||
|
|
@ -787,14 +788,14 @@ class OC_Util {
|
|||
* @deprecated 32.0.0 Use \OCP\Util::needUpgrade() instead.
|
||||
* @see \OCP\Util::needUpgrade
|
||||
*/
|
||||
public static function needUpgrade(\OC\SystemConfig $config): bool {
|
||||
public static function needUpgrade(SystemConfig $config): bool {
|
||||
if (!$config->getValue('installed', false)) {
|
||||
// not installed (nothing to do)
|
||||
return false;
|
||||
}
|
||||
|
||||
$installedVersion = (string)$config->getValue('version', '0.0.0');
|
||||
$codeVersion = implode('.', \OCP\Util::getVersion());
|
||||
$codeVersion = implode('.', Util::getVersion());
|
||||
|
||||
// codebase newer: upgrade needed
|
||||
if (version_compare($codeVersion, $installedVersion, '>')) {
|
||||
|
|
@ -815,12 +816,12 @@ class OC_Util {
|
|||
|
||||
// disallow downgrade (not in debug mode or major.minor mismatch)
|
||||
/** @var \Psr\Log\LoggerInterface $logger */
|
||||
$logger = \OCP\Server::get(LoggerInterface::class);
|
||||
$logger = Server::get(LoggerInterface::class);
|
||||
$logger->error(
|
||||
'Detected downgrade attempt from installed {installed} to code {code}',
|
||||
[ 'installed' => $installedVersion, 'code' => $codeVersion, 'app' => 'core', ]
|
||||
);
|
||||
throw new \OCP\HintException(sprintf(
|
||||
throw new HintException(sprintf(
|
||||
'Downgrading Nextcloud from %s to %s is not supported and may corrupt your instance (database and data directory). '
|
||||
. 'Restore a full backup (code, database, and data directory) taken before the change, '
|
||||
. 'or restore the previous codebase so that it matches the installed version (version %s).',
|
||||
|
|
@ -829,7 +830,7 @@ class OC_Util {
|
|||
}
|
||||
|
||||
// versions are equal: check whether any enabled apps need upgrading
|
||||
$appManager = \OCP\Server::get(\OCP\App\IAppManager::class);
|
||||
$appManager = Server::get(IAppManager::class);
|
||||
$apps = $appManager->getEnabledApps();
|
||||
foreach ($apps as $app) {
|
||||
if ($appManager->isUpgradeRequired($app)) {
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class ClientFlowLoginControllerTest extends TestCase {
|
|||
$initialState = [];
|
||||
$this->initialState->expects($this->exactly(2))
|
||||
->method('provideInitialState')
|
||||
->willReturnCallback(function () use (&$initialState) {
|
||||
->willReturnCallback(function () use (&$initialState): void {
|
||||
$initialState[] = func_get_args();
|
||||
});
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ class ClientFlowLoginControllerTest extends TestCase {
|
|||
$initialState = [];
|
||||
$this->initialState->expects($this->exactly(2))
|
||||
->method('provideInitialState')
|
||||
->willReturnCallback(function () use (&$initialState) {
|
||||
->willReturnCallback(function () use (&$initialState): void {
|
||||
$initialState[] = func_get_args();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class OpenMetricsControllerTest extends TestCase {
|
|||
$output = $this->createMock(IOutput::class);
|
||||
$fullOutput = '';
|
||||
$output->method('setOutput')
|
||||
->willReturnCallback(function ($output) use (&$fullOutput) {
|
||||
->willReturnCallback(function ($output) use (&$fullOutput): void {
|
||||
$fullOutput .= $output;
|
||||
});
|
||||
$this->config->expects($this->once())
|
||||
|
|
|
|||
|
|
@ -970,7 +970,7 @@ class MailPluginTest extends TestCase {
|
|||
|
||||
$this->instantiatePlugin(IShare::TYPE_USER);
|
||||
|
||||
$currentUser = $this->createMock(\OCP\IUser::class);
|
||||
$currentUser = $this->createMock(IUser::class);
|
||||
|
||||
$currentUser->expects($this->any())
|
||||
->method('getUID')
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ class MigrationServiceTest extends \Test\TestCase {
|
|||
$migrationService
|
||||
->expects($this->exactly(2))
|
||||
->method('executeStep')
|
||||
->willReturnCallback(function (string $migration) use (&$calls) {
|
||||
->willReturnCallback(function (string $migration) use (&$calls): void {
|
||||
$calls[] = $migration;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ class SetupManagerTest extends TestCase {
|
|||
}
|
||||
|
||||
private function getAddMountCheckCallback(InvokedCount $invokedCount, $expectations): \Closure {
|
||||
return function (IMountPoint $actualMount) use ($invokedCount, $expectations) {
|
||||
return function (IMountPoint $actualMount) use ($invokedCount, $expectations): void {
|
||||
$expectedMount = $expectations[$invokedCount->numberOfInvocations()] ?? null;
|
||||
$this->assertSame($expectedMount, $actualMount);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ use OCP\IL10N;
|
|||
use OCP\IPreview;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\L10N\IFactory;
|
||||
use Psr\Log\NullLogger;
|
||||
use Test\TestCase;
|
||||
|
|
@ -64,10 +66,10 @@ class TemplateManagerTest extends TestCase {
|
|||
$this->rootFolder = $this->createMock(IRootFolder::class);
|
||||
$user = $this->createMock(IUser::class);
|
||||
$user->method('getUID')->willReturn('user1');
|
||||
$userSession = $this->createMock(\OCP\IUserSession::class);
|
||||
$userSession = $this->createMock(IUserSession::class);
|
||||
$userSession->method('getUser')
|
||||
->willReturn($user);
|
||||
$userManager = $this->createMock(\OCP\IUserManager::class);
|
||||
$userManager = $this->createMock(IUserManager::class);
|
||||
$previewManager = $this->createMock(IPreview::class);
|
||||
|
||||
$this->templateManager = new TemplateManager(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace Test\OCM\Listeners;
|
|||
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventListener;
|
||||
use OCP\OCM\Events\LocalOCMDiscoveryEvent;
|
||||
|
||||
/** @template-implements IEventListener<\OCP\OCM\Events\LocalOCMDiscoveryEvent> */
|
||||
class LocalOCMDiscoveryTestEvent implements IEventListener {
|
||||
|
|
@ -18,7 +19,7 @@ class LocalOCMDiscoveryTestEvent implements IEventListener {
|
|||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof \OCP\OCM\Events\LocalOCMDiscoveryEvent)) {
|
||||
if (!($event instanceof LocalOCMDiscoveryEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ use OCP\AppFramework\Http\DataResponse;
|
|||
use OCP\AppFramework\Http\Response;
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventListener;
|
||||
use OCP\OCM\Enum\ParamType;
|
||||
use OCP\OCM\Events\OCMEndpointRequestEvent;
|
||||
|
||||
/** @template-implements IEventListener<\OCP\OCM\Events\OCMEndpointRequestEvent> */
|
||||
class OCMEndpointRequestTestEvent implements IEventListener {
|
||||
|
|
@ -20,7 +22,7 @@ class OCMEndpointRequestTestEvent implements IEventListener {
|
|||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof \OCP\OCM\Events\OCMEndpointRequestEvent)) {
|
||||
if (!($event instanceof OCMEndpointRequestEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -36,11 +38,11 @@ class OCMEndpointRequestTestEvent implements IEventListener {
|
|||
'args' => $event->getArgs(),
|
||||
'totalArgs' => $event->getArgsCount(),
|
||||
'typedArgs' => $event->getArgs(
|
||||
\OCP\OCM\Enum\ParamType::STRING,
|
||||
\OCP\OCM\Enum\ParamType::STRING,
|
||||
\OCP\OCM\Enum\ParamType::INT,
|
||||
\OCP\OCM\Enum\ParamType::BOOL,
|
||||
\OCP\OCM\Enum\ParamType::INT
|
||||
ParamType::STRING,
|
||||
ParamType::STRING,
|
||||
ParamType::INT,
|
||||
ParamType::BOOL,
|
||||
ParamType::INT
|
||||
)
|
||||
]
|
||||
));
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace Test\Preview;
|
|||
|
||||
use OC\BinaryFinder;
|
||||
use OC\Preview\Postscript;
|
||||
use OCP\Server;
|
||||
|
||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
||||
#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('imagick')]
|
||||
|
|
@ -19,7 +20,7 @@ class PostscriptTest extends Provider {
|
|||
if (\Imagick::queryFormats('EPS') === false || \Imagick::queryFormats('PS') === false) {
|
||||
$this->markTestSkipped('Imagick does not support postscript.');
|
||||
}
|
||||
if (\OCP\Server::get(BinaryFinder::class)->findBinaryPath('gs') === false) {
|
||||
if (Server::get(BinaryFinder::class)->findBinaryPath('gs') === false) {
|
||||
// Imagick forwards postscript rendering to Ghostscript but does not report this in queryFormats
|
||||
$this->markTestSkipped('Ghostscript is not installed.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use OC\Files\SetupManager;
|
|||
use OC\Files\View;
|
||||
use OC\Installer;
|
||||
use OC\Updater;
|
||||
use OC\User\Session;
|
||||
use OCP\Command\IBus;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\Files\IRootFolder;
|
||||
|
|
@ -442,7 +443,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
|
|||
*/
|
||||
protected static function logout(): void {
|
||||
Server::get(SetupManager::class)->tearDown();
|
||||
$userSession = Server::get(\OC\User\Session::class);
|
||||
$userSession = Server::get(Session::class);
|
||||
$userSession->getSession()->set('user_id', '');
|
||||
// needed for fully logout
|
||||
$userSession->setUser(null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue