Example scripts
To homepage
Confluence

Automate the Removal of Old or Inactive Content
App in script

ScriptRunner For Confluence
by Adaptavist
Compatibility

Confluence (7.15 - 8.6)

ScriptRunner For Confluence (7.10.0)
Language |
groovy
import com.atlassian.confluence.core.DefaultDeleteContext
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator
def pageManager = ComponentLocator.getComponent(PageManager)
def pages = hits as List<Page>
log.info("Total number of pages to be trashed: ${pages?.size()}")
pages?.each { Page page ->
log.info("Page: ${page.title} in Space: ${page.spaceKey} was moved to the trash")
pageManager.trashPage(page, DefaultDeleteContext.DEFAULT)
}
"CQL search returned ${pages?.size()} inactive item(s). Each item was removed"
Having an issue with this script?
Report it here