Changeset

6809:dd6b21862e3b

storagemanager: Check if drivers support purging, warn otherwise
author Kim Alvefur <zash@zash.se>
date Wed, 02 Sep 2015 15:26:28 +0200
parents 6808:f076dac78155
children 6810:533fd843d91f
files core/storagemanager.lua
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/storagemanager.lua	Wed Sep 02 14:25:30 2015 +0200
+++ b/core/storagemanager.lua	Wed Sep 02 15:26:28 2015 +0200
@@ -98,9 +98,14 @@
 	if type(storage) == "table" then
 		-- multiple storage backends in use that we need to purge
 		local purged = {};
-		for store, driver in pairs(storage) do
-			if not purged[driver] then
-				purged[driver] = get_driver(host, store):purge(user);
+		for store, driver_name in pairs(storage) do
+			if not purged[driver_name] then
+				local driver = get_driver(host, store);
+				if driver.purge then
+					purged[driver_name] = driver:purge(user);
+				else
+					log("warn", "Storage driver %s does not support removing all user data, you may need to delete it manually", driver_name);
+				end
 			end
 		end
 	end