Added export of core data, such as users, path_aliases, custom_values.

Added export of node revisions.
This commit is contained in:
2015-11-12 18:19:06 +01:00
parent a5973c9c8a
commit 79d30ee3a7
12 changed files with 298 additions and 15 deletions

View File

@@ -80,6 +80,12 @@ feature -- URL aliases
do
end
path_aliases: STRING_TABLE [READABLE_STRING_8]
-- <Precursor>.
do
create Result.make (0)
end
feature -- Logs
save_log (a_log: CMS_LOG)
@@ -116,5 +122,12 @@ feature -- Custom
end
end
custom_values: detachable LIST [TUPLE [name: READABLE_STRING_GENERAL; type: detachable READABLE_STRING_8; value: detachable READABLE_STRING_32]]
-- Values as list of [name, type, value].
do
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

View File

@@ -47,6 +47,11 @@ feature -- URL aliases
deferred
end
path_aliases: STRING_TABLE [READABLE_STRING_8]
-- All path aliases as a table containing sources indexed by alias.
deferred
end
feature -- Logs
save_log (a_log: CMS_LOG)
@@ -71,5 +76,12 @@ feature -- Misc
deferred
end
custom_values: detachable LIST [TUPLE [name: READABLE_STRING_GENERAL; type: detachable READABLE_STRING_8; value: detachable READABLE_STRING_32]]
-- Values as list of [name, type, value].
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

View File

@@ -127,6 +127,35 @@ feature -- URL aliases
sql_finalize
end
path_aliases: STRING_TABLE [READABLE_STRING_8]
-- All path aliases as a table containing sources indexed by alias.
local
l_source: READABLE_STRING_8
do
error_handler.reset
create Result.make (5)
sql_query (sql_select_all_path_alias, Void)
if not has_error then
from
sql_start
until
sql_after or has_error
loop
if attached sql_read_string (1) as s_src then
l_source := s_src
if attached sql_read_string (2) as s_alias then
Result.force (l_source, s_alias)
end
end
sql_forth
end
end
sql_finalize
end
sql_select_all_path_alias: STRING = "SELECT source, alias, lang FROM path_aliases;"
-- SQL select all path aliases.
sql_select_path_alias: STRING = "SELECT source FROM path_aliases WHERE alias=:alias ;"
-- SQL select path aliases.
@@ -251,6 +280,39 @@ feature -- Misc
sql_finalize
end
custom_values: detachable LIST [TUPLE [name: READABLE_STRING_GENERAL; type: detachable READABLE_STRING_8; value: detachable READABLE_STRING_32]]
-- Values as list of [name, type, value].
local
l_type, l_name: READABLE_STRING_8
l_value: READABLE_STRING_32
do
error_handler.reset
create {ARRAYED_LIST [TUPLE [name: READABLE_STRING_GENERAL; type: detachable READABLE_STRING_8; value: detachable READABLE_STRING_32]]} Result.make (5)
sql_query (sql_select_all_custom_values, Void)
if not has_error then
from
sql_start
until
sql_after or has_error
loop
if attached sql_read_string (1) as s_type then
l_type := s_type
if attached sql_read_string (2) as s_name then
l_name := s_name
if attached sql_read_string_32 (3) as s_value then
Result.force ([l_name, l_type, s_value])
end
end
end
sql_forth
end
end
sql_finalize
end
sql_select_all_custom_values: STRING = "SELECT type, name, value FROM custom_values;"
-- SQL Insert to add a new custom value.
sql_select_custom_value: STRING = "SELECT value FROM custom_values WHERE type=:type AND name=:name;"
-- SQL Insert to add a new custom value.

View File

@@ -829,6 +829,7 @@ feature {NONE} -- Implementation: User
end
fetch_user: detachable CMS_USER
-- Fetch user from fields: 1:uid, 2:name, 3:password, 4:salt, 5:email, 6:status, 7:created, 8:signed.
local
l_id: INTEGER_64
l_name: detachable READABLE_STRING_32
@@ -919,10 +920,10 @@ feature {NONE} -- Sql Queries: USER
Select_user_by_name: STRING = "SELECT * FROM users WHERE name =:name;"
-- Retrieve user by name if exists.
Sql_select_recent_users: STRING = "SELECT * FROM users ORDER BY uid DESC, created DESC LIMIT :rows OFFSET :offset ;"
Sql_select_recent_users: STRING = "SELECT uid, name, password, salt, email, status, created, signed FROM users ORDER BY uid DESC, created DESC LIMIT :rows OFFSET :offset ;"
-- Retrieve recent users
Select_user_by_email: STRING = "SELECT * FROM users WHERE email =:email;"
Select_user_by_email: STRING = "SELECT uid, name, password, salt, email, status, created, signed FROM users WHERE email =:email;"
-- Retrieve user by email if exists.
Select_salt_by_username: STRING = "SELECT salt FROM users WHERE name =:name;"