1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 01:34:31 +02:00

Fix issue processwire/processwire-issues#708 Modules refresh showing unnecessary error message

This commit is contained in:
Ryan Cramer
2018-09-26 11:11:54 -04:00
parent 42511ebb77
commit a1bac571f3

View File

@@ -258,6 +258,14 @@ class Modules extends WireArray {
*/ */
protected $autoloadOrders = array(); protected $autoloadOrders = array();
/**
* Are we currently refreshing?
*
* @var bool
*
*/
protected $refreshing = false;
/** /**
* Properties that only appear in 'verbose' moduleInfo * Properties that only appear in 'verbose' moduleInfo
* *
@@ -1017,7 +1025,8 @@ class Modules extends WireArray {
} else if($autoload) { } else if($autoload) {
$this->includeModuleFile($pathname, $basename); $this->includeModuleFile($pathname, $basename);
if(!($info['flags'] & self::flagsDisabled)) { 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) { if($this->wire('config')->systemVersion < 6) {
return; return;
} }
$this->refreshing = true;
$this->clearModuleInfoCache(); $this->clearModuleInfoCache();
$this->loadModulesTable(); $this->loadModulesTable();
foreach($this->paths as $path) $this->findModuleFiles($path, false); foreach($this->paths as $path) $this->findModuleFiles($path, false);
foreach($this->paths as $path) $this->load($path); foreach($this->paths as $path) $this->load($path);
if($this->duplicates()->numNewDuplicates() > 0) $this->duplicates()->updateDuplicates(); // PR#1020 if($this->duplicates()->numNewDuplicates() > 0) $this->duplicates()->updateDuplicates(); // PR#1020
$this->refreshing = false;
} }
/** /**