mirror of
https://github.com/getgrav/grav.git
synced 2026-03-22 20:41:39 +01:00
Fixed page initialization in CLI
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
* Added `ConsoleCommand::initializeThemes()`method to properly set up current theme to be used from CLI
|
||||
* Added `ConsoleCommand::initializePages()` method to properly set up pages to be used from CLI
|
||||
1. [](#bugfix)
|
||||
* Fixed `bin/plugin` CLI calling `$themes->init()` way too early
|
||||
* Fixed `bin/plugin` CLI calling `$themes->init()` way too early (removed it, use above methods instead)
|
||||
* Fixed call to `$grav['page']` crashing CLI
|
||||
* Fixed encoding problems when PHP INI setting `default_charset` is not `utf-8` [#2154](https://github.com/getgrav/grav/issues/2154)
|
||||
|
||||
# v1.6.20
|
||||
|
||||
@@ -26,6 +26,19 @@ class PagesServiceProvider implements ServiceProviderInterface
|
||||
return new Pages($c);
|
||||
};
|
||||
|
||||
if (GRAV_CLI) {
|
||||
$container['page'] = static function ($c) {
|
||||
$path = $c['locator']->findResource('system://pages/notfound.md');
|
||||
$page = new Page();
|
||||
$page->init(new \SplFileInfo($path));
|
||||
$page->routable(false);
|
||||
|
||||
return $page;
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$container['page'] = function ($c) {
|
||||
/** @var Grav $c */
|
||||
|
||||
|
||||
@@ -171,12 +171,6 @@ class ConsoleCommand extends Command
|
||||
$pages = $grav['pages'];
|
||||
$pages->init();
|
||||
$grav->fireEvent('onPagesInitialized', new Event(['pages' => $pages]));
|
||||
if (!isset($grav['page'])) {
|
||||
$page = new Page();
|
||||
$page->routable(false);
|
||||
$page->title('404 Not Found');
|
||||
$grav['page'] = $page;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user