As designed Installing addon from dev output only works in CLI

Sim

Well-known member
Affected version
XF2.x
I have an addon in development on my XF2.0 dev machine which I wanted to test on XF2.1.

I cloned my addon's git repo to a new XF2.1b4 installation and checked out my develop branch which contains the _output directory (and no _data directory).

Next, I went to the addon section in the admin UI and clicked install next to the installable addon.

It gave me the usual warnings about development output and so I checked the "proceed" box and installed.

The installation said it was successful - but my addon wasn't working. On further investigation, I discovered that the code event listener (only thing this addon creates) was not installed. Importing the addon data from the CLI didn't help.

So to further test this, I created a new XF2.0 dev install, and cloned the git repo again, but this time I used the CLI to install the addon: xf-addon:install MyAddonId

This time the code event listener was created as expected. I went back and confirmed that installing on XF2.1 via CLI also worked.

So, on both XF2.0 and XF2.1b4 - installing an addon from dev output via the GUI does not work as expected, while installing it from the CLI does.

I get the feeling like we've had this conversation before (way back in XF2.0 beta territory) and that you're going to tell me that this is expected behaviour?:unsure:
 
It gave me the usual warnings about development output and so I checked the "proceed" box and installed.
Amusingly it's the actual warnings about development which imply that this is expected:
Development mode is enabled and dev output is available. If the add-on data has not been exported recently, it may be out of date and this action may cause data loss. Consider exporting first, or using a CLI command.

So, yeah, if it's a development version of the add-on then installing via the CLI is really your only option.
 
Okay fair enough - so long as I know the correct process, that's cool.

However, I am rather curious about what's different between the UI addon install process and the CLI addon install process given that one would assume that they do the same thing?
 
Amusingly it's the actual warnings about development which imply that this is expected
Honestly, I never read the warning message as "installing via the CLI is really your only option" either so I can understand the confusion.

Would it be possible to implement different versions of this message:
  1. If the addon is not currently installed, and if a _data directory is found, change the warning to "Consider installing via CLI using this command: xf-addon:install {$addOn.addon_id} instead."

  2. If the addon is currently installed, and if a _data directory is found, change the warning to "Consider exporting first, or update via CLI using this command: xf-addon:upgrade {$addOn.addon_id}"

  3. If the addon is not currently installed, and if no _data directory is found, instead display an error (i.e. refuse to install) saying "This add-on must be installed via CLI using this command: xf-addon:install {$addOn.addon_id}"

  4. If the addon is currently installed, and if no _data directory is found, instead display an error (i.e. refuse to upgrade) saying "This add-on must be upgraded via CLI using this command: xf-addon:upgrade {$addOn.addon_id}"
I realise it's a very specific scenario, but I don't think it's that much extra work and might help prevent some support tickets or bug reports like this one :)

I'd be happy to contribute the code changes needed if this is something you'd be interested in but can't justify the investment yourselves :)


Fillip
 
Okay fair enough - so long as I know the correct process, that's cool.

However, I am rather curious about what's different between the UI addon install process and the CLI addon install process given that one would assume that they do the same thing?
The code which handles importing the JSON files for development is only exposed in the development CLI commands.

Honestly, I never read the warning message as "installing via the CLI is really your only option" either so I can understand the confusion.

Would it be possible to implement different versions of this message:
  1. If the addon is not currently installed, and if a _data directory is found, change the warning to "Consider installing via CLI using this command: xf-addon:install {$addOn.addon_id} instead."

  2. If the addon is currently installed, and if a _data directory is found, change the warning to "Consider exporting first, or update via CLI using this command: xf-addon:upgrade {$addOn.addon_id}"

  3. If the addon is not currently installed, and if no _data directory is found, instead display an error (i.e. refuse to install) saying "This add-on must be installed via CLI using this command: xf-addon:install {$addOn.addon_id}"

  4. If the addon is currently installed, and if no _data directory is found, instead display an error (i.e. refuse to upgrade) saying "This add-on must be upgraded via CLI using this command: xf-addon:upgrade {$addOn.addon_id}"
I realise it's a very specific scenario, but I don't think it's that much extra work and might help prevent some support tickets or bug reports like this one :)

I'd be happy to contribute the code changes needed if this is something you'd be interested in but can't justify the investment yourselves :)


Fillip
Thanks for the offer but we're fine with it as it is.
 
Top Bottom