Edgewall Software

Site maintenance

The following is a list of pages that help in maintaining a Trac site. Maintaining a site involves routine cleanup of wiki pages, also known as housekeeping, so that the site's content remains consistent and fresh. The pages that need to be maintained are not marked as 'deprecated' or 'pending-deletion'. The same site maintenance guidelines and links can be added to your Trac installation. This initiative is loosely inspired by Wikipedia's Special pages.

The SQL code here is specific for SQLite as the database backend, else it is SQL-pseudocode. Some of the examples use WikiTableMacro as the database query wrapper.

Old wiki pages

Pages which have not been edited in at least 5 years usually require a cleanup or can be marked for deletion.

{{{#!SQLTable
SELECT w.name, w.author, w.time FROM wiki AS w WHERE w.version = (SELECT MAX(version) FROM wiki WHERE name = w.name) AND julianday('now') - (((w.time/1000000)/86400.0) + 2440587.5 ) > 365*5
}}}

Old tickets

Tickets which have not been edited in at least a year usually require a cleanup or can be marked for deletion.

{{{#!SQLTable
SELECT t.id, t.owner, t.changetime FROM ticket AS t WHERE julianday('now') - (((t.changetime/1000000)/86400.0) + 2440587.5 ) > 365
}}}

Obsolete macros

There may still be some obsolete macros circulating in the wiki, such as TagIt[[()]], and they need to be removed.

Possible solution:

SELECT w.name FROM wiki AS w WHERE w.version = (SELECT MAX(version) FROM wiki WHERE name = w.name) AND w.text LIKE '%TagIt[[%';

List of all images

A list of all images on the Trac installation is useful for the following purposes:

  • if a list of the wiki pages or ticket pages that they are used in is provided also, then obsolete (ie unused) or duplicate images can be more easily detected.
  • if thumbnails are automatically generated also, then detection of irrelevant images: someone may have uploaded an image in the past that is irrelevent to the use or development of Trac.
  • jpgs may have been used, where png or svg is the norm.

Possible solution:

SELECT id, filename FROM attachment WHERE RIGHT(filename, 3) IN ('jpg', 'gif', 'svg', 'png', 'bmp');

Attachments

A list of all attachments on the Trac installation is useful for the following purposes:

  • if a list of the wiki pages or ticket pages that they are used in is provided also, then obsolete (ie unused) or duplicate attachments can be more easily detected.
  • someone may have uploaded an attachment in the past that is irrelevant to the use or development of Trac.
{{{#!SQLTable
SELECT a.filename, a.author, a.time FROM attachment AS a WHERE a.id NOT IN (SELECT name FROM wiki) OR a.id NOT IN (SELECT id FROM ticket)
}}}

Acronyms

Misused or accidental acronyms where spelling them out would make the text clearer: from db to database, from regex to regular expression, from " to ".

Possible solution:

SELECT name FROM wiki WHERE text LIKE '% db%' OR text LIKE '% regex%' OR text LIKE '% "%'  -- note that there is no space after each regex, since it may be followed by a dash (-) or comma (,);

Short wiki pages

Pages with little text are usually the result of a test or have been abandoned and are therefore candidates for deletion.

{{{#!SQLTable
SELECT w.name, w.author, w.time FROM wiki AS w WHERE w.version = (SELECT MAX(version) FROM wiki WHERE name = w.name) AND LENGTH(w.text) < 100
}}}

Dead links in the wiki show up as grey links if they are internal links and need to be corrected or removed. Dead links to external sites have no special highlighting, but still require correction or removal.

In Python it would reuse code as follows:

if not validate_page_name(self.name): raise TracError(_("Invalid Wiki page name '%(name)s'", name=self.name))]

As a workaround it is also possible to use the W3C validator.

Protected pages

Pages that are read-only may need to have their status reviewed.

{{{#!SQLTable
SELECT w.name, w.author, w.time FROM wiki AS w WHERE w.version = (SELECT MAX(version) FROM wiki WHERE name = w.name) AND w.readonly = 1
}}}

Pages without table of contents

Pages should have either [[TracGuideToc]] or [[PageOutline(2-5,Contents,pullout)]] in them for navigational purposes.

{{{#!SQLTable
SELECT w.name, w.author, w.time FROM wiki AS w WHERE w.version = (SELECT MAX(version) FROM wiki WHERE name = w.name) AND w.text NOT LIKE '%[[PageOutline(%'
}}}
Last modified 6 years ago Last modified on Jan 15, 2019, 6:59:42 PM
Note: See TracWiki for help on using the wiki.