Repository navigation
N°10151 - Missing extension.xml in extension disturb setup - #1067
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation and regression coverage are sound, with only a minor PHPDoc correction noted.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Enables setup to discover extensions without extension.xml by scanning module definitions.
Changes:
- Reuses recursive extension-map scanning for directory discovery.
- Handles missing optional documentation URLs.
- Adds coverage for XML and module-only extensions.
| File | Description |
|---|---|
setup/extensionsmap.class.inc.php |
Adds scan-free maps and module-based discovery. |
tests/php-unit-tests/unitary-tests/setup/ExtensionsMapTest.php |
Tests XML and XML-less extension layouts. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| } | ||
| $oiTopExtensionsMap = new iTopExtensionsMap(bNoScan: true); | ||
| $oiTopExtensionsMap->ReadDir($sSearchDir, iTopExtension::SOURCE_REMOTE, bIsRootDir: true); |
|
| } | ||
| } | ||
| $oiTopExtensionsMap = new iTopExtensionsMap(bNoScan: true); | ||
| $oiTopExtensionsMap->ReadDir($sSearchDir, iTopExtension::SOURCE_REMOTE, bIsRootDir: true); |
There was a problem hiding this comment.
Extension subdirectories can be skipped If a
-modules directory contains a module.*.php file alongside extension subdirectories, ReadDir returns after reading the module and never visits those subdirectories. The previous scan still read their extension.xml files. Their codes can therefore be missing when hub deployment determines which extensions to add, causing a selected extension to be omitted.
| } | ||
| } | ||
| $oiTopExtensionsMap = new iTopExtensionsMap(bNoScan: true); | ||
| $oiTopExtensionsMap->ReadDir($sSearchDir, iTopExtension::SOURCE_REMOTE, bIsRootDir: true); |
There was a problem hiding this comment.
| foreach ($oiTopExtensionsMap->aExtensionsByCode as $sCode => $oExtension) { | ||
| /** @var iTopExtension $oExtension */ | ||
| $aRes[$sCode] = $oExtension->sLabel; |
There was a problem hiding this comment.
Hidden modules become compilation choices When a module-only directory contains a module marked
visible => false or auto_select, ReadDir adds it to the map but this loop returns its code without checking visibility. Hub compilation then treats that code as an added extension, despite the module being marked as one that should not be offered for selection.
|
What is an extension disturb setup? |
|
@odain-cbd what is disturb setup? iTop upgrade via designer failed with badly packaged extensions. there are further usecases covered and documented in current PR new test. |
| // should be done at the end | ||
| parent::__construct($oWizard, $sCurrentState, false); | ||
|
|
||
| $this->oExtensionsMap = iTopExtensionsMap::GetExtensionsMap($this->oRuntimeEnv->GetBuildEnv()); |
There was a problem hiding this comment.
Current remote modules disappear
When a user clicks “Keep current choices,” the build directory has not been prepared yet. This line scans data/production-build-modules rather than data/production-modules. If the build directory is absent, remote extensions disappear from the choices, and selected_modules is overwritten without their modules before the audit starts. The later file copy cannot restore that selection. Use the final environment for this shortcut, or prepare the build files before scanning them.
| // should be done at the end | ||
| parent::__construct($oWizard, $sCurrentState, false); | ||
|
|
||
| $this->oExtensionsMap = iTopExtensionsMap::GetExtensionsMap($this->oRuntimeEnv->GetBuildEnv()); |
There was a problem hiding this comment.
Missing extensions go unnoticed
Replacing oExtensionsMap after the parent constructor drops the installed-extension records that LoadChoicesFromDatabase just loaded. Even when the build files exist, the replacement map has no record of installed extensions missing from disk. “Keep current choices” therefore skips the missing-extension check instead of returning the user to the choices screen. Load the database choices into the replacement map before using it.
|
|
||
| // First check if there is an extension.xml file in this directory | ||
| if (is_readable($sSearchDir.'/extension.xml')) { | ||
| if ($sParentExtensionId === null && is_readable($sSearchDir.'/extension.xml')) { |
There was a problem hiding this comment.
Nested modules lose their parent
Ignoring a child extension.xml leaves that call’s sExtensionId as null. If the child contains its modules in subdirectories, line 387 passes that null to them. They become standalone extensions instead of joining the outer extension. The outer extension can then have no modules, which makes setup throw “does not have any module associated.” Preserve the inherited parent ID when recursing through an ignored child definition.
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
* N°10151 - Missing extension.xml in extension disturb setup * N°10151 - Missing extension.xml in extension disturb setup * N°10151 - add weird usecase with multi xml files in same extension * N°10151 - fix module not installed after MTP * N°10151 - fix broken extension with further extension.xml * N°10151 - code style
|
@odain-cbd why do you ignore me like this? This is disturbing.. Edit: wait, are we now communicating by editing other people's comments? This is even more disturbing.. I still don't understand what you mean with "extension disturb setup" in your title? |
I think/hope this is a mistake from @odain-cbd as his edit looks like a reply to your question. I'll talk about it with him this afternoon (he's off this morning) |
first i don't ignore you. editing your question was a mistake through github app. because indeed i was trying to answer... sorry for that. my answer was: |
* N°10151 - Missing extension.xml in extension disturb setup * N°10151 - Missing extension.xml in extension disturb setup * N°10151 - add weird usecase with multi xml files in same extension * N°10151 - fix module not installed after MTP * N°10151 - fix broken extension with further extension.xml * N°10151 - code style

No description provided.