Old plugins cleanup (#12932)
Some checks are pending
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Waiting to run
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Waiting to run

* Remove OBSOLETE_PLUGINS table.
* Remove old plugins.
* exporter: remove old settings migration
This commit is contained in:
Martín Fernández
2025-03-18 20:28:25 +01:00
committed by GitHub
parent d106336a79
commit fbe2e452f1
3 changed files with 14 additions and 48 deletions

View File

@@ -5,19 +5,6 @@ local _ = require("gettext")
local DEFAULT_PLUGIN_PATH = "plugins"
-- plugin names that were removed and are no longer available.
local OBSOLETE_PLUGINS = {
autofrontlight = true,
backgroundrunner = true,
calibrecompanion = true,
evernote = true,
goodreads = true,
kobolight = true,
send2ebook = true,
storagestat = true,
zsync = true,
}
local DEPRECATION_MESSAGES = {
remove = _("This plugin is unmaintained and will be removed soon."),
feature = _("The following features are unmaintained and will be removed soon:"),
@@ -98,10 +85,6 @@ function PluginLoader:_discover()
if type(plugins_disabled) ~= "table" then
plugins_disabled = {}
end
-- disable obsolete plugins
for element in pairs(OBSOLETE_PLUGINS) do
plugins_disabled[element] = true
end
local discovered = {}
local lookup_path_list = { DEFAULT_PLUGIN_PATH }
@@ -232,9 +215,7 @@ function PluginLoader:genPluginManagerSubItem()
for _, plugin in ipairs(disabled_plugins) do
local element = getMenuTable(plugin)
element.enable = false
if not OBSOLETE_PLUGINS[element.name] then
table.insert(self.all_plugins, element)
end
table.insert(self.all_plugins, element)
end
table.sort(self.all_plugins, function(v1, v2) return v1.fullname < v2.fullname end)

View File

@@ -856,5 +856,18 @@ if last_migration_date < 20250302 then
end
end
-- 20250318, Remove obsolete plugins
-- https://github.com/koreader/koreader/pull/12932
if last_migration_date < 20250318 then
logger.info("Performing one-time migration for 20250318")
local base = DataStorage:getDataDir() .. "/plugins/"
local old_plugins = { "autofrontlight", "backgroundrunner", "calibrecompanion",
"evernote", "goodreads", "kobolight", "send2ebook", "storagestat", "zsync" }
for _, v in ipairs(old_plugins) do
ffiUtil.purgeDir(base .. v .. ".koplugin")
end
end
-- We're done, store the current migration date
G_reader_settings:saveSetting("last_migration_date", CURRENT_MIGRATION_DATE)

View File

@@ -40,33 +40,6 @@ local T = require("ffi/util").template
local logger = require("logger")
local _ = require("gettext")
-- migrate settings from old "evernote.koplugin" or from previous (monolithic) "exporter.koplugin"
local function migrateSettings()
-- these are for legacy formats. Don't add new targets here.
local formats = { "html", "joplin", "json", "readwise", "text" }
local settings = G_reader_settings:readSetting("exporter")
if not settings then
settings = G_reader_settings:readSetting("evernote")
end
if type(settings) == "table" then
for _, fmt in ipairs(formats) do
if type(settings[fmt]) == "table" then return end
end
local new_settings = {}
for _, fmt in ipairs(formats) do
new_settings[fmt] = { enabled = false }
end
new_settings["joplin"].ip = settings.joplin_IP
new_settings["joplin"].port = settings.joplin_port
new_settings["joplin"].token = settings.joplin_token
new_settings["readwise"].token = settings.readwise_token
G_reader_settings:saveSetting("exporter", new_settings)
end
end
-- update clippings from history clippings
local function updateHistoryClippings(clippings, new_clippings)
for title, booknotes in pairs(new_clippings) do
@@ -134,7 +107,6 @@ local Exporter = WidgetContainer:extend{
}
function Exporter:init()
migrateSettings()
self.parser = MyClipping:new{}
self.targets = genExportersTable(self.path)
self.ui.menu:registerToMainMenu(self)