Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Prevent ACF Composer from booting multiple times (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Mar 1, 2024
1 parent e108472 commit af6cd95
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/AcfComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class AcfComposer
*/
public $app;

/**
* The booted state.
*/
protected bool $booted = false;

/**
* The registered paths.
*/
Expand Down Expand Up @@ -82,6 +87,10 @@ public function handle(): void
*/
public function boot(): void
{
if ($this->booted()) {
return;
}

$this->registerDefaultPath();

foreach ($this->composers as $namespace => $composers) {
Expand All @@ -97,6 +106,8 @@ public function boot(): void
}

$this->deferredComposers = [];

$this->booted = true;
}

/**
Expand Down Expand Up @@ -220,4 +231,12 @@ public function manifest(): Manifest
{
return $this->manifest;
}

/**
* Determine if ACF Composer is booted.
*/
public function booted(): bool
{
return $this->booted;
}
}

0 comments on commit af6cd95

Please sign in to comment.