mirror of
https://github.com/bjc/prosody.git
synced 2025-04-01 20:27:39 +03:00
Merge 13.0->trunk
This commit is contained in:
commit
244220453d
3 changed files with 31 additions and 30 deletions
|
@ -307,7 +307,8 @@ local function is_admin(jid, host)
|
|||
end
|
||||
log("warn", "Usage of legacy is_admin() API, which will be disabled in a future build: %s", debug.traceback());
|
||||
log("warn", "See https://prosody.im/doc/developers/permissions about the new permissions API");
|
||||
return legacy_admin_roles[get_jid_role(jid, host)] or false;
|
||||
local role = get_jid_role(jid, host);
|
||||
return role and legacy_admin_roles[role.name] or false;
|
||||
end
|
||||
|
||||
local function get_users_with_role(role, host)
|
||||
|
|
|
@ -866,38 +866,38 @@ local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore
|
|||
success,err = engine:transaction(function()
|
||||
return engine:execute(check_encoding_query, params.database,
|
||||
engine.charset, engine.charset.."_bin");
|
||||
end);
|
||||
if not success then
|
||||
module:log("error", "Failed to check/upgrade database encoding: %s", err or "unknown error");
|
||||
return false;
|
||||
end);
|
||||
if not success then
|
||||
module:log("error", "Failed to check/upgrade database encoding: %s", err or "unknown error");
|
||||
return false;
|
||||
end
|
||||
else
|
||||
local indices = {};
|
||||
engine:transaction(function ()
|
||||
if params.driver == "SQLite3" then
|
||||
for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do
|
||||
indices[row[1]] = true;
|
||||
end
|
||||
elseif params.driver == "PostgreSQL" then
|
||||
for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do
|
||||
indices[row[1]] = true;
|
||||
end
|
||||
end
|
||||
else
|
||||
local indices = {};
|
||||
engine:transaction(function ()
|
||||
if params.driver == "SQLite3" then
|
||||
for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do
|
||||
indices[row[1]] = true;
|
||||
end
|
||||
elseif params.driver == "PostgreSQL" then
|
||||
for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do
|
||||
indices[row[1]] = true;
|
||||
end
|
||||
end
|
||||
end)
|
||||
if indices["prosody_index"] then
|
||||
if apply_changes then
|
||||
local success = engine:transaction(function ()
|
||||
return assert(engine:execute([[DROP INDEX "prosody_index";]]));
|
||||
end);
|
||||
if not success then
|
||||
module:log("error", "Failed to delete obsolete index \"prosody_index\"");
|
||||
return false;
|
||||
end
|
||||
else
|
||||
changes = true;
|
||||
end)
|
||||
if indices["prosody_index"] then
|
||||
if apply_changes then
|
||||
local success = engine:transaction(function ()
|
||||
return assert(engine:execute([[DROP INDEX "prosody_index";]]));
|
||||
end);
|
||||
if not success then
|
||||
module:log("error", "Failed to delete obsolete index \"prosody_index\"");
|
||||
return false;
|
||||
end
|
||||
else
|
||||
changes = true;
|
||||
end
|
||||
end
|
||||
end
|
||||
return changes;
|
||||
end
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ describe("storagemanager", function ()
|
|||
end
|
||||
assert(hm.activate(test_host, {}));
|
||||
sm.initialize_host(test_host);
|
||||
assert(mm.load(test_host, "storage_"..backend_config.storage));
|
||||
mm.load(test_host, "storage_"..backend_config.storage);
|
||||
|
||||
describe("key-value stores", function ()
|
||||
-- These tests rely on being executed in order, disable any order
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue