Browse Source
fix(autoloader): Fix location of class to be autoloadable
fix(autoloader): Fix location of class to be autoloadable
> Class FeedBackHandler located in ./core/ajax/update.php does not comply with psr-4 autoloading standard (rule: OC\Core\ => ./core). Skipping. Signed-off-by: Joas Schilling <coding@schilljs.com>pull/53071/head
No known key found for this signature in database
GPG Key ID: F72FA5B49FFA96B0
4 changed files with 63 additions and 40 deletions
-
60core/Listener/FeedBackHandler.php
-
41core/ajax/update.php
-
1lib/composer/composer/autoload_classmap.php
-
1lib/composer/composer/autoload_static.php
@ -0,0 +1,60 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
|
|||
/** |
|||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc. |
|||
* SPDX-License-Identifier: AGPL-3.0-only |
|||
*/ |
|||
|
|||
namespace OC\Core\Listener; |
|||
|
|||
use OC\Repair\Events\RepairAdvanceEvent; |
|||
use OC\Repair\Events\RepairErrorEvent; |
|||
use OC\Repair\Events\RepairFinishEvent; |
|||
use OC\Repair\Events\RepairInfoEvent; |
|||
use OC\Repair\Events\RepairStartEvent; |
|||
use OC\Repair\Events\RepairStepEvent; |
|||
use OC\Repair\Events\RepairWarningEvent; |
|||
use OCP\EventDispatcher\Event; |
|||
use OCP\IEventSource; |
|||
use OCP\IL10N; |
|||
|
|||
class FeedBackHandler { |
|||
private int $progressStateMax = 100; |
|||
private int $progressStateStep = 0; |
|||
private string $currentStep = ''; |
|||
|
|||
public function __construct( |
|||
private IEventSource $eventSource, |
|||
private IL10N $l10n, |
|||
) { |
|||
} |
|||
|
|||
public function handleRepairFeedback(Event $event): void { |
|||
if ($event instanceof RepairStartEvent) { |
|||
$this->progressStateMax = $event->getMaxStep(); |
|||
$this->progressStateStep = 0; |
|||
$this->currentStep = $event->getCurrentStepName(); |
|||
} elseif ($event instanceof RepairAdvanceEvent) { |
|||
$this->progressStateStep += $event->getIncrement(); |
|||
$desc = $event->getDescription(); |
|||
if (empty($desc)) { |
|||
$desc = $this->currentStep; |
|||
} |
|||
$this->eventSource->send('success', $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc])); |
|||
} elseif ($event instanceof RepairFinishEvent) { |
|||
$this->progressStateMax = $this->progressStateStep; |
|||
$this->eventSource->send('success', $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep])); |
|||
} elseif ($event instanceof RepairStepEvent) { |
|||
$this->eventSource->send('success', $this->l10n->t('Repair step:') . ' ' . $event->getStepName()); |
|||
} elseif ($event instanceof RepairInfoEvent) { |
|||
$this->eventSource->send('success', $this->l10n->t('Repair info:') . ' ' . $event->getMessage()); |
|||
} elseif ($event instanceof RepairWarningEvent) { |
|||
$this->eventSource->send('notice', $this->l10n->t('Repair warning:') . ' ' . $event->getMessage()); |
|||
} elseif ($event instanceof RepairErrorEvent) { |
|||
$this->eventSource->send('error', $this->l10n->t('Repair error:') . ' ' . $event->getMessage()); |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue