diff --git a/src/AcfComposer.php b/src/AcfComposer.php index a48d57fb..a2b9be98 100644 --- a/src/AcfComposer.php +++ b/src/AcfComposer.php @@ -259,7 +259,7 @@ public function manifestExists(): bool public function cache(Composer $composer): bool { $manifest = $this->manifest() - ->put($composer::class, $composer->getFields()) + ->put($composer::class, $composer->getFields(cache: false)) ->all(); return file_put_contents( diff --git a/src/Composer.php b/src/Composer.php index dce9b8e2..98b3e78f 100644 --- a/src/Composer.php +++ b/src/Composer.php @@ -82,13 +82,13 @@ protected function register(?callable $callback = null): void /** * Retrieve the field group fields. */ - public function getFields(): array + public function getFields(bool $cache = true): array { - if ($this->fields) { + if ($this->fields && $cache) { return $this->fields; } - if ($this->composer->hasCache($this)) { + if ($cache && $this->composer->hasCache($this)) { return $this->composer->getCache($this); } diff --git a/src/Console/UpgradeCommand.php b/src/Console/UpgradeCommand.php index a578a93c..6b65db34 100644 --- a/src/Console/UpgradeCommand.php +++ b/src/Console/UpgradeCommand.php @@ -41,10 +41,12 @@ public function handle() $this->replacements = [ 'use StoutLogic\\AcfBuilder\\FieldsBuilder;' => 'use Log1x\\AcfComposer\\Builder;', + 'use Roots\\Acorn\\Application;' => 'use Log1x\\AcfComposer\\AcfComposer;', 'new FieldsBuilder(' => 'Builder::make(', 'public function enqueue($block)' => 'public function assets($block)', 'public function enqueue($block = [])' => 'public function assets($block)', 'public function enqueue()' => 'public function assets($block)', + 'public function __construct(Application $app)' => 'public function __construct(AcfComposer $composer)', '/->addFields\(\$this->get\((.*?)\)\)/' => fn ($match) => "->addPartial({$match[1]})", ];