+1
2015-08-31 16:17 GMT+02:00 vincent(a)massol.net <vincent(a)massol.net>et>:
Hi devs,
Problem:
* We have several ways of getting the main wiki id and the current wiki id:
** way 1: $services.wiki.mainWikiId and $services.wiki.currentWikiId
** way 2: $xcontext.getMainWikiName() and $context.getDatabase()
* In menu_macros.vm we set: #set ($mainWikiId = $services.wiki.mainWikiId)
** This is used in some other templates such as drawer.vm:
#set ($hasHomeWikiAdmin = $xwiki.hasAccessLevel('admin',
$xcontext.user, "${mainWikiId}:XWiki.XWikiPreferences”))
** This means that currently is a module doesn’t declare a dependency on
the wiki module, its functional tests will fail with:
15:29:29.868 [Thread-13] ERROR o.x.t.i.XWikiLogOutputStream - 2015-08-31
15:29:29,868 [
http://localhost:8080/xwiki/bin/register/XWiki/Register]
WARN o.h.u.JDBCExceptionReporter - SQL Error: -4850, SQLState: 3F000
15:29:29.869 [Thread-13] ERROR o.x.t.i.XWikiLogOutputStream - 2015-08-31
15:29:29,868 [
http://localhost:8080/xwiki/bin/register/XWiki/Register]
ERROR o.h.u.JDBCExceptionReporter - invalid schema name: ${MAINWIKIID}
15:29:29.884 [Thread-13] ERROR o.x.t.i.XWikiLogOutputStream - 2015-08-31
15:29:29,883 [
http://localhost:8080/xwiki/bin/register/XWiki/Register]
ERROR .a.DefaultAuthorizationManager - Failed to load rights for user
[Public] on [${mainWikiId}:XWiki.XWikiPreferences].
Solution:
* Make the Wiki API Module and the Wiki Script Module a core API (ie the
most minimal version of XWiki cannot work without them)
Actions to take:
* Add a dep on these 2 modules in PackagerMojo.java
* Deprecate $xcontext.getMainWikiName() and $context.getDatabase() and
favor using $services.wiki.mainWikiId and $services.wiki.currentWikiId
(once we finish adjusting all places, move xcontext.getMainWikiName()
and context.getDatabase to the oldcore legacy module).
* Remove all the checks we do to check for the availability of the wiki
script service. For example:
admin.vm: #if ("$!services.wiki" != '' &&
$services.wiki.currentWikiId != $services.wiki.mainWikiId)
Activity.xml: #if ("$!services.wiki" != '' &&
$services.wiki.mainWikiId == $services.wiki.currentWikiId)
menuview.vm: #set ($isWikiAPIAvailable = ("!$services.wiki" != '')
&&
("!$services.wiki.user" != ''))
CreateWiki.xml: #if ($services.wiki && $services.wiki.creationjob)
WDYT?
Thanks
-Vincent
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Guillaume Delhumeau (gdelhumeau(a)xwiki.com)
Research & Development Engineer at XWiki SAS
Committer on the