On 15 Sep 2016, at 10:09, Vincent Massol <[email protected]> wrote:
On 15 Sep 2016, at 10:04, Vincent Massol <[email protected]> wrote:
Hi devs,
I’d like to add a new script API in oldcore.
I need a new API to know if the XAR export feature is available so that the Page level XAR export button is displayed (I’m trying to fix http://jira.xwiki.org/browse/XWIKI-13695#).
I was thinking about adding some XXXScriptService in oldcore but the right hint would be “xar” and XXX would be “XAR”. The problem is that we already have one in xwiki-platform-xar (which right now is used by oldcore and thus I cannot add this new method to the existing XarScriptService that is there).
Ah there’s one option, which is to split the current xwiki-platform-xar module into 2: - xwiki-platform-xar-api - xwiki-platform-xar-script
And have xwiki-platform-xar-script depend on oldcore
FTR I’ve checked and XarScriptService is currently only used by xwiki-platform-web and thus it’s fine that it depends on oldcore. Thanks -Vincent
And introduce the isXARExportAvailable() method in XarScriptService.
WDYT?
If we agree about my proposal in http://markmail.org/message/2qmd7urysr32xewj it could make sense maybe.
Thanks -Vincent
I can’t find any name or hint that would make sense on the long run for oldcore. Some other ideas: * OldCoreScriptService, hint = “oldcore” and we consider it something temporary that will need to go away and deprecate * CoreScriptService, hint = “core”. Same * ImportExportSerciceService, hint = “?”
Last, I have the option to continue what we’ve done so far which is increase a bit more the size of api.XWiki. For example we have in there the following method which does something similar:
/** * @return true if title handling should be using the compatibility mode or not. When the compatibility mode is * active, if the document's content first header (level 1 or level 2) matches the document's title the * first header is stripped. */ public boolean isTitleInCompatibilityMode() { return this.xwiki.isTitleInCompatibilityMode(); }
so I could add XWiki.isXARExportAvailable()…
WDYT? Any preference?
Right now I have a hard time deciding. I hate it but I’m considering adding a new method to the XWiki class, but I’d love to find something better.
Thanks -Vincent