Is there a way to report Spaces that do not have pages?

I have a problem with personal spaces exisitng that do not have pages and I want to be able to delete those personal spaces. Has anyone found a way to report spaces without a single page?

2 answers

1 accepted

If you want to use the reporting plugin, try this:

{report-table}

{space-reporter}

{number-filter:space:all pages > collection:size|maxValue=1}

{space-reporter}

{report-column:title=Empty Spaces}{report-info:space:name|link=true}{report-column}

{report-empty}_No empty Spaces_{report-empty}

{report-table}

I've set 'maxValue' to 1 since most pages have at least one page (the home page). If you want absolutely no pages, set it to '0'.

Also, this will also be somewhat inefficient, since it is basically loading every page in your server into memory, so I'd avoid running it too often...

Perfect, the report does the trick. Many thanks. When I get my upgrade and users sorted out in the new year I am going to have some real time to work on reporter and macros and I can't wait.

2 votes
David Simpson Community Champion Oct 26, 2011

If @Bob Swift doesn't have a magic CLI command to do this, you could write a suitable macro.

The execute method could be along these lines:

public String execute(Map params, String body, RenderContext renderContext)
        throws MacroException
{
    String returnValue = "<h2>Spaces without pages</h2><ol>";

    List<Space> spaces = spaceManager.getAllSpaces();

    for (Space space : spaces)
    {
        List<Page> pages = pageManager.getPages(space, true);
        
        if (pages.size() == 0)
        {
            returnValue =  returnValue + "<li>"+space.getKey()+" : "+space.getName()+"</li>"; 
        }
    }
    return returnValue + "</ol>";
}

It's suboptimal code, but would likely do the trick.

Thanks for the swift response. I must admit that I although I know how to write a basic macro and use the reporter plugin I don't know what to do with that code, can you direct me to that fine manual? ;-)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Sarah Goff-Dupont
Published 6 hours ago in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

66 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you