Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize command uses the cached config even after it has been cleared #78

Closed
4 tasks done
stefanfisk opened this issue Nov 19, 2020 · 1 comment
Closed
4 tasks done

Comments

@stefanfisk
Copy link
Sponsor Contributor

Description

When running wp acorn optimize, the cached config is used even after clearing it. This causes the command for fail if for example the cached config contains paths that no longer exist. Running cache:clear before optimize works.

Steps to reproduce

  1. Run optimize
  2. Do as search-replace in /storage/framework/cache/data/config.php do replace the log paths with one that does not exist.
  3. Run optimize again

Expected behavior: [What you expect to happen]

The command would clear all caches, reload the config, and then generate new caches.

Actual behavior: [What actually happens]

The command would clear all caches, continues using the old cached config, and throws an unhandled exception when an invalid path is encountered.

Reproduces how often: [What percentage of the time does it reproduce?]

Every time.

Versions

PHP 7.4.3
Acorn v1.1.0
WordPress 5.5.3

Additional information

Here's the stack trace from the first error that happens for me. The stack trace printed on the console is different because it covers when the logger fails to initialise when trying to log this first exception.

Exception has occurred.
Symfony\Component\Finder\Exception\DirectoryNotFoundException: The "/srv/app/public-2/..//resources/views" directory does not exist.

Symfony\Component\Finder\Finder->in (/home/stefanfisk/projects/berghs/repo/vendor/symfony/finder/Finder.php:589)
Roots\Acorn\Console\Commands\ViewCacheCommand->bladeFilesIn (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:66)
Roots\Acorn\Console\Commands\ViewCacheCommand->Roots\Acorn\Console\Commands\{closure:/srv/app/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:34-36} (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:35)
Illuminate\Support\Collection->each (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/support/Traits/EnumeratesValues.php:202)
Roots\Acorn\Console\Commands\ViewCacheCommand->handle (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:36)
Illuminate\Container\BoundMethod::Illuminate\Container\{closure:/srv/app/vendor/illuminate/container/BoundMethod.php:35-37} (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:36)
Illuminate\Container\Util::unwrapIfClosure (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Util.php:37)
Illuminate\Container\BoundMethod::callBoundMethod (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:93)
Illuminate\Container\BoundMethod::call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:37)
Roots\Acorn\Application->call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Container.php:596)
Roots\Acorn\Console\Commands\ViewCacheCommand->execute (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:134)
Roots\Acorn\Console\Commands\ViewCacheCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Command/Command.php:258)
Roots\Acorn\Console\Commands\ViewCacheCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:121)
Roots\Acorn\Console\Commands\OptimizeCommand->runCommand (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Concerns/CallsCommands.php:56)
Roots\Acorn\Console\Commands\OptimizeCommand->call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Concerns/CallsCommands.php:28)
Roots\Acorn\Console\Commands\OptimizeCommand->handle (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/OptimizeCommand.php:29)
Illuminate\Container\BoundMethod::Illuminate\Container\{closure:/srv/app/vendor/illuminate/container/BoundMethod.php:35-37} (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:36)
Illuminate\Container\Util::unwrapIfClosure (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Util.php:37)
Illuminate\Container\BoundMethod::callBoundMethod (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:93)
Illuminate\Container\BoundMethod::call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:37)
Roots\Acorn\Application->call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Container.php:596)
Roots\Acorn\Console\Commands\OptimizeCommand->execute (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:134)
Roots\Acorn\Console\Commands\OptimizeCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Command/Command.php:258)
Roots\Acorn\Console\Commands\OptimizeCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:121)
Illuminate\Console\Application->doRunCommand (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Application.php:920)
Illuminate\Console\Application->doRun (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Application.php:266)
Illuminate\Console\Application->run (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Application.php:142)
Illuminate\Console\Application->run (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Application.php:93)
Roots\Acorn\Console\Kernel->handle (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Kernel.php:104)
Roots\Acorn\Bootstrap\Console->Roots\Acorn\Bootstrap\{closure:/srv/app/vendor/roots/acorn/src/Acorn/Bootstrap/Console.php:28-53} (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Bootstrap/Console.php:47)
call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100} (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100)
WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure:phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:95-102} (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100)
call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451} (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451)
WP_CLI\Dispatcher\Subcommand->invoke (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451)
WP_CLI\Runner->run_command (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:371)
WP_CLI\Runner->run_command_and_exit (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:394)
WP_CLI\Runner->start (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1160)
WP_CLI\Bootstrap\LaunchRunner->process (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23)
WP_CLI\bootstrap (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:74)
include (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:27)
include (/usr/local/bin/wp/php/boot-phar.php:11)
{main} (/usr/local/bin/wp:4)
@QWp6t
Copy link
Sponsor Member

QWp6t commented Feb 27, 2021

Fixed in #93 (ae48ef74)

@QWp6t QWp6t closed this as completed Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants