/usr/share/pyshared/MoinMoin/macro/OrphanedPages.py is in python-moinmoin 1.9.3-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - OrphanedPages Macro
@copyright: 2001 Juergen Hermann <jh@web.de>
@license: GNU GPL, see COPYING for details.
"""
Dependencies = ["pages"]
def macro_OrphanedPages(macro):
_ = macro.request.getText
if macro.request.mode_getpagelinks: # prevent recursion
return ''
if macro.request.isSpiderAgent: # reduce bot cpu usage
return ''
# delete all linked pages from a dict of all pages
pages = macro.request.rootpage.getPageDict()
orphaned = {}
orphaned.update(pages)
for page in pages.values():
links = page.getPageLinks(macro.request)
for link in links:
if link in orphaned:
del orphaned[link]
result = []
f = macro.formatter
if not orphaned:
result.append(f.paragraph(1))
result.append(f.text(_("No orphaned pages in this wiki.")))
result.append(f.paragraph(0))
else:
# return a list of page links
orphanednames = orphaned.keys()
orphanednames.sort()
result.append(f.number_list(1))
for name in orphanednames:
if not name:
continue
result.append(f.listitem(1))
result.append(f.pagelink(1, name, generated=1))
result.append(f.text(name))
result.append(f.pagelink(0, name))
result.append(f.listitem(0))
result.append(f.number_list(0))
return ''.join(result)
|