Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bulk remove old macros from all wiki pages

David Yu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 29, 2012

I'm planning for an upgrade to Confluence 4 and have decided to sunset some plugins which are no longer useful to us (and have turned from open source to commercial...but that's another story).

The impetus for stripping out these old markup tags is because Confluence attempts to wrap these in wiki markup blocks. Worst case is users will have to copy and paste from the wiki block into the outside block.

Does anyone have any tricks or tips on how to best remove them en-masse? The solution that I'm thinking of involves database search/replace with regex pattern replace. I think this will be much easier to do before the upgrade and conversion into XHTML.

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2012

One technique would be to create user macros for each macro offered by the plugin you're withdrawing. The user macro would be given the same name as a withdrawn macro. If the original macro was wrapping text or other content then you'll need to output that from the user macro. $body should do the trick. If there was no content wrapped by the macro then the macro doesn't need to do anything. You'll find an option when you define a user macro to prevent the macro appearing in the macro browser, except for admin users. This will help ensure that the users don't carry on using the macros by mistake.

You might say that this approach doesn't fully address the issue because the pages haven't been cleaned up. However the page authors could tackle this over time as pages are edited and updated in the normal run of things. You could track progress of this with careful use of the Confluence search and so remove the user macros when they're no longer required (see http://ffeathers.wordpress.com/2011/11/04/how-to-search-confluence-for-usage-of-a-macro/).

A database search/replace is certainly possible, but riskier I think. Let us know which solution you go for. It's an interesting challenge you've got there.

David Yu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2012

That's a great tip on using a user macro. I think I'll try that out instead of the DB search/replace method since it's less destructive.

MarkC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2015

One flaw with this for anyone referencing it post 5.8.x, there is a bug with some macros being placed inside a user macro, so you could end up with an even greater mess if you make this change. https://jira.atlassian.com/browse/CONF-38074

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events