我剛剛經歷了一個類似的從MCMS 2002(遷移到Wordpress)導出內容頁面的過程。
我不是說這是獲取數據的100%正確方法,但它對我有用。
下面是我已經採取的從數據庫中獲取頁面內容的過程。
正如你已經看到存儲的大部分數據都是Node
和NodePlaceholderContent
1)爲了得到一個什麼樣的Node
表保存您可以查看按類型組織內容的想法表
SELECT
[Type]
,CASE [Type]
WHEN 1 THEN 'Server'
WHEN 4 THEN 'Channel'
WHEN 16 THEN 'Post/Page'
WHEN 64 THEN 'Resource Gallery'
WHEN 256 THEN 'Resource Gallery Item (images/documents)'
WHEN 16384 THEN 'Template Gallery'
WHEN 65536 THEN 'Template' END as [Description]
,COUNT([Type]) as [Count]
FROM dbo.Node
GROUP BY [Type]
ORDER BY [Count] DESC
2)頁面(和帖子,將覆蓋帖子進一步下跌)是類型= 16 ...但得到的只是網頁(而不是職位),我們需要通過IsShortcut = 0
SELECT * FROM dbo.Node WHERE [Type] = 16 AND IsShortcut = 0
過濾
3)我只是想發佈的網頁,所以過濾器由ApprovalStatus = 1
-- Get all published pages
SELECT *
FROM dbo.Node WHERE [Type] = 16
AND IsShortcut = 0
AND ApprovalStatus = 1
4)接下來,確定創建/頁由修改(與用戶名)
-- Get published pages & author/editor
SELECT
[page].Id
,[page].NodeGuid
,[page].Name
,[created].Username as 'CreatedBy'
,[page].CreatedWhen
,[modified].Username as 'ModifiedBy'
,[page].ModifiedWhen
FROM dbo.Node [page]
-- add JOIN on created by user
INNER JOIN dbo.ClientAccount [created] ON [created].UserId = [page].CreatedByUserId
-- add JOIN on modified by user
INNER JOIN dbo.ClientAccount [modified] ON [modified].UserId = [page].ModifiedByUserId
WHERE [Type] = 16
AND IsShortcut = 0
AND ApprovalStatus = 1
5)接下來,找出其中的層次結構,我們通過使用Node.ParentGUID
列
SELECT
[page].Id
,[page].NodeGuid
,[page].Name
,[pageParent].Name -- add page parent Name
,[created].Username as 'CreatedBy'
,[page].CreatedWhen
,[modified].Username as 'ModifiedBy'
,[page].ModifiedWhen
FROM dbo.Node [page]
INNER JOIN dbo.ClientAccount [created] ON [created].UserId = [page].CreatedByUserId
INNER JOIN dbo.ClientAccount [modified] ON [modified].UserId = [page].ModifiedByUserId
-- add JOIN on Node using ParentGUID
INNER JOIN dbo.Node [pageParent] ON [pageParent].NodeGUID = [page].ParentGUID
WHERE [page].[Type] = 16
AND [page].IsShortcut = 0
AND [page].ApprovalStatus = 1
該查詢,讓我知道,網頁要麼p中arent節點Folders
或Archive Folder
6。)轉到再升一級(獲得母公司的母公司)
SELECT
[page].Id
,[page].NodeGuid
,[page].Name
,[pageParent].Name
,[pageParent2].Name -- add parent of parent name
,[created].Username as 'CreatedBy'
,[page].CreatedWhen
,[modified].Username as 'ModifiedBy'
,[page].ModifiedWhen
FROM dbo.Node [page]
INNER JOIN dbo.ClientAccount [created] ON [created].UserId = [page].CreatedByUserId
INNER JOIN dbo.ClientAccount [modified] ON [modified].UserId = [page].ModifiedByUserId
INNER JOIN dbo.Node [pageParent] ON [pageParent].NodeGUID = [page].ParentGUID
-- add another JOIN on Node using ParentGUID (parent of parent)
INNER JOIN dbo.Node [pageParent2] ON [pageParent2].NodeGUID = [pageParent].ParentGUID
WHERE [page].[Type] = 16
AND [page].IsShortcut = 0
AND [page].ApprovalStatus = 1
母公司的母公司爲Server
(根級別),所以現在我的結論是,如果頁面的父:
Folders
- 那麼這就是活動頁面
Archive Folder
- 那麼這就是另一個頁面的先前版本中
我只是想活動頁面所以我要加入在Folders
父母只有
7.)現在如何標記。在我們的MCMS模板中,只有一個佔位符區域。 NodePlaceholder
表將標識佔位符的名稱,如果您的模板中有多個佔位符區域,則該名稱是有用的。爲了簡單起見,我只想加入NodePlaceholdercontent
。
SELECT
[page].Id
,[page].NodeGuid
,[page].Name
/* remove parent names */
,[created].Username as 'CreatedBy'
,[page].CreatedWhen
,[modified].Username as 'ModifiedBy'
,[page].ModifiedWhen
,html.PropValue as 'HTML' -- add the markup
FROM dbo.Node [page]
INNER JOIN dbo.ClientAccount [created] ON [created].UserId = [page].CreatedByUserId
INNER JOIN dbo.ClientAccount [modified] ON [modified].UserId = [page].ModifiedByUserId
-- change alias to "folders"
INNER JOIN dbo.Node [folders] ON [folders].NodeGUID = [page].ParentGUID AND [folders].Name = 'Folders'
-- join on PlaceholderContent to get the HTML
-- this table will also have references to any static files contained in the page (such as images) so we filter those out by PropName = 'HTML'
INNER JOIN dbo.NodePlaceholderContent html ON html.NodeId = [page].Id AND html.PropName = 'HTML'
WHERE [page].[Type] = 16
AND [page].IsShortcut = 0
AND [page].ApprovalStatus = 1
8)所以在這一點上,我有一個小卡在試圖確定在頁面系統(即相對路徑或什麼渠道它生活在),回到步驟1 & 2,type = 16可以是帖子或頁面(它們不是相同的東西,但它們是相關的)。所以現在我們加入我們的頁面到郵件記錄來確定路徑。
一些谷歌搜索我偶然發現this excerpt from Microsoft Content Management Server 2002: a complete guide真的幫得到的方式休息後(並確定了Node.Type
枚舉)
SELECT
[page].Id
,[page].NodeGuid
,[page].Name
,[post].DisplayName as 'Title' -- add page Title from the post record
,[pageParent].Name
,[pageParent2].Name
,[created].Username as 'CreatedBy'
,[page].CreatedWhen
,[modified].Username as 'ModifiedBy'
,[page].ModifiedWhen
,html.PropValue as 'HTML'
FROM dbo.Node [page]
INNER JOIN dbo.ClientAccount [created] ON [created].UserId = [page].CreatedByUserId
INNER JOIN dbo.ClientAccount [modified] ON [modified].UserId = [page].ModifiedByUserId
INNER JOIN dbo.Node [folders] ON [folders].NodeGUID = [page].ParentGUID AND [folders].Name = 'Folders'
INNER JOIN dbo.NodePlaceholderContent html ON html.NodeId = [page].Id AND html.PropName = 'HTML'
-- join using followGUID to get the posting
INNER JOIN dbo.Node [post] ON [post].FollowGUID = [page].NodeGUID
WHERE [page].[Type] = 16
AND [page].IsShortcut = 0
AND [page].ApprovalStatus = 1
9)最後一步現在是持續上漲後父層次結果導致多個LEFT JOINS加緊ParentGUID鏈。該查詢使用這些LEFT JOINS給出了層次結構的直觀表示。
SELECT
CASE WHEN postParent9.Name IS NULL THEN '' ELSE postParent9.Name + ' > ' END +
CASE WHEN postParent8.Name IS NULL THEN '' ELSE postParent8.Name + ' > ' END +
CASE WHEN postParent7.Name IS NULL THEN '' ELSE postParent7.Name + ' > ' END +
CASE WHEN postParent6.Name IS NULL THEN '' ELSE postParent6.Name + ' > ' END +
CASE WHEN postParent5.Name IS NULL THEN '' ELSE postParent5.Name + ' > ' END +
CASE WHEN postParent4.Name IS NULL THEN '' ELSE postParent4.Name + ' > ' END +
CASE WHEN postParent3.Name IS NULL THEN '' ELSE postParent3.Name + ' > ' END +
CASE WHEN postParent2.Name IS NULL THEN '' ELSE postParent2.Name + ' > ' END +
CASE WHEN postParent1.Name IS NULL THEN '' ELSE postParent1.Name + ' > ' END +
page.Name as [Path]
,page.Name + '.htm' as [PageName]
,post.DisplayName as [PageTitle]
,CASE page.[Type]
WHEN 1 THEN 'Server'
WHEN 4 THEN 'Channel'
WHEN 16 THEN 'Post/Page'
WHEN 64 THEN 'Resource Gallery'
WHEN 256 THEN 'Resource Gallery Item (images/documents)'
WHEN 16384 THEN 'Template Gallery'
WHEN 65536 THEN 'Template' END as [Type]
,page.CreatedWhen as 'Created'
,page.ModifiedWhen as 'Modified'
,html.PropValue as 'HTML'
FROM dbo.Node page
INNER JOIN dbo.Node folders ON folders.NodeGUID = page.ParentGUID AND folders.Name = 'Folders'
INNER JOIN dbo.NodePlaceholderContent html ON html.NodeId = page.Id AND html.PropName = 'HTML'
INNER JOIN dbo.Node post ON post.FollowGUID = page.NodeGUID AND post.IsShortcut = 1
LEFT JOIN dbo.Node postParent1 ON postParent1.NodeGuid = post.ParentGUID
LEFT JOIN dbo.Node postParent2 ON postParent2.NodeGuid = postParent1.ParentGUID
LEFT JOIN dbo.Node postParent3 ON postParent3.NodeGuid = postParent2.ParentGUID
LEFT JOIN dbo.Node postParent4 ON postParent4.NodeGuid = postParent3.ParentGUID
LEFT JOIN dbo.Node postParent5 ON postParent5.NodeGuid = postParent4.ParentGUID
LEFT JOIN dbo.Node postParent6 ON postParent6.NodeGuid = postParent5.ParentGUID
LEFT JOIN dbo.Node postParent7 ON postParent7.NodeGuid = postParent6.ParentGUID
LEFT JOIN dbo.Node postParent8 ON postParent8.NodeGuid = postParent7.ParentGUID
LEFT JOIN dbo.Node postParent9 ON postParent9.NodeGuid = postParent8.ParentGUID
順便說一句,我的任務不涉及出口資源庫內容(圖片/文檔/等),但如果你確實需要這些作品爲這裏應該有足夠的信息來獲得對一個良好的開端好。
我希望這可以幫助別人從MCMS 2002遷移...