From a1bac571f392b8680e10e97ebec54462ca2e9e73 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 26 Sep 2018 11:11:54 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#708 Modules refresh showing unnecessary error message --- wire/core/Modules.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/wire/core/Modules.php b/wire/core/Modules.php index 21da61f1..fc781bff 100644 --- a/wire/core/Modules.php +++ b/wire/core/Modules.php @@ -258,6 +258,14 @@ class Modules extends WireArray { */ protected $autoloadOrders = array(); + /** + * Are we currently refreshing? + * + * @var bool + * + */ + protected $refreshing = false; + /** * Properties that only appear in 'verbose' moduleInfo * @@ -1017,7 +1025,8 @@ class Modules extends WireArray { } else if($autoload) { $this->includeModuleFile($pathname, $basename); if(!($info['flags'] & self::flagsDisabled)) { - $module = $this->newModule($basename); + $module = $this->refreshing ? parent::get($basename) : null; + if(!$module) $module = $this->newModule($basename); } } } @@ -4143,11 +4152,13 @@ class Modules extends WireArray { if($this->wire('config')->systemVersion < 6) { return; } + $this->refreshing = true; $this->clearModuleInfoCache(); $this->loadModulesTable(); foreach($this->paths as $path) $this->findModuleFiles($path, false); foreach($this->paths as $path) $this->load($path); if($this->duplicates()->numNewDuplicates() > 0) $this->duplicates()->updateDuplicates(); // PR#1020 + $this->refreshing = false; } /**