Edgewall Software

Changes between Initial Version and Version 1 of CookBook/SpecialPages


Ignore:
Timestamp:
Jan 15, 2019, 6:59:42 PM (5 years ago)
Author:
figaro
Comment:

New page

Legend:

Unmodified
Added
Removed
Modified
  • CookBook/SpecialPages

    v1 v1  
     1[[PageOutline(2-3,Contents)]]
     2
     3= Site maintenance
     4
     5The 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:Special:SpecialPages Wikipedia's Special pages].
     6
     7The SQL code here is specific for [https://www.sqlite.org/index.html SQLite] as the database backend, else it is SQL-pseudocode. Some of the examples use [th:WikiTableMacro] as the database query wrapper.
     8
     9== Old wiki pages
     10
     11Pages which have not been edited in at least 5 years usually require a cleanup or can be marked for deletion.
     12
     13{{{
     14{{{#!SQLTable
     15SELECT 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
     16}}}
     17}}}
     18
     19== Old tickets
     20
     21Tickets which have not been edited in at least a year usually require a cleanup or can be marked for deletion.
     22
     23{{{
     24{{{#!SQLTable
     25SELECT t.id, t.owner, t.changetime FROM ticket AS t WHERE julianday('now') - (((t.changetime/1000000)/86400.0) + 2440587.5 ) > 365
     26}}}
     27}}}
     28
     29== Obsolete macros
     30
     31There may still be some obsolete macros circulating in the wiki, such as `TagIt[[()]]`, and they need to be removed.
     32
     33Possible solution:
     34{{{#!sql
     35SELECT w.name FROM wiki AS w WHERE w.version = (SELECT MAX(version) FROM wiki WHERE name = w.name) AND w.text LIKE '%TagIt[[%';
     36}}}
     37
     38== List of all images
     39
     40A list of all images on the Trac installation is useful for the following purposes:
     41- 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.
     42- 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.
     43- jpgs may have been used, where png or svg is the norm.
     44
     45Possible solution:
     46{{{#!sql
     47SELECT id, filename FROM attachment WHERE RIGHT(filename, 3) IN ('jpg', 'gif', 'svg', 'png', 'bmp');
     48}}}
     49
     50== Attachments
     51
     52A list of all attachments on the Trac installation is useful for the following purposes:
     53- 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.
     54- someone may have uploaded an attachment in the past that is irrelevant to the use or development of Trac.
     55
     56{{{
     57{{{#!SQLTable
     58SELECT 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)
     59}}}
     60}}}
     61
     62== Acronyms
     63
     64Misused or accidental acronyms where spelling them out would make the text clearer: from `db` to `database`, from `regex` to `regular expression`, from `"` to `"`.
     65
     66Possible solution:
     67{{{#!sql
     68SELECT 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 (,);
     69}}}
     70
     71== Short wiki pages
     72
     73Pages with little text are usually the result of a test or have been abandoned and are therefore candidates for deletion.
     74
     75{{{
     76{{{#!SQLTable
     77SELECT 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
     78}}}
     79}}}
     80
     81== Dead links
     82
     83Dead 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.
     84
     85In Python it would reuse code as follows:
     86{{{#!python
     87if not validate_page_name(self.name): raise TracError(_("Invalid Wiki page name '%(name)s'", name=self.name))]
     88}}}
     89
     90As a workaround it is also possible to use the [https://validator.w3.org/checklink W3C validator].
     91 
     92== Protected pages
     93
     94Pages that are read-only may need to have their status reviewed.
     95
     96{{{
     97{{{#!SQLTable
     98SELECT 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
     99}}}
     100}}}
     101
     102== Pages without table of contents
     103
     104Pages should have either `[[TracGuideToc]]` or `[[PageOutline(2-5,Contents,pullout)]]` in them for navigational purposes.
     105
     106{{{
     107{{{#!SQLTable
     108SELECT 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(%'
     109}}}
     110}}}
     111