How to run a Python script that used XML/RPC to find those macros, remove them, and save the pages.
Here's a program that is pretty close to what you need. Your wiki needs to be open to XML/RPC access, you need to put in credentials and the right URL, and you need to put in the text you need to remove. If what you want to remove a macro that varies because of different parameters, you'll need to use re (the Python regex module) rather than doing a string replace.
Note that this acts on the storage format – to see what your macro looks like in storage format, choose Tools > View Storage Format when looking at a page that has the macro.
If you want to go through the entire wiki, you can get the space list using the XML/RPC method "getSpaces" and add an additional for loop to go through the spaces.
#!/usr/bin/python # import re,sys from xmlrpclib import Server space='Linux' comment={'versionComment':"Page put into format by script."} # main program # Set up confluence s=Server("http://serverbaseurl/rpc/xmlrpc") token=s.confluence2.login("username","password") pages=s.confluence2.getPages(token,space) for pagesum in pages: pagename=pagesum['title'] try: page=s.confluence2.getPage(token,space,pagename) print "Doing page",pagename.encode('utf8','replace') except: print "Couldn't read page",pagename continue page['content']=model['content'].replace('remove','') page=s.confluence2.updatePage(token,page,comment)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.