Hi Pascal,

It could be nice to share "how to reinitialize a space” as a snippet on 
extensions.xwiki.org when you have it all working ;)  

Thanks  
-Vincent

On 8 Jul 2014 at 17:38:43, Pascal BASTIEN 
([email protected](mailto:[email protected])) wrote:

>  
>  
> FYI, finally I add this parameter to overwryte my Sandbox (and reinit 
> history):
> copy $xwiki.copyDocument("TemplateSandbox.$docName", 
> "Sandbox.$docName","fr","true","true"))
>  
> http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/XWiki.html#copyDocument%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20boolean,%20boolean%29
> - reset - true to reset versions
> - force - true to overwrite the previous document
>  
>  
> Strangely all my new Sandbox page have a fresh 1.1 version except 
> Sandbox.WebHome
> Sandbox/?viewer=history return: "Advertissment: impossible to find this 
> document"
>  
>  
> The velocity macro to reinit my Sandbox working well now.
>  
> Thxs
>  
>  
> ________________________________
> De : Pascal BASTIEN  
> À : XWiki Users  
> Envoyé le : Mardi 8 juillet 2014 15h07
> Objet : Re: [xwiki-users] how to purge history in a space?
>  
>  
> I already check the code of this extension: it is groovy code and it is not a 
> simple one...
>  
> I wanted reinit my sandbox with velocity code and I wonder if there aren't a 
> bug with resetArchive method (or if I'm wrong with my syntax)
>  
> Thxs anyway :-)
>  
>  
>  
>  
> ________________________________
> De : "[email protected]"  
> À : XWiki Users  
> Envoyé le : Mardi 8 juillet 2014 11h35
> Objet : Re: [xwiki-users] how to purge history in a space?
>  
>  
>  
>  
> On 8 Jul 2014 at 11:14:25, Pascal BASTIEN 
> ([email protected](mailto:[email protected])) wrote:
>  
> > Yes thxs you, I saw this extension. It's work with that.
>  
> If it’s working then you could do the same!
>  
> > I saw than this user meet same problem: 
> > http://xwiki.markmail.org/message/2tx6ac55lrjmju6u?q=purge+history+already+associated
> >  
> > With velocity it is impossible to remove history then? If yes, I will 
> > shedule your extension.
>  
> Why do you say that? AFAICS this extension is a XAR (ie wiki pages). I didn’t 
> check its content but you check how it does it and do the same.
>  
> Thanks
> -Vincent
>  
>  
> > ________________________________
> > De : "[email protected]"  
> > À : XWiki Users  
> > Envoyé le : Mardi 8 juillet 2014 10h52
> > Objet : Re: [xwiki-users] how to purge history in a space?
> >  
> >  
> > Hi Pascal,
> >  
> > Does it work with 
> > http://extensions.xwiki.org/xwiki/bin/view/Extension/Remove+Document+History
> >  ?
> >  
> > Thanks
> > -Vincent
> >  
> >  
> > On 8 Jul 2014 at 10:29:13, Pascal BASTIEN 
> > ([email protected](mailto:[email protected])) wrote:
> >  
> > > Hello,
> > > I need some help with my velocity script.
> > > I try to remove history of pages on a space.
> > > This code work well for a page:
> > >  
> > > {{velocity}}
> > > $xwiki.getDocument('BacASable.TestPage3').getDocument().resetArchive($context.context)
> > > {{/velocity}}
> > >  
> > > but my script fail when I launch this one to remove history of all 
> > > BacASable space Page
> > >  
> > >  
> > > {{velocity}}
> > > #foreach ($docName in $xwiki.getSpaceDocsName("BacASable"))
> > > $xwiki.getDocument("BacASable.$docName").getDocument().resetArchive($context.context)
> > > * history of "BacASable.$docName" removed
> > > #end
> > > {{/velocity}}
> > >  
> > > I obtain this error:
> > >  
> > > Caused by: org.hibernate.NonUniqueObjectException: a different object 
> > > with the same identifier value was already associated with the session: 
> > > [com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo#com.xpn.xwiki.doc.rcs.XWikiRCSNodeId@2ff3ff58[docId=9026427162423984573,version=4.1]]
> > > Any ideas what's I'm doing wrong? Thxs
> > >  
> > > Note: deletion of WebHome history doessn't work:
> > > $xwiki.getDocument('BacASable.WebHome').getDocument().resetArchive($context.context)
> > >  
> > >  
> > > Pascal B (on Xwiki 6.0)

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to