aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Encryption/DecryptAll.php24
-rw-r--r--lib/private/Encryption/Manager.php37
-rw-r--r--lib/private/Migration/BackgroundRepair.php9
-rw-r--r--lib/private/Repair.php20
-rw-r--r--lib/private/Server.php3
-rw-r--r--lib/private/Updater.php6
-rw-r--r--lib/private/legacy/OC_App.php2
7 files changed, 33 insertions, 68 deletions
diff --git a/lib/private/Encryption/DecryptAll.php b/lib/private/Encryption/DecryptAll.php
index 7bf4ce62d28..98ea35c62e0 100644
--- a/lib/private/Encryption/DecryptAll.php
+++ b/lib/private/Encryption/DecryptAll.php
@@ -31,6 +31,7 @@ namespace OC\Encryption;
use OC\Encryption\Exceptions\DecryptionFailedException;
use OC\Files\View;
use OCP\Encryption\IEncryptionModule;
+use OCP\Encryption\IManager;
use OCP\IUserManager;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
@@ -43,31 +44,14 @@ class DecryptAll {
/** @var InputInterface */
protected $input;
- /** @var Manager */
- protected $encryptionManager;
-
- /** @var IUserManager */
- protected $userManager;
-
- /** @var View */
- protected $rootView;
-
/** @var array files which couldn't be decrypted */
protected $failed;
- /**
- * @param Manager $encryptionManager
- * @param IUserManager $userManager
- * @param View $rootView
- */
public function __construct(
- Manager $encryptionManager,
- IUserManager $userManager,
- View $rootView
+ protected IManager $encryptionManager,
+ protected IUserManager $userManager,
+ protected View $rootView
) {
- $this->encryptionManager = $encryptionManager;
- $this->userManager = $userManager;
- $this->rootView = $rootView;
$this->failed = [];
}
diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php
index 28bee7dacb7..f48d259eea0 100644
--- a/lib/private/Encryption/Manager.php
+++ b/lib/private/Encryption/Manager.php
@@ -39,34 +39,17 @@ use OCP\IL10N;
use Psr\Log\LoggerInterface;
class Manager implements IManager {
- /** @var array */
- protected $encryptionModules;
-
- /** @var IConfig */
- protected $config;
-
- protected LoggerInterface $logger;
-
- /** @var Il10n */
- protected $l;
-
- /** @var View */
- protected $rootView;
-
- /** @var Util */
- protected $util;
-
- /** @var ArrayCache */
- protected $arrayCache;
-
- public function __construct(IConfig $config, LoggerInterface $logger, IL10N $l10n, View $rootView, Util $util, ArrayCache $arrayCache) {
+ protected array $encryptionModules;
+
+ public function __construct(
+ protected IConfig $config,
+ protected LoggerInterface $logger,
+ protected IL10N $l,
+ protected View $rootView,
+ protected Util $util,
+ protected ArrayCache $arrayCache,
+ ) {
$this->encryptionModules = [];
- $this->config = $config;
- $this->logger = $logger;
- $this->l = $l10n;
- $this->rootView = $rootView;
- $this->util = $util;
- $this->arrayCache = $arrayCache;
}
/**
diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php
index dd1b15c7492..afc3dcc9ac7 100644
--- a/lib/private/Migration/BackgroundRepair.php
+++ b/lib/private/Migration/BackgroundRepair.php
@@ -32,7 +32,6 @@ use OC_App;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\TimedJob;
-use OCP\EventDispatcher\IEventDispatcher;
use Psr\Log\LoggerInterface;
/**
@@ -42,7 +41,7 @@ use Psr\Log\LoggerInterface;
*/
class BackgroundRepair extends TimedJob {
public function __construct(
- private IEventDispatcher $dispatcher,
+ private Repair $repair,
ITimeFactory $time,
private LoggerInterface $logger,
private IJobList $jobList,
@@ -73,9 +72,9 @@ class BackgroundRepair extends TimedJob {
}
$step = $argument['step'];
- $repair = new Repair([], $this->dispatcher, \OC::$server->get(LoggerInterface::class));
+ $this->repair->setRepairSteps([]);
try {
- $repair->addStep($step);
+ $this->repair->addStep($step);
} catch (\Exception $ex) {
$this->logger->error($ex->getMessage(), [
'app' => 'migration',
@@ -88,7 +87,7 @@ class BackgroundRepair extends TimedJob {
}
// execute the repair step
- $repair->run();
+ $this->repair->run();
// remove the job once executed successfully
$this->jobList->remove($this, $this->argument);
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index 21caed3e39f..1af9b0d1b22 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -91,23 +91,19 @@ use Throwable;
class Repair implements IOutput {
/** @var IRepairStep[] */
- private array $repairSteps;
-
- private IEventDispatcher $dispatcher;
+ private array $repairSteps = [];
private string $currentStep;
- private LoggerInterface $logger;
+ public function __construct(
+ private IEventDispatcher $dispatcher,
+ private LoggerInterface $logger
+ ) {
+ }
- /**
- * Creates a new repair step runner
- *
- * @param IRepairStep[] $repairSteps array of RepairStep instances
- */
- public function __construct(array $repairSteps, IEventDispatcher $dispatcher, LoggerInterface $logger) {
+ /** @param IRepairStep[] $repairSteps */
+ public function setRepairSteps(array $repairSteps): void {
$this->repairSteps = $repairSteps;
- $this->dispatcher = $dispatcher;
- $this->logger = $logger;
}
/**
diff --git a/lib/private/Server.php b/lib/private/Server.php
index d026ad4286d..d8fa900c0af 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -976,7 +976,8 @@ class Server extends ServerContainer implements IServerContainer {
return $backend;
});
- $this->registerService('IntegrityCodeChecker', function (ContainerInterface $c) {
+ $this->registerDeprecatedAlias('IntegrityCodeChecker', Checker::class);
+ $this->registerService(Checker::class, function (ContainerInterface $c) {
// IConfig and IAppManager requires a working database. This code
// might however be called when ownCloud is not yet setup.
if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) {
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index 018e4797232..62d5fd1c058 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -255,7 +255,8 @@ class Updater extends BasicEmitter {
file_put_contents($this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
// pre-upgrade repairs
- $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
+ $repair = \OCP\Server::get(Repair::class);
+ $repair->setRepairSteps(Repair::getBeforeUpgradeRepairSteps());
$repair->run();
$this->doCoreUpgrade();
@@ -296,7 +297,8 @@ class Updater extends BasicEmitter {
}
// post-upgrade repairs
- $repair = new Repair(Repair::getRepairSteps(), \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
+ $repair = \OCP\Server::get(Repair::class);
+ $repair->setRepairSteps(Repair::getRepairSteps());
$repair->run();
//Invalidate update feed
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index edd844bf89f..841ad541674 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -823,7 +823,7 @@ class OC_App {
$dispatcher = \OC::$server->get(IEventDispatcher::class);
// load the steps
- $r = new Repair([], $dispatcher, \OC::$server->get(LoggerInterface::class));
+ $r = \OCP\Server::get(Repair::class);
foreach ($steps as $step) {
try {
$r->addStep($step);