Hi Devs,
in XWiki::initXWiki(XWikiConfig config, XWikiContext context,
XWikiEngineContext engine_context, boolean noupdate) method signature, the
flag "noupdate" indicates whether the database should be updated or not. But
as far as I can understand, it's meaning is reversed:
- if "noupdate" is true -> You can update the database and install data into
it (like define major xwiki classes etc.).
- if "noupdate" is false -> You should not add anything into the database.
(I guess this means you can only create the database schemas.)
One observation I made though is that "noupdate" is actually used only in
the following code segment:
<code>
// Make sure these classes exists
if (noupdate) {
initializeMandatoryClasses(context);
getStatsService(context);
}
</code>
* Question:- Do we really need this flag?
The other problem is that pckager plugin is using a version of XWiki
constructor that sets this flag to "false" by default:
see
http://svn.xwiki.org/svnroot/xwiki/platform/xwiki-tools/trunk/xwiki-packager-plugin/src/main/java/com/xpn/xwiki/tool/backup/AbstractPackager.javaand
http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.javafor
proof.
This means when we are packaging the database (hsqldb), none of the
mandatory classes are packaged. They will only be initialized when XE is
loaded for the first time.
* Question:- Is this the desired behavior?
Apperantly I have introduced a bug (sort of) because XWiki.WikiMacroClass &
XWiki.WikiMacroParameterClass are initialized inside if(noupdate){} clause
but I have invoked registerWikiMacros(); call outside of it (in
XWiki::initXWiki()). This makes hsqldb database build report an exception
because wiki macro registration code throws an exception if it cannot find
the necessary xwiki class definitions.
I can fix this error by simply moving registerWikiMacros(); call inside the
if(noupdate){} check but I'm not sure whether it is the correct way.
WDYT?
- Asiri
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs