Skip to content

Commit

Permalink
refactor: Migrate to IAppConfig
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Sep 19, 2024
1 parent d6ad880 commit 64b2676
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/ACL/ACLManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
namespace OCA\GroupFolders\ACL;

use OCA\GroupFolders\Trash\TrashManager;
use OCP\IConfig;
use OCP\IAppConfig;
use OCP\IUser;
use Psr\Log\LoggerInterface;

class ACLManagerFactory {
public function __construct(
private RuleManager $ruleManager,
private TrashManager $trashManager,
private IConfig $config,
private IAppConfig $config,
private LoggerInterface $logger,
private \Closure $rootFolderProvider,
) {
Expand All @@ -31,7 +31,7 @@ public function getACLManager(IUser $user, ?int $rootStorageId = null): ACLManag
$user,
$this->rootFolderProvider,
$rootStorageId,
$this->config->getAppValue('groupfolders', 'acl-inherit-per-user', 'false') === 'true',
$this->config->getValueString('groupfolders', 'acl-inherit-per-user', 'false') === 'true',
);
}
}
12 changes: 6 additions & 6 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
use OCP\Files\NotFoundException;
use OCP\IAppConfig;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroup;
use OCP\IRequest;
Expand Down Expand Up @@ -105,9 +104,10 @@ public function register(IRegistrationContext $context): void {
$rootProvider = function () use ($c): Folder {
return $c->get('GroupAppFolder');
};
$config = $c->get(IConfig::class);
$allowRootShare = $config->getAppValue('groupfolders', 'allow_root_share', 'true') === 'true';
$enableEncryption = $config->getAppValue('groupfolders', 'enable_encryption', 'false') === 'true';
/** @var IAppConfig $config */
$config = $c->get(IAppConfig::class);
$allowRootShare = $config->getValueString('groupfolders', 'allow_root_share', 'true') === 'true';
$enableEncryption = $config->getValueString('groupfolders', 'enable_encryption', 'false') === 'true';

return new MountProvider(
$c->get(FolderManager::class),
Expand Down Expand Up @@ -208,7 +208,7 @@ public function register(IRegistrationContext $context): void {
return new ExpireGroupTrashJob(
$c->get(TrashBackend::class),
$c->get(Expiration::class),
$c->get(IConfig::class),
$c->get(IAppConfig::class),
$c->get(ITimeFactory::class)
);
}
Expand All @@ -224,7 +224,7 @@ public function register(IRegistrationContext $context): void {
return new ACLManagerFactory(
$c->get(RuleManager::class),
$c->get(TrashManager::class),
$c->get(IConfig::class),
$c->get(IAppConfig::class),
$c->get(LoggerInterface::class),
$rootFolderProvider
);
Expand Down
6 changes: 3 additions & 3 deletions lib/BackgroundJob/ExpireGroupTrash.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
use OCA\GroupFolders\Trash\TrashBackend;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\IAppConfig;

class ExpireGroupTrash extends TimedJob {
public function __construct(
private TrashBackend $trashBackend,
private Expiration $expiration,
private IConfig $config,
private IAppConfig $config,
ITimeFactory $timeFactory,
) {
parent::__construct($timeFactory);
Expand All @@ -27,7 +27,7 @@ public function __construct(
}

protected function run(mixed $argument): void {
$backgroundJob = $this->config->getAppValue('files_trashbin', 'background_job_expire_trash', 'yes');
$backgroundJob = $this->config->getValueString('files_trashbin', 'background_job_expire_trash', 'yes');
if ($backgroundJob === 'no') {
return;
}
Expand Down

0 comments on commit 64b2676

Please sign in to comment.