Hi,
2014-07-11 9:06 GMT+02:00 Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr>fr>:
Do you mean I must launch on query by langage?
Yes I agree with you about this $item then I can use id of document like
this:
{{velocity}}
#set ($items = $xwiki.search("select doc.id from XWikiDocument as doc
where doc.space='Sandbox' and doc.name != 'WebPreferences'"))
Should select doc.fullName instead of doc.id I believe.
You could also call $xwiki.wrapDocs to convert search result to a list of
xwiki documents directly.
#foreach($item in $items)
#set($itemDoc = $xwiki.getDocument($item))
You could check if $itemDoc is not null and an existing document before
trying to further access it ;-)
* //[$itemDoc] ID in Sandbox space with language
: $itemDoc.language
#end
{{/velocity}}
but after I don't know how to retrieve all field from wikidoc table from
$items. :-(
$itemDoc.language and $itemDoc.name return nothing. Are there a magic
functions?
Thxs
________________________________
De : Marius Dumitru Florea <mariusdumitru.florea(a)xwiki.com>
À : Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr>fr>; XWiki Users <users(a)xwiki.org
Envoyé le : Jeudi 10 juillet 2014 21h20
Objet : Re: [xwiki-users] how to purge history in a space? Did I found bug?
Just print $item and you'll see it's just the name of the document so
there's no way getDocument would return something other than the default
translation, which has the language field empty because it's the default
language (check the defaultLanguage field). If you want to get the
translations then you can use the 'language' query filter which adds the
language to the query results.
On Jul 10, 2014 12:52 PM, "Pascal BASTIEN" <pbasnews-xwiki(a)yahoo.fr>
wrote:
> 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 <pbasnews-xwiki(a)yahoo.fr>
> À : XWiki Users <users(a)xwiki.org>
> 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 : "vincent(a)massol.net" <vincent(a)massol.net>
> À : XWiki Users <users(a)xwiki.org>
> 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 (pbasnews-xwiki(a)yahoo.fr
(mailto:pbasnews-xwiki@yahoo.fr)) 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/XWik…
> > - 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 : "vincent(a)massol.net"
> > À : 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 (pbasnews-xwiki(a)yahoo.fr
(mailto:pbasnews-xwiki@yahoo.fr)) 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+…
> >
> > > 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 : "vincent(a)massol.net"
> > > À : 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
(pbasnews-xwiki(a)yahoo.fr
(mailto:pbasnews-xwiki@yahoo.fr)) 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
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users