Skip to content

Commit

Permalink
fix(DI): Fix DI for AppConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Mar 14, 2024
1 parent aef8e02 commit e671b06
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/AppConfigOverwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use OC\AppConfig;
use OCP\IDBConnection;
use OCP\Security\ICrypto;
use Psr\Log\LoggerInterface;

class AppConfigOverwrite extends AppConfig {
Expand All @@ -35,9 +36,10 @@ class AppConfigOverwrite extends AppConfig {
public function __construct(
IDBConnection $connection,
LoggerInterface $logger,
ICrypto $crypto,
array $overWrite
) {
parent::__construct($connection, $logger);
parent::__construct($connection, $logger, $crypto);
$this->overWrite = $overWrite;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/RestrictionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\IServerContainer;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Security\ICrypto;
use OCP\Settings\IManager;
use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -123,6 +124,7 @@ public function lateSetupRestrictions(): void {
return new AppConfigOverwrite(
$this->server->get(IDBConnection::class),
$this->server->get(LoggerInterface::class),
$this->server->get(ICrypto::class),
[
'core' => [
'shareapi_only_share_with_group_members' => 'yes'
Expand Down
3 changes: 2 additions & 1 deletion tests/stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public function setUnreadCounter(string $id, int $unreadCounter): void {
class AppConfig {
public function __construct(
protected \OCP\IDBConnection $connection,
private \Psr\Log\LoggerInterface $logger,
protected \Psr\Log\LoggerInterface $logger,
protected \OCP\Security\ICrypto $crypto,
) {
}

Expand Down

0 comments on commit e671b06

Please sign in to comment.