Thanks again, Ludovic, for a quick reply.
I apologize for neglecting to give you the version; I'm using 0.9.840, and calling
copyDocument from a Velocity script on a wiki page. And no, I'm not getting any error
messages, either on the page or in the logs, with one exception: my attempts to delete
the incorrectly-copied document evoked an error message, which I didn't interpret as
having to do with the objects but complained of an inconsistency in item counts (e.g.
expected 1, found 0) or something similar; sorry I don't have the message now. After
flushing, however, the deletion succeeded.
Your suspicions sound consistent with what I've seen here.
There's an update to this: I edited the original document's page permissions to
add "admin, programming" to the "levels" field of the corrupted rights
object, which was for XWiki.XWikiAdminGroup, and the objects survived the flush.
Apparently the bogus fieldname (or, more likely, the lack of the correct one) is in some
way the culprit - such as causing the transaction to abort when an object with an
incorrect schema was saved. Why the document and its content (an #includeForm directive)
survived the aborted transaction is a mystery in that case.
So, conjecturally, (apart from the incorrect DB data) the bug, if any, is that a) no error
message ensued from an aborted transaction (I'm pretty sure, though not absolutely,
that the logs were silent) and b) the cache was not cleared. I am adding an
$xwiki.flushCache() call to the end of my copy script, at any rate, to be sure that
I'm not fooled again by objects that aren't really there.
At a minimum, the database dump needs to be fixed ASAP...
brain[sic]
-----Original Message-----
From: Ludovic Dubost [mailto:ludovic@xwiki.com]
Sent: Tuesday, May 30, 2006 5:25 PM
To: xwiki-users(a)objectweb.org
Subject: Re: [xwiki-users] $xwiki.copyDocument, objects, and cache
Hi,
THOMAS, BRIAN M (SBCSI) a écrit :
When copying a document using
$xwiki.copyDocument(), I find
that all
the attached objects are copied along with the
document,
and I am able
to view them appropriately. However, they are
not
available to other
users, and when I call $xwiki.flushCache(), only
the
document content
remains; the objects are no longer attached.
A further detail, whether relevant or not, is that the
document being
copied is a user profile document (defined as a
document named
XWiki.<username>, where <username> is the login name of the
user, and
containing an XWiki.XWikiUsers object).
Yet another detail, puzzling though it may be, is that of
the objects
in the original, one of them is the one defined
in the
xwiki-db-0.9.2.sql database download as an object of XWiki class
XWiki.XWikiRights with ID 165499024, with a field named
"levelsye".
It's one of two XWiki.XWikiRights objects
attached to a
user profile
document by createUser; the other one explicitly
gives edit
permission
to the user himself. No other XWiki.XWikiRights
objects
contain this
field, nor does the current definition of the
XWiki.XWikiRights class
contain it; instead they contain a field called
"levels".
So, the questions are, in order of (logarithmically) decreasing
importance:
1. How can I make this work?
I'll revert the question. Which version of XWiki are you
using and where
are you running the copyDocument (inside a wiki page or in an
external
application ?)
I'm a little surprised that you are having problems. I
suspect creating
the new document worked but it was not saved correctly to the
database
nor the document was shared with other users.
Are you getting any error message ?
2. Does a user profile document have some special
status
that makes it
inappropriate to make a copy?
No
3. Is the "levelsye" field in an object
simply a bug, or is
there some
arcane reason for its existence?
It's a bug. It might have an effect on copying this exact object.
Brian M. Thomas - Senior Technical Architect
AT&T Services, Inc.
One SBC Center, Room 24D3
St. Louis, MO 63101
314 235 3141
----------------------------------------------------------------------
--
--
You receive this message as a subscriber of the
xwiki-users(a)objectweb.org mailing list. To unsubscribe:
mailto:xwiki-users-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws
--
Ludovic Dubost
XPertNet:
http://www.xpertnet.fr/
Blog:
http://www.ludovic.org/blog/
XWiki:
http://www.xwiki.com
Skype: ldubost AIM: nvludo Yahoo: ludovic