mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-06-16 09:02:52 +00:00
Fix a bug of web assets file joomla.asset.json registration/parsing (#41431)
* Make sure that all registry files parsed * Make sure that all registry files parsed ---------
This commit is contained in:
parent
e28916314a
commit
0b6137699f
|
@ -155,6 +155,9 @@ class WebAssetRegistry implements WebAssetRegistryInterface, DispatcherAwareInte
|
|||
$this->assets[$type] = [];
|
||||
}
|
||||
|
||||
// Check if any new file was added
|
||||
$this->parseRegistryFiles();
|
||||
|
||||
$eventChange = 'new';
|
||||
$eventAsset = $asset;
|
||||
|
||||
|
@ -183,6 +186,9 @@ class WebAssetRegistry implements WebAssetRegistryInterface, DispatcherAwareInte
|
|||
*/
|
||||
public function remove(string $type, string $name): WebAssetRegistryInterface
|
||||
{
|
||||
// Check if any new file was added
|
||||
$this->parseRegistryFiles();
|
||||
|
||||
if (!empty($this->assets[$type][$name])) {
|
||||
$asset = $this->assets[$type][$name];
|
||||
|
||||
|
@ -206,6 +212,9 @@ class WebAssetRegistry implements WebAssetRegistryInterface, DispatcherAwareInte
|
|||
*/
|
||||
public function exists(string $type, string $name): bool
|
||||
{
|
||||
// Check if any new file was added
|
||||
$this->parseRegistryFiles();
|
||||
|
||||
return !empty($this->assets[$type][$name]);
|
||||
}
|
||||
|
||||
|
@ -332,7 +341,11 @@ class WebAssetRegistry implements WebAssetRegistryInterface, DispatcherAwareInte
|
|||
return;
|
||||
}
|
||||
|
||||
foreach ($this->dataFilesNew as $path) {
|
||||
$paths = $this->dataFilesNew;
|
||||
|
||||
$this->dataFilesNew = [];
|
||||
|
||||
foreach ($paths as $path) {
|
||||
// Parse only if the file was not parsed already
|
||||
if (empty($this->dataFilesParsed[$path])) {
|
||||
$this->parseRegistryFile($path);
|
||||
|
@ -340,9 +353,6 @@ class WebAssetRegistry implements WebAssetRegistryInterface, DispatcherAwareInte
|
|||
// Mark the file as parsed
|
||||
$this->dataFilesParsed[$path] = $path;
|
||||
}
|
||||
|
||||
// Remove the file from queue
|
||||
unset($this->dataFilesNew[$path]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user