Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions lib/private/AppFramework/Bootstrap/RegistrationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
use Psr\Log\LoggerInterface;
use RuntimeException;
use Throwable;
use function array_shift;

class RegistrationContext {
/** @var ServiceRegistration<ICapability>[] */
Expand Down Expand Up @@ -731,7 +730,7 @@ public function registerGlobalScaleService(string $class): void {
* @param App[] $apps
*/
public function delegateCapabilityRegistrations(array $apps): void {
while (($registration = array_shift($this->capabilities)) !== null) {
foreach ($this->capabilities as $registration) {
$appId = $registration->getAppId();
if (!isset($apps[$appId])) {
// If we land here something really isn't right. But at least we caught the
Expand All @@ -752,13 +751,14 @@ public function delegateCapabilityRegistrations(array $apps): void {
]);
}
}
$this->capabilities = [];
}

/**
* @param App[] $apps
*/
public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void {
while (($registration = array_shift($this->crashReporters)) !== null) {
foreach ($this->crashReporters as $registration) {
try {
$registry->registerLazy($registration->getService());
} catch (Throwable $e) {
Expand All @@ -768,10 +768,11 @@ public function delegateCrashReporterRegistrations(array $apps, Registry $regist
]);
}
}
$this->crashReporters = [];
}

public function delegateDashboardPanelRegistrations(IManager $dashboardManager): void {
while (($panel = array_shift($this->dashboardPanels)) !== null) {
foreach ($this->dashboardPanels as $panel) {
try {
$dashboardManager->lazyRegisterWidget($panel->getService(), $panel->getAppId());
} catch (Throwable $e) {
Expand All @@ -781,10 +782,11 @@ public function delegateDashboardPanelRegistrations(IManager $dashboardManager):
]);
}
}
$this->dashboardPanels = [];
}

public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void {
while (($registration = array_shift($this->eventListeners)) !== null) {
foreach ($this->eventListeners as $registration) {
try {
$eventDispatcher->addServiceListener(
$registration->getEvent(),
Expand All @@ -798,13 +800,14 @@ public function delegateEventListenerRegistrations(IEventDispatcher $eventDispat
]);
}
}
$this->eventListeners = [];
}

/**
* @param App[] $apps
*/
public function delegateContainerRegistrations(array $apps): void {
while (($registration = array_shift($this->services)) !== null) {
foreach ($this->services as $registration) {
$appId = $registration->getAppId();
if (!isset($apps[$appId])) {
// If we land here something really isn't right. But at least we caught the
Expand Down Expand Up @@ -832,8 +835,9 @@ public function delegateContainerRegistrations(array $apps): void {
]);
}
}
$this->services = [];

while (($registration = array_shift($this->aliases)) !== null) {
foreach ($this->aliases as $registration) {
$appId = $registration->getAppId();
if (!isset($apps[$appId])) {
// If we land here something really isn't right. But at least we caught the
Expand All @@ -857,8 +861,9 @@ public function delegateContainerRegistrations(array $apps): void {
]);
}
}
$this->aliases = [];

while (($registration = array_shift($this->parameters)) !== null) {
foreach ($this->parameters as $registration) {
$appId = $registration->getAppId();
if (!isset($apps[$appId])) {
// If we land here something really isn't right. But at least we caught the
Expand All @@ -882,6 +887,7 @@ public function delegateContainerRegistrations(array $apps): void {
]);
}
}
$this->parameters = [];
}

/**
Expand Down
Loading