+1 (forgot to vote), even though I don’t like that we make the core larger than it could
be. See IRC discussion at
Thanks
-Vincent
On 31 Aug 2015 at 16:17:59, vincent(a)massol.net
(vincent@massol.net(mailto:vincent@massol.net)) wrote:
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