Skip to content
Browse files

[plugins] When a user clicks the "Reload all repositories" button

manually in the plugin manager, then force a reload of the repositories
and don't rely on cached copies of the repo manifest

Otherwise it's not possible to force a refresh on certain types of
plugin repositories where it's not possible to modify the Cache-Control
attribute of the repo

Note that to avoid unnecessary server load, we still use cached
copies during startup and by default. It's only when a user explicitly
hits the "Reload all repositories" button that we force a non-cached

Fixes #34351
  • Loading branch information
nyalldawson committed May 28, 2020
1 parent 4eb10f2 commit 98603b78660e05334c7b34ea3722533164f9553b
Showing with 4 additions and 2 deletions.
  1. +1 −1 python/pyplugin_installer/
  2. +3 −1 python/pyplugin_installer/
@@ -119,7 +119,7 @@ def fetchAvailablePlugins(self, reloadMode):

for key in repositories.allEnabled():
if reloadMode or repositories.all()[key]["state"] == 3: # if state = 3 (error or not fetched yet), try to fetch once again
repositories.requestFetching(key, force_reload=reloadMode)

if repositories.fetchingInProgress():
fetchDlg = QgsPluginInstallerFetchingDialog(iface.mainWindow())
@@ -316,7 +316,7 @@ def load(self):

# ----------------------------------------- #
def requestFetching(self, key, url=None, redirectionCounter=0):
def requestFetching(self, key, url=None, redirectionCounter=0, force_reload=False):
""" start fetching the repository given by key """
self.mRepositories[key]["state"] = 1
if not url:
@@ -327,6 +327,8 @@ def requestFetching(self, key, url=None, redirectionCounter=0):
self.mRepositories[key]["QRequest"] = QNetworkRequest(url)
self.mRepositories[key]["QRequest"].setAttribute(QNetworkRequest.Attribute(QgsNetworkRequestParameters.AttributeInitiatorClass), "Relay")
self.mRepositories[key]["QRequest"].setAttribute(QNetworkRequest.FollowRedirectsAttribute, True)
if force_reload:
self.mRepositories[key]["QRequest"].setAttribute(QNetworkRequest.CacheLoadControlAttribute, QNetworkRequest.AlwaysNetwork)
authcfg = self.mRepositories[key]["authcfg"]
if authcfg and isinstance(authcfg, str):
if not QgsApplication.authManager().updateNetworkRequest(

0 comments on commit 98603b7

Please sign in to comment.
You can’t perform that action at this time.