mirror of
https://github.com/getgrav/grav.git
synced 2026-05-13 02:57:08 +02:00
Address errors in CLI when accidentally initializing twice
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
* Fixed `print_r()` in twig
|
||||
* Fixed sorting by groups in `Flex Users`
|
||||
* Changing `Flex Page` template causes the other language versions of that page to lose their content [admin#1958](https://github.com/getgrav/grav-plugin-admin/issues/1958)
|
||||
* Fixed plugins getting intialized multiple times (by CLI commands for example)
|
||||
|
||||
# v1.7.0-rc.17
|
||||
## 10/07/2020
|
||||
|
||||
@@ -30,6 +30,8 @@ class Plugins extends Iterator
|
||||
/** @var array */
|
||||
public $formFieldTypes;
|
||||
|
||||
private $plugins_initialized = false;
|
||||
|
||||
/**
|
||||
* Plugins constructor.
|
||||
*/
|
||||
@@ -108,6 +110,10 @@ class Plugins extends Iterator
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if ($this->plugins_initialized) {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
$grav = Grav::instance();
|
||||
|
||||
/** @var Config $config */
|
||||
@@ -134,6 +140,8 @@ class Plugins extends Iterator
|
||||
$event = new PluginsLoadedEvent($grav, $this);
|
||||
$grav->dispatchEvent($event);
|
||||
|
||||
$this->plugins_initialized = true;
|
||||
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user