nocte
Well-known member
- Affected version
- 2.3.6
In certain situations on
According to my tests we need at least 1 folder inside
Result: If you build a release, if will contain orphaned data.
In what situations does this happen?
If you work with other developers (e.g. on Github) and you pull a commit, where a folder inside
The removal may happen, if there used to be 1 widget definition (or other thing, like a route, ..) and this was removed via admin cp. The only file left in the folder is then
How to reproduce:
Expected behavior: The widget definition should be removed.
TL;DR: It seems that XF only loops through exiting folders inside
Solution: XF should loop through all possible folders inside
xf-addon:upgrade
or xf-dev:import
XF does not remove orphaned data from the database (data, that was removed from the _output
folder).According to my tests we need at least 1 folder inside
_output
(e.g. phrases
). If another folder (e.g. widget_definitions
) is deleted, XF does completely ignore that fact on upgrade or import and just skips removing any (in this case) widget definitions from the database.Result: If you build a release, if will contain orphaned data.
In what situations does this happen?
If you work with other developers (e.g. on Github) and you pull a commit, where a folder inside
_output
has been removed, you may face this problem.The removal may happen, if there used to be 1 widget definition (or other thing, like a route, ..) and this was removed via admin cp. The only file left in the folder is then
_metadata.json
, which is often ignored via .gitignore
. And empty folders are not pushed to Github.How to reproduce:
- Create a dummy add-on:
php cmd.php xf-addon:create
. - Create a widget definition (just use
XF\Widget\Hmtl
as class for testing purpose). You will now have aphrases
and awidget_definitions
folder in your_output
folder. - Delete the
widget_positions
folder. - Run
php cmd.php xf-addon:upgrade Test/Addon --force
.
Expected behavior: The widget definition should be removed.
TL;DR: It seems that XF only loops through exiting folders inside
_output
, when doing an import/upgrade. If a folder is missing, XF does not remove the data belonging to the missing folder. Only exception: If there's not a single folders inside _output
, everything seems to be removed and this problem does not occur.Solution: XF should loop through all possible folders inside
_output
(not only the existing ones) on import/upgrade and if one does not exist remove all data connected to that folder.
Last edited: