import com.atlassian.jira.component.ComponentAccessor
def projectManager = ComponentAccessor.getProjectManager()
def projects = projectManager.getProjectObjects()
def issueManager = ComponentAccessor.getIssueManager()
projects.each{ project ->
def attachmentsTotal = 0
def issues = ComponentAccessor.getIssueManager().getIssueIdsForProject(project.id)
issues.each{ issueID ->
def issue = ComponentAccessor.getIssueManager().getIssueObject(issueID)
def attachmentManager = ComponentAccessor.getAttachmentManager().getAttachments(issue).size()
attachmentsTotal += attachmentManager
}
log.warn(project.key + " - " + attachmentsTotal)
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter