Is there a way to find pages containing references to Unknown macro?

Justin Rand October 19, 2011

I want to upgrade our Confluence to 4.0. We are using 3.1 currently and have several plugins that are deprecated in 4.0. I've cloned our Confluence instance to a test server and disabled said plugins. Is there a way I can quickly find any page containing "Unknown macro: {whatever}"?

I'm looking for any answer other than "look through every page on the search results for every macro keyword".

5 answers

1 accepted

0 votes
Answer accepted
Justin Rand November 7, 2011

Using the script provided as an answer to https://answers.atlassian.com/questions/15230/confluence-4-0-finding-pages-that-have-content-with-incompatible-upgraded-macros , I was able to identify all pages (hopefully) within all spaces that contained errors.

3 votes
Edwin Dawson October 20, 2011

Hi there Justin, I've recently written this Python script that will connect to a Confluence sever and scan for the kinds of broken content you're describing (including links, images, includes, macros).

If you're comfortable running Python scripts, the script is available on Bitbucket: https://bitbucket.org/edawson/busted-stuff-report/changeset/039bd9034311

Simply run that, and it will generate a HTML report listing all the pages with broken content.

Justin Rand November 6, 2011

Not sure the macro regex is identifying broken pages appropriately. I get errors, but only on the first "<title>Log In" test. I specifically tested the script on a space that I know has broken macros and it does not identify this in the report.

Does this examine the source HTML for all pages within a space? If so, "Unknown macro" isn't present in page source, but rather it's a wysiwyg-unknown-macro img class. However, replacing this html source into your script still does not return any hits.

Justin Rand November 7, 2011

Not sure where the wysiwyg class came from or went, but I just reloaded the page and the div class="error" is now present as well as "Unknown macro". I still did not get anything in the report about these pages though using the version on bitbucket.

Edwin Dawson November 7, 2011

Hi there Justin,

This script is written for Confluence 4.0, if you are seeing "login errors", then either the password for the username is not correct or perhaps the username does not have permissions to view the page where the error occurs.

We are testing the script against Confluence 4.0, the errors you are seeing might be specific migration artifacts. There may be more cases of macro errors that we could add to the script.

Can you give me an example of the error text you are seeing in the page, that should be detected?

Justin Rand November 7, 2011

Edwin,

I figured out what the issue was. First, i'm running HTTPS, so that may be the root of why the script wasn't working from the get-go. In order to bypass that issue, I used Gavin Fowler's code from the Question above as a starting point.

My call on line 192 now looks like:

pageId= page_summary['id']
html = downloadpage(site_address,s,token,conf_space,pageId)

Obviously this warrants a change to the downloadpage definition to accept these inputs. Within that function, line 133 becomes:

html = s.renderContent(token,conf_space,pageId,'',{'style':'clean'})

which was taken directly from Gavin's solution linked above in my "Accepted Answer". Running with these changes now produces the correct behavior: Log In error is gone, Macro Error is found.

Edwin Dawson November 8, 2011

Hi again Justin, thanks for providing some troubleshooting on this script!

Please let me know if there's anything else I can help you with.

GSIE IT March 25, 2014

Hi Sirs,

I know it's kind of late but is there any plan on compatibility with Confluence 5.x ?

Thanks

1 vote
Bob Swift OSS (Bob Swift Atlassian Apps)
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 20, 2011

How to test a Confluence instance for macro errors - I have been meaning to write this up for some time, your question motivated me to do it :). We are also doing a major upgrade (to 3.5.13) soon and this problem is always a significant concern.
Deleted user February 20, 2014

That's gone now. Atlassian has helpfully trashed it.

0 votes
Sharon Russell May 20, 2016

This is actually a question. Does the python script from Bitbucket still work? When I try to run it, I get an error on line 125 where it tries to use XML-RPC to retrieve a list of all pages in the space. The error says, "unsupported XML-RPC protocol" I checked around and discovered that XML-RPC has be deprecated since 5.5, and I'm using 5.9.3. Does this part of the script need to be rewritten to use REST API? Any suggestions on how to do that? 

0 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 20, 2011

I think we've found someone with a solution for you - I've asked them to give you an answer here.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events