The Wiki for Tale 5 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

User:Numaris/Test Pass History

From ATITD5
Jump to navigationJump to search

The Test Pass History is a mostly-automated collection of all test passes that are announced in-game on the System channel.

Disclaimer

Source code linked below is provided unlicensed and without any guarantee. It is partially documented, but contains a lot of convoluted regex magic. I am not a professional programmer. If you are, the (lack of) structure/naming conventions/etc. may make you cringe.

Description

In Tale 4, Oujoule provided a publicly-accessible CGI script that, when run, read the entirety of the System channel and parsed it into a list of test passes. It presented the results as wiki code that could be copied and pasted into a page for simple updating. Late in T4, a few changes happened in the log system, one of which was to limit the time window that can be grabbed from the log to 30 days. This broke the existing system.

As a result, this implementation is slightly more complex. It consists of two Perl scripts and an SQLite database:

getpasses.pl

This script reads the last few days of the System log, checks with the database to find out which lines are new, and matches them against patterns to figure out if they represent test passes. If so, it grabs the necessary pass data and writes it to the database. I have a cron job set up that runs this script every hour. There is no output.

Source Code

printwiki.pl

This is the script that reads the pass data from the database and generates the wiki output. It is run whenever someone accesses it (via a link placed in the page itself). It obviously needs to be located where it can be executed and served by a web server.

Source Code

passes.db

This is the database. My implementation uses SQLite for simplicity. The SQL is very simple; it should be trivial to modify the scripts to use any other database back end that Perl DBI supports.

Most of the passes are held in the Passes table. Towers and Demi-Pharaoh have extra tables for holding more data. One table, TotalTowers, has no application in the Test Pass History, but could be interesting for anyone wishing to analyze the Towers history.

The database file needs to be readable by the web server.

Nightly Database Dump