Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disables some more feature if internet features are disabled #13076

Merged
merged 8 commits into from Jul 10, 2018
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Jun 18, 2018

We already added check at various places. This aims to complete it:

  • Disallow usage of Marketplace
  • Disables GeoIP Autoupdate tasks
  • Disables GeoLocation Auto Updater UI

Is anything still missing?

refs #6324

@sgiehl sgiehl added the Needs Review PRs that need a code review label Jun 18, 2018
@sgiehl sgiehl added this to the 3.6.0 milestone Jun 18, 2018
@diosmosis
Copy link
Member

Did a find usages of Http class and found some other possible candidates for this check:

CoreAdminHome\Tasks::updateSpammerBlacklist()
Referrers\Tasks::updateSocials()
Referrers\SearchEngines::updateSearchEngines()
maybe the MobileMessaging plugin?

Copy link
Member

@diosmosis diosmosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally works, even when a geoip autoupdate task was previously scheduled.

core/Piwik.php Outdated
public static function checkInternetConnectionAvailable()
{
if (!SettingsPiwik::isInternetEnabled()) {
throw new Exception('This feature requires an internet connection. Please check your config value for `enable_internet_features` if you want to use this feature.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be translated?

@diosmosis
Copy link
Member

Noticed that the 'Marketplace' link is displayed even if internet access is disabled:

image

Think we should remove it since it will never work?

@sgiehl
Copy link
Member Author

sgiehl commented Jun 22, 2018

CoreAdminHome\Tasks::updateSpammerBlacklist()
Referrers\Tasks::updateSocials()
Referrers\SearchEngines::updateSearchEngines()

Those tasks should already only be added when internet is enabled

@sgiehl
Copy link
Member Author

sgiehl commented Jun 22, 2018

regarding MobileMessaging and Marketplace: Wondering if we maybe should simply "deactivate" those plugins if internetfeatures are disabled.

@diosmosis
Copy link
Member

If they're deactivated, will they be activated when the setting is enabled? I guess we could just unload it at the start of a request, might have the same effect...

@sgiehl sgiehl force-pushed the nointernet branch 4 times, most recently from 4cd9d2e to fcccac8 Compare June 24, 2018 18:29
@sgiehl
Copy link
Member Author

sgiehl commented Jun 24, 2018

Marketplace and MobileMessaging plugins will now be dynamically removed from the list of activated plugins in each request if internet connection is disabled in config.

@diosmosis
Copy link
Member

@sgiehl thought of one more thing, would it be a good idea to mention if a plugin requires internet in the manage plugin page?

Btw @mattab some API/product changes were added here (new API to Plugin class and product change in that plugins requiring an internet connection are unloaded), can you provide your opinion?

@sgiehl
Copy link
Member Author

sgiehl commented Jun 25, 2018

@sgiehl thought of one more thing, would it be a good idea to mention if a plugin requires internet in the manage plugin page?

we could do so. But not sure about it, as other plugins require a working internet connection for some specific features as well. And that wouldn't be displayed then

@diosmosis
Copy link
Member

I was mostly thinking about the plugins that are unloaded, if there's no signal to the user anywhere that the plugins require enabling internet, maybe some users will think there's a bug. Do you think this is an issue?

@sgiehl
Copy link
Member Author

sgiehl commented Jun 25, 2018

The is a compatibility message shown when enable_internet_features is set to 0. See https://github.com/matomo-org/matomo/blob/c36f041fddf277478205675ff7efefbcc6d9cb38/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins_no_internet.png

If the features are enabled, but there is actually no internet connection available the will probably get various connection timeout errors

@diosmosis
Copy link
Member

Ah ok, that's what I was thinking about, then 👍 will approve

@sgiehl
Copy link
Member Author

sgiehl commented Jul 7, 2018

@mattab / @tsteur could someone else give a comment on:

diosmosis commented 12 days ago
Btw @mattab some API/product changes were added here (new API to Plugin class and product change in that plugins requiring an internet connection are unloaded), can you provide your opinion?

@mattab
Copy link
Member

mattab commented Jul 10, 2018

The new API & marking internet-requiring plugins in the Plugins overview look good to me 👍

@sgiehl sgiehl merged commit 4b88aa2 into 3.x-dev Jul 10, 2018
@sgiehl sgiehl deleted the nointernet branch July 10, 2018 19:44
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Aug 28, 2018
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
…org#13076)

* Disable GeoIP update tasks if no internet connection available

* Show GeoLocation Auto Updater UI only with enabled internet connection

* Throw exception if Marketplace is used without enabled internet features

* Hide Marketplace menu entry if internet is disabled

* Implements new plugin class method requiresInternetConnection, to automatically unloaded plugins if required

* Improve how plugins not working without internet connection are shown in plugin list

* Adds UI test

* typo 'whether'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants