Ok. Thank you. I'll try the code snippet. J. Allen -------------------------------------------------- From: "Sergiu Dumitriu" <[email protected]> Sent: Friday, December 04, 2009 6:00 PM To: "XWiki Users" <[email protected]> Subject: Re: [xwiki-users] Page modification date
On 12/04/2009 10:52 AM, J. Allen Q. Santos wrote:
-------------------------------------------------- From: "Sergiu Dumitriu"<[email protected]> Sent: Friday, December 04, 2009 5:41 PM To: "XWiki Users"<[email protected]> Subject: Re: [xwiki-users] Page modification date
On 12/04/2009 09:52 AM, J. Allen Q. Santos wrote:
Hi,
I was just wondering, is it possible to manually change the modification date (Page.setModified()) of pages in XWiki?
Yes. From Java, you have to do this:
doc.setDate(new Date()); // or any Date object you want
What's this for:
doc.setContentDirty(false); doc.setMetaDataDirty(false); ???
The current core is not that well designed, so there are lots of misplaced responsibilities. So, updating the document change date is now done inside the storage part, right before pushing the document to the database. This date update is triggered by this check:
if (doc.isContentDirty() || doc.isMetaDataDirty()) {
xwiki.saveDocument(doc, comment, minorEdit, xcontext);
From Velocity, you would need programming rights to access the protected XWikiDocument object, since all these setters are not available from the public API.
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users