Skip to content

Instantly share code, notes, and snippets.

@oxyc
Created July 26, 2023 00:28
Show Gist options
  • Save oxyc/d5f62c41b6ed87f743d33c1b3c5a5c30 to your computer and use it in GitHub Desktop.
Save oxyc/d5f62c41b6ed87f743d33c1b3c5a5c30 to your computer and use it in GitHub Desktop.
<?php
namespace App\Bootstrap;
use Illuminate\Config\Repository;
use Illuminate\Contracts\Foundation\Application;
use Roots\Acorn\Bootstrap\LoadConfiguration as RootsLoadConfiguration;
class LoadConfiguration extends RootsLoadConfiguration
{
/**
* {@inheritdoc}
*/
public function bootstrap(Application $app)
{
parent::bootstrap($app);
// When `wp acorn optimize` runs it will create a cached config.php file
// with pre-determined values at build times. This causes issues with
// multisite since the config.php file uses get_theme_file_path() which
// needs to be dynamically evaluated per site.
// Here we override the cached config by re-evaluating the config files.
$this->loadConfigurationFiles($app, $app->make('config'));
}
}
<?php
namespace App;
use App\Bootstrap\LoadConfiguration;
use Roots\Acorn\Bootstrap\LoadConfiguration as RootsLoadConfiguration;
add_filter('acorn/bootstrap', function (array $bootstrap) {
if ($idx = array_search(RootsLoadConfiguration::class, $bootstrap)) {
$bootstrap[$idx] = LoadConfiguration::class;
}
return $bootstrap;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment