mirror of
https://github.com/processwire/processwire.git
synced 2025-08-16 03:34:33 +02:00
Some updates in Modules class to improve refresh reporting
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
* in order to save resources. As a result, anything iterating through these Modules should check to make sure it's not a ModulePlaceholder
|
* in order to save resources. As a result, anything iterating through these Modules should check to make sure it's not a ModulePlaceholder
|
||||||
* before using it. If it's a ModulePlaceholder, then the real Module can be instantiated/retrieved by $modules->get($className).
|
* before using it. If it's a ModulePlaceholder, then the real Module can be instantiated/retrieved by $modules->get($className).
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2019 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2021 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* #pw-summary Loads and manages all modules in ProcessWire.
|
* #pw-summary Loads and manages all modules in ProcessWire.
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
* @todo Move all module information methods to a ModulesInfo class
|
* @todo Move all module information methods to a ModulesInfo class
|
||||||
* @todo Move all module loading methods to a ModulesLoad class
|
* @todo Move all module loading methods to a ModulesLoad class
|
||||||
*
|
*
|
||||||
* @method void refresh() Refresh the cache that stores module files by recreating it
|
* @method void refresh($showMessages = false) Refresh the cache that stores module files by recreating it
|
||||||
* @method null|Module install($class, $options = array())
|
* @method null|Module install($class, $options = array())
|
||||||
* @method bool|int delete($class)
|
* @method bool|int delete($class)
|
||||||
* @method bool uninstall($class)
|
* @method bool uninstall($class)
|
||||||
@@ -4285,13 +4285,13 @@ class Modules extends WireArray {
|
|||||||
*
|
*
|
||||||
* #pw-group-manipulation
|
* #pw-group-manipulation
|
||||||
*
|
*
|
||||||
|
* @param bool $showMessages Show notification messages about what was found? (default=false) 3.0.172+
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function ___refresh() {
|
public function ___refresh($showMessages = false) {
|
||||||
if($this->wire('config')->systemVersion < 6) {
|
if($this->wire()->config->systemVersion < 6) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->refreshing = true;
|
$this->refreshing = true;
|
||||||
$this->clearModuleInfoCache();
|
$this->clearModuleInfoCache($showMessages);
|
||||||
$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);
|
||||||
@@ -4300,7 +4300,7 @@ class Modules extends WireArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias of refresh method for backwards compatibility
|
* Alias of refresh() method for backwards compatibility
|
||||||
*
|
*
|
||||||
* #pw-internal
|
* #pw-internal
|
||||||
*
|
*
|
||||||
@@ -4761,10 +4761,10 @@ class Modules extends WireArray {
|
|||||||
/**
|
/**
|
||||||
* Clear the module information cache
|
* Clear the module information cache
|
||||||
*
|
*
|
||||||
* @param bool|null $showMessages Specify false to suppress messages, true to report them, or null to auto-detect
|
* @param bool|null $showMessages Specify true to show message notifications
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function clearModuleInfoCache($showMessages = null) {
|
protected function clearModuleInfoCache($showMessages = false) {
|
||||||
|
|
||||||
$cache = $this->wire()->cache;
|
$cache = $this->wire()->cache;
|
||||||
$versionChanges = array();
|
$versionChanges = array();
|
||||||
@@ -4841,11 +4841,6 @@ class Modules extends WireArray {
|
|||||||
|
|
||||||
$this->updateModuleVersionsCache();
|
$this->updateModuleVersionsCache();
|
||||||
|
|
||||||
if($showMessages === null) {
|
|
||||||
$user = $this->wire()->user;
|
|
||||||
$showMessages = ($user && $user->isSuperuser()) || $this->wire()->process == 'ProcessModule';
|
|
||||||
}
|
|
||||||
|
|
||||||
// report detected changes
|
// report detected changes
|
||||||
$sanitizer = $this->wire()->sanitizer;
|
$sanitizer = $this->wire()->sanitizer;
|
||||||
$reports = array(
|
$reports = array(
|
||||||
|
Reference in New Issue
Block a user