[Plugin installer] Fix broken warning about outdated plugin updates in the user directory masking a newer core version

This commit is contained in:
Borys Jurgiel 2017-11-03 19:12:44 +01:00
parent 67b1cab3a1
commit fb7f8f17f7
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ class QgsPluginInstaller(QObject):
for key in repositories.allEnabled():
repositories.setRepositoryData(key, "state", 3)
# look for obsolete plugins (the user-installed one is newer than core one)
# look for obsolete plugins updates (the user-installed one is older than the core one)
for key in plugins.obsoletePlugins:
plugin = plugins.localCache[key]
msg = QMessageBox()
@ -93,7 +93,7 @@ class QgsPluginInstaller(QObject):
msg.setText("%s <b>%s</b><br/><br/>%s" % (self.tr("Obsolete plugin:"), plugin["name"], self.tr("QGIS has detected an obsolete plugin that masks its more recent version shipped with this copy of QGIS. This is likely due to files associated with a previous installation of QGIS. Do you want to remove the old plugin right now and unmask the more recent version?")))
msg.exec_()
if not msg.result():
# uninstall, update utils and reload if enabled
# uninstall the update, update utils and reload if enabled
self.uninstallPlugin(key, quiet=True)
updateAvailablePlugins()
settings = QgsSettings()

View File

@ -708,10 +708,10 @@ class Plugins(QObject):
# failedToLoad = settings.value("/PythonPlugins/watchDog/" + key) is not None
testLoadThis = testLoad and key not in qgis.utils.plugins
plugin = self.getInstalledPlugin(key, path=path, readOnly=readOnly, testLoad=testLoadThis)
self.localCache[key] = plugin
if key in list(self.localCache.keys()) and compareVersions(self.localCache[key]["version_installed"], plugin["version_installed"]) == 1:
# An obsolete plugin in the "user" location is masking a newer one in the "system" location!
self.obsoletePlugins += [key]
self.localCache[key] = plugin
except:
# it's not necessary to stop if one of the dirs is inaccessible
pass