(Add: I tested with 6.1 and 6.0)


I try to finish my xar but I think there are a bug in the xwiki about language.
I can't display XWD_LANGUAGE value from database with velocity.
By example, this code doesn't return language of Sandbox.WebHome:{{velocity}}
#set ($items = $xwiki.search("select doc.fullName from XWikiDocument as doc 
where doc.space='Sandbox' and doc.name != 'WebPreferences'"))
  #foreach($item in $items)
    #set($itemDoc = $xwiki.getDocument($item))
    * //[$itemDoc] in Sandbox space with language : $itemDoc.language
  #end
{{/velocity}}

I obtain this:


    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.TestPage3] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.TestPage2] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.TestPage1] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.WebHome] in Sandbox space with language : 
   
 [Sandbox.WebHome] in Sandbox space with language : 
    [Sandbox.test] in Sandbox space with language : 



Did I found a bug?

NB: I don't use "#foreach ($docName in 
$xwiki.getSpaceDocsName("SandboxTemplate")" because if Administrator doesn't 
display hidden document, this code doesn't return  SandboxTemplate space hidden 
documents :-(

Thxs

Pascal BASTIEN



________________________________
 De : Pascal BASTIEN <[email protected]>
À : XWiki Users <[email protected]> 
Envoyé le : Mercredi 9 juillet 2014 9h31
Objet : Re: [xwiki-users] how to purge history in a space?
 




Sure!

NB: is it to late for my commit for 
6.1?:https://github.com/xwiki/xwiki-platform/pull/297



________________________________
 De : "[email protected]" <[email protected]>
À : XWiki Users <[email protected]> 
Envoyé le : Mardi 8 juillet 2014 18h51
Objet : Re: [xwiki-users] how to purge history in a space?
 

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
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to