Skip to content

Commit

Permalink
Use locator to find routerCacheFile
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Jan 27, 2019
1 parent 1d2d5d1 commit 0e29f17
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
- Sprinkle list in the bakery `debug` command to uses the new `sprinkle:list` table
- `routerCacheFile` config now only contains filename. Locator is used to find the full path

### Fix
- Fix for `Test` Bakery command
Expand Down
2 changes: 1 addition & 1 deletion app/sprinkles/core/config/production.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Use router cache, disable full error details
*/
'settings' => [
'routerCacheFile' => \UserFrosting\ROOT_DIR . '/' . \UserFrosting\APP_DIR_NAME . '/' . \UserFrosting\CACHE_DIR_NAME . '/' . 'routes.cache',
'routerCacheFile' => 'routes.cache',
'displayErrorDetails' => false
],
/*
Expand Down
3 changes: 2 additions & 1 deletion app/sprinkles/core/src/Bakery/ClearCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
// Clear router cache
$this->io->writeln('<info> > Clearing Router cache file</info>', OutputInterface::VERBOSITY_VERBOSE);
if (!$this->clearRouterCache()) {
$file = $this->ci->config['settings.routerCacheFile'];
$filename = $this->ci->config['settings.routerCacheFile'];
$file = $this->ci->locator->findResource("cache://$filename", true, true);
$this->io->error("Failed to delete Router cache file. Make sure you have write access to the `$file` file.");
exit(1);
}
Expand Down
3 changes: 2 additions & 1 deletion app/sprinkles/core/src/ServicesProvider/ServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ public function register(ContainerInterface $container)
$container['router'] = function ($c) {
$routerCacheFile = false;
if (isset($c->config['settings.routerCacheFile'])) {
$routerCacheFile = $c->config['settings.routerCacheFile'];
$filename = $c->config['settings.routerCacheFile'];
$routerCacheFile = $c->locator->findResource("cache://$filename", true, true);
}

return (new Router())->setCacheFile($routerCacheFile);
Expand Down

0 comments on commit 0e29f17

Please sign in to comment.