How to actually delete a Macro?

Hello, I am trying to find a macro I have listed on my XWikiSyntaxMacrosList
The problem is that I have no idea how to find it!

I am not sure how or where are macros stored, I assumed that by deleting the page of the macro, it would stop showing up on the pages of editing, but that’s not the case.

What is the best approach to find and delete an installed macro?

Macros can be defined in 2 ways:

  • Wiki macros (ie in wiki pages)
  • Java macros (ie in java code)

If XWikiSyntaxMacrosList doesn’t provide a link to the macro it’s because the macro is coded in java. You’ll need to use the Extension Manager to uninstall the extension contributing the macro (you’ll need to pay attention that it won’t remove other features you need. Right now there’s no easy way to just disable a single java macro).

Thx

EDIT: Some more info at https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/WritingMacros/ but this is more for developers than for users.

Note that you can also hide macros from the wysiwyg editor, see How to disable a macro? (ie without uninstalling/removing them).

Hi @vmassol , thank you!

Apparently, it was installed manually through a XAR import by one of our developers, and well, it is kind of botched so it does not show up on the import list nor on the extension manager. Super odd!

Is there any other way to ‘search’ for the macro i.e. using the database or similar approaches?

I just want to outright remove it but I have no idea where it lives.

Thanks,

Any wiki page containing a rendering macro declaration should appear in http://localhost:8080/xwiki/bin/view/XWiki/XWikiSyntaxMacrosList with a link to the page. You don’t see it?

For more details, that page will search in the database all the pages having a XWiki.WikiMacroClass xobject and list them.

I do see it in that list, but it does not have a “link” to a page.

It is a real mistery because if I search for the keyword “expand” on the search bar, I can only see the “expandable” macro but not this one called ‘expand’

ah maybe there are 2 macros having the same name in your wiki, one coming from a JAR and the other from a wiki page. I’ve checked the code and indeed we only display a single entry in the table in this case (something to fix probably). In any case only 1 macro can be enabled at a time.

Give me 10mn and I’ll provide a solution.

ok so try using property.XWiki.WikiMacroClass.id:expand in the search UI.

http://localhost:8080/xwiki/bin/view/Main/Search?sort=score&sortOrder=desc&highlight=true&facet=true&r=1&f_type=DOCUMENT&f_locale=en&f_locale=&text=property.XWiki.WikiMacroClass.id%3Aexpand

This will search for all pages having a XWiki.WikiMacroClass xobject with a property named id and a value of expand.

1 Like

Ok, give me 10 min, thanks for the help.

I just copied your URL, replaced with my domain page and it did not return any results.
Odd!
Am I doing something wrong?

No it looks good. Are you sure that the macro’s id is expand? You can try the search with another id corresponding to an existing wiki macro like property.XWiki.WikiMacroClass.id:notifications (it’s a wiki macro available by default) to see if it works. Maybe your solr index is broken.

1 Like

I did a property.XWiki.WikiMacroClass.id:* wildcard search and it did not show up.

All the other macros did show up

From what I understand, this expand macro you’re showing above is not a wiki macro and this is why there’s no link + you can’t find it in search.

My only issue is that it shows up here and I can’t find it to remove it hah

I have access to the DB on PostgreSQL to maybe try finding it there, is there any method?

No, the macro is not in the DB since it’s a java macro (and not a wiki macro), ie it’s not written in a wiki page (only wiki pages are in the DB). It’s likely coming from a JAR extension.

The problem is that we currently don’t have an api to know from which extension a macro is coming from. cc @tmortagne

Maybe search for “expand” in the Extension Manager to see if there’s an extension with that name installed

No luck with the extension manager, it only shows the ‘expandable’ macro.

Bummer, I do have access to the instance running the wiki. In case there’s something to be done there.

@vmassol , I was reading the thread you sent about ‘disabling’ a macro, I think the ‘easiest’ approach is going through that.

If I understand correctly, my XWiki.properties file should have:

#-# Overrides default macro categories (Each macro has default categories already defined, for example
#-# "Navigation" for the Table of Contents Macro).
#-# Note: the categories are case sensitive.
#-#
#-# Ex: To redefine the macro categories for the TOC macro so that it'd be in the "My Category" and "Deprecated" 
#-# categories + redefine the category for the Script Macro to be "My Other Category", you'd use:
rendering.transformation.macro.categories = expand = Deprecated  
rendering.transformation.macro.hiddenCategories = Deprecated

Correct?

Yes, but you don’t need the last line since it’s the default. The doc says:

#-# The default value is:
#-# rendering.transformation.macro.hiddenCategories = Internal,Deprecated

Actually if you do what you wrote, you’d remove the “Internal” category from being hidden (since you’re overwriting the default).

1 Like