General Actions:
Log-in
Register
Wiki:
Main wiki
▼
:
Document Index
»
Space:
Blog
▼
:
Document Index
»
Page:
Migration
Search
default
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Main wiki
»
The Wiki Blog
»
Manage blogs on this wiki
»
Blog migration
Wiki source code of
Blog migration
Last modified by
Administrator
on 2012/03/21 17:41
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{velocity filter="none"}} 2: #if($request.migrate && $!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 3: #set($newContent = '#includeForm("Blog.BlogPostSheet")') 4: #set($query = ", BaseObject obj where obj.name = doc.fullName and obj.className = 'XWiki.ArticleClass'") 5: #foreach($article in $xwiki.searchDocuments($query)) 6: #if($xwiki.hasAccessLevel('edit', $xcontext.user, $article)) 7: #set($articleDoc = $xwiki.getDocument($article)) 8: #set($articleObj = $articleDoc.getObject('XWiki.ArticleClass')) 9: #set($entryObj = $articleDoc.newObject('Blog.BlogPostClass')) 10: #foreach($property in ['title', 'content', 'extract', 'category']) 11: $!entryObj.set($property, $articleObj.getProperty($property).value) 12: #end 13: $!entryObj.set('published', 1) 14: $!entryObj.set('publishDate', $articleDoc.creationDate) 15: $!entryObj.set('hidden', 0) 16: #set($discard = $articleDoc.removeObjects('XWiki.ArticleClass')) 17: $articleDoc.setContent($newContent) 18: $!articleDoc.save($msg.get('xe.blog.migration.migrated'), true) 19: * $msg.get('xe.blog.migration.updated') [[$entryObj.title>>${article}]] ($msg.get('xe.blog.migration.inspace') [[$articleDoc.space>>${articleDoc.space}.WebHome]]) 20: #else 21: * $msg.get('xe.blog.migration.skipping') [[$article]] 22: #end 23: #end 24: $msg.get('xe.blog.migration.done') [[$msg.get('xe.blog.migration.backtoblog')>>Blog.WebHome]] 25: #else 26: $msg.get('xe.blog.migration.pleaseconfirm') 27: 28: {{html clean="false" wiki="true"}} 29: <form action="$doc.getURL()" method="post"> 30: <div> 31: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 32: <input type="submit" name="migrate" value="$msg.get('xe.blog.migration.confirm')"/> 33: </div> 34: </form> 35: {{/html}} 36: 37: [[$msg.get('xe.blog.migration.backtoblog')>>Blog.WebHome]] 38: #end 39: {{/velocity}}
Recent Blog Posts
First blog post
Blog Categories
News
(1)
Other
(0)
Personal
(0)
Blog Archive
2009
(1)