Added error handler argument in CMS_STORAGE_BUILDER.storage (...) function.
Removed testing purpose code. Update debug module.
This commit is contained in:
@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature -- Factory
|
||||
|
||||
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_STORE_MYSQL
|
||||
storage (a_setup: CMS_SETUP; a_error_handler: ERROR_HANDLER): detachable CMS_STORAGE_STORE_MYSQL
|
||||
local
|
||||
conn: DATABASE_CONNECTION
|
||||
do
|
||||
@@ -40,6 +40,8 @@ feature -- Factory
|
||||
initialize (a_setup, Result)
|
||||
end
|
||||
end
|
||||
else
|
||||
a_error_handler.add_custom_error (0, "Could not connect to the MySQL storage", Void)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature -- Factory
|
||||
|
||||
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_STORE_ODBC
|
||||
storage (a_setup: CMS_SETUP; a_error_handler: ERROR_HANDLER): detachable CMS_STORAGE_STORE_ODBC
|
||||
local
|
||||
s: detachable STRING
|
||||
conn: detachable DATABASE_CONNECTION
|
||||
@@ -53,6 +53,8 @@ feature -- Factory
|
||||
initialize (a_setup, Result)
|
||||
end
|
||||
end
|
||||
else
|
||||
a_error_handler.add_custom_error (0, "Could not connect to the ODBC storage", Void)
|
||||
end
|
||||
else
|
||||
-- Wrong mapping between storage name and storage builder!
|
||||
|
||||
@@ -145,7 +145,7 @@ feature -- Access: storage
|
||||
attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (environment.application_config_path) as l_database_config and then
|
||||
attached storage_drivers.item (l_database_config.driver) as l_builder
|
||||
then
|
||||
Result := l_builder.storage (Current)
|
||||
Result := l_builder.storage (Current, a_error_handler)
|
||||
end
|
||||
else
|
||||
to_implement ("Workaround code, persistence layer does not implement yet this kind of error handling.")
|
||||
|
||||
@@ -71,6 +71,7 @@ feature -- Hooks
|
||||
create dbg.make
|
||||
create s.make_empty
|
||||
dbg.append_information_to (a_response.request, a_response.response, s)
|
||||
append_info_to ("Storage", a_response.api.storage.generator, a_response, s)
|
||||
create b.make ("debug-info", "Debug", s, a_response.formats.plain_text)
|
||||
a_response.add_block (b, "footer")
|
||||
end
|
||||
@@ -102,15 +103,17 @@ feature -- Handler
|
||||
-- append_info_to ("Base url", cms.base_url, r, s)
|
||||
-- append_info_to ("Script url", cms.script_url, r, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Site dir", api.setup.environment.path.utf_8_name, r, s)
|
||||
append_info_to ("Site dir", api.site_location.utf_8_name, r, s)
|
||||
append_info_to ("Www dir", api.setup.environment.www_path.utf_8_name, r, s)
|
||||
append_info_to ("Assets dir", api.setup.environment.assets_path.utf_8_name, r, s)
|
||||
append_info_to ("Config dir", api.setup.environment.config_path.utf_8_name, r, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Theme", api.setup.theme_name, r, s)
|
||||
append_info_to ("Theme location", api.setup.themes_location.utf_8_name, r, s)
|
||||
append_info_to ("Theme location", api.theme_location.utf_8_name, r, s)
|
||||
s.append ("<hr/>")
|
||||
-- append_info_to ("Files location", api...files_location.utf_8_name, r, s)
|
||||
append_info_to ("Files location", api.files_location.utf_8_name, r, s)
|
||||
append_info_to ("Modules location", api.modules_location.utf_8_name, r, s)
|
||||
append_info_to ("Storage", api.storage.generator, r, s)
|
||||
-- s.append ("<hr/>")
|
||||
|
||||
append_info_to ("Url", r.url ("/", Void), r, s)
|
||||
|
||||
@@ -11,9 +11,12 @@ deferred class
|
||||
|
||||
feature -- Factory
|
||||
|
||||
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE
|
||||
storage (a_setup: CMS_SETUP; a_error_handler: ERROR_HANDLER): detachable CMS_STORAGE
|
||||
-- CMS Storage object based on CMS setup `a_setup'.
|
||||
deferred
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -14,9 +14,12 @@ inherit
|
||||
|
||||
feature -- Factory
|
||||
|
||||
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_NULL
|
||||
storage (a_setup: CMS_SETUP; a_error_handler: ERROR_HANDLER): detachable CMS_STORAGE_NULL
|
||||
do
|
||||
create Result
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -59,37 +59,9 @@ feature -- Initialization
|
||||
l_authenticated_role.add_permission ("trash own page")
|
||||
a_storage.save_user_role (l_authenticated_role)
|
||||
|
||||
|
||||
--|-------------------------------------------|--
|
||||
--| For testing purpose, to be removed later. |--
|
||||
--|-------------------------------------------|--
|
||||
|
||||
-- Roles, view role for testing.
|
||||
create r.make ("view")
|
||||
r.add_permission ("view any page")
|
||||
a_storage.save_user_role (r)
|
||||
|
||||
create {ARRAYED_LIST [CMS_USER_ROLE]} l_roles.make (1)
|
||||
l_roles.force (r)
|
||||
|
||||
create u.make ("auth")
|
||||
u.set_password ("enticated#")
|
||||
u.set_email (a_setup.site_email)
|
||||
u.set_status ({CMS_USER}.active)
|
||||
a_storage.new_user (u)
|
||||
|
||||
create u.make ("test")
|
||||
u.set_password ("test#")
|
||||
u.set_email (a_setup.site_email)
|
||||
u.set_status ({CMS_USER}.active)
|
||||
a_storage.new_user (u)
|
||||
|
||||
create u.make ("view")
|
||||
u.set_password ("only#")
|
||||
u.set_email (a_setup.site_email)
|
||||
u.set_status ({CMS_USER}.active)
|
||||
u.set_roles (l_roles)
|
||||
a_storage.new_user (u)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -407,15 +407,12 @@ feature -- Environment/ theme
|
||||
Result := theme_location.extended ("assets")
|
||||
end
|
||||
|
||||
feature -- Environment/ module
|
||||
|
||||
feature -- Environment/ module
|
||||
|
||||
module_configuration_by_name (a_module_name: READABLE_STRING_GENERAL; a_name: detachable READABLE_STRING_GENERAL): detachable CONFIG_READER
|
||||
-- Configuration reader for `a_module', and if `a_name' is set, using name `a_name'.
|
||||
local
|
||||
p, l_path: detachable PATH
|
||||
l_name: READABLE_STRING_GENERAL
|
||||
p: detachable PATH
|
||||
do
|
||||
-- Search first in site/config/modules/$module_name/($app|$module_name).(json|ini)
|
||||
-- if none, look as sub configuration if $app /= Void
|
||||
|
||||
Reference in New Issue
Block a user