processwire / processwire-issues

ProcessWire issue reports.
45 stars 2 forks source link

Core should not show module download options that are not usable due to config #1492

Closed Toutouwai closed 1 year ago

Toutouwai commented 2 years ago

Short description of the issue

After updating a site to a more recent PW version I go to install a module from the modules directory...

2021-12-22_165906 2021-12-22_165710

...or I attempt to upgrade an existing module...

2021-12-22_165532

...and after clicking the download button I get this...

2021-12-22_165552

I understand why the message appears and what the solution is, but it's a bit aggravating to have the core show you download features that it "knows" you're not going to be able to use. When module installation is disallowed due the current $config settings the user should not see non-usable controls such as "Add Module From Directory" or "Download Now" buttons and ideally in their place should see some notice informing them that module download is not allowed.

Setup/Environment

ryancramerdesign commented 2 years ago

@Toutouwai The majority of users will never even know the option is there if we just suppress showing these actions. I think the current behavior is the right approach to ensure the options are known to the 90% of users that don't already know about the $config->moduleInstall setting. The purpose here is to ensure the user knows this option is built-in and also instruct them on how to enable it, and specifically at the time they want it (should they want it). What I think might be an improvement here though is for the error message to also have a “How to upgrade module manually” link with additional instructions, as maybe a beginner user might not realize the moduleInstall settings aren't required to upgrade the module.

Toutouwai commented 2 years ago

The majority of users will never even know the option is there if we just suppress showing these actions.

I don't want to hide those options from the user, I just want to be alerted that a $config setting is disallowing the options from being used as early in the procedure as possible. I don't want to go through the steps of...

  1. Typing a module classname
  2. Clicking the "Get Module Info" button
  3. Waiting for the module info to be retrieved from the remote modules directory, and waiting for a page reload
  4. Clicking the "Download Now" button
  5. Waiting for another page reload

...only to see an error message and not to achieve my objective of installing the module.

Instead I want to be alerted right at the start that a $config setting needs to be updated if I am to successfully download and install modules. My suggestion is that the "Get Module Info" button is disabled and an adjacent note is added about the $config setting. And a similar thing for when attempting to update an installed module.

jmartsch commented 2 years ago

I agree with Robins comment above

ryancramerdesign commented 1 year ago

@Toutouwai I'm not sure when it was added but I think we already have what you describe above. At least I just tried and this is what I get when all the moduleInstall options are disabled:

Screen Shot 2023-08-03 at 11 10 23 AM

A similar message appears after clicking the 'check for updates' link on any module.

Toutouwai commented 1 year ago

@ryancramerdesign, I took another look at this and the problem occurs when the directory option for $config->moduleInstall is true but not the download option.

When $config->moduleInstall features were introduced, the defaults were like this:

2023-08-04_114920

In more recent versions the directory option also defaults to debug, but the original settings can occur when this is in /site/config.php:

$config->moduleInstall('directory', true);

Now if $config->debug is false the user is presented with the "Add Module From Directory" field, as if this method of module installation will work.

2023-08-04_114506

And you can get to the next screen...

2023-08-04_114532

...but then if you click Download Now you get this:

2023-08-04_114556

So it's like the directory option can't actually work unless the download option is also true?

ryancramerdesign commented 1 year ago

Thanks @Toutouwai I see what you mean, I've pushed a fix for that.

Toutouwai commented 1 year ago

Thanks