Software / code / prosody
Comparison
plugins/mod_storage_sql.lua @ 11625:04abe65b8067
mod_storage_sql: Fix for move of yes/no function (Thanks Kasim)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 21 Jun 2021 17:31:17 +0200 |
| parent | 11354:10fba62332c5 |
| child | 11967:0f2b5182e80b |
comparison
equal
deleted
inserted
replaced
| 11624:1b7669c49459 | 11625:04abe65b8067 |
|---|---|
| 854 module:provides("storage", driver); | 854 module:provides("storage", driver); |
| 855 end | 855 end |
| 856 | 856 |
| 857 function module.command(arg) | 857 function module.command(arg) |
| 858 local config = require "core.configmanager"; | 858 local config = require "core.configmanager"; |
| 859 local prosodyctl = require "util.prosodyctl"; | 859 local hi = require "util.human.io"; |
| 860 local command = table.remove(arg, 1); | 860 local command = table.remove(arg, 1); |
| 861 if command == "upgrade" then | 861 if command == "upgrade" then |
| 862 -- We need to find every unique dburi in the config | 862 -- We need to find every unique dburi in the config |
| 863 local uris = {}; | 863 local uris = {}; |
| 864 for host in pairs(prosody.hosts) do -- luacheck: ignore 431/host | 864 for host in pairs(prosody.hosts) do -- luacheck: ignore 431/host |
| 869 for _, params in pairs(uris) do | 869 for _, params in pairs(uris) do |
| 870 print("", "["..params.driver.."] "..params.database..(params.host and " on "..params.host or "")); | 870 print("", "["..params.driver.."] "..params.database..(params.host and " on "..params.host or "")); |
| 871 end | 871 end |
| 872 print(""); | 872 print(""); |
| 873 print("Ensure you have working backups of the above databases before continuing! "); | 873 print("Ensure you have working backups of the above databases before continuing! "); |
| 874 if not prosodyctl.show_yesno("Continue with the database upgrade? [yN]") then | 874 if not hi.show_yesno("Continue with the database upgrade? [yN]") then |
| 875 print("Ok, no upgrade. But you do have backups, don't you? ...don't you?? :-)"); | 875 print("Ok, no upgrade. But you do have backups, don't you? ...don't you?? :-)"); |
| 876 return; | 876 return; |
| 877 end | 877 end |
| 878 -- Upgrade each one | 878 -- Upgrade each one |
| 879 for _, params in pairs(uris) do | 879 for _, params in pairs(uris) do |