fossil-stats-table.php
fossil-stats-table.php
This is a cron script that populates a statistics table in *.fossil repositories.
The fx_stats table summarizes source code language use (and the approximated amount of comments) in percentages.
Optionally, when traversing multiple
*.fossil
repos, this script can also collect associated projectName and projectDescription etc. in aprojects.json
file. I'm using this for the overview list.The
fx_searchis now redundant and will no longer be populated, because /search is built into new Fossil versions.
Configuration
Basically the only setup required is this line:
// Configure repository locations
$repo = "/www/fossil.d/*.fossil";
Set it to the base path of all your .fossil stores. Or constrain the glob.
You might have to optionally adapt $fossilbin = "fossil"
if it's not in the default shell $PATH.
Operation
It basically:
Loops over the *.fossil files, opens them as SQLite database
SELECTs all commited file names by CONTENT(UUID) via
fossil sqlite .csv
command line fetching.Catalogizes the source code language, and counts comment percentages, and finally stores those numbers into fx_stats.
Populates a few more general infos into the fx_stats table.
<style>main table { width:70%; margin-left: 30pt; }</style>
stats_social | int | Social bookmark blacklinks count |
stats_checkins | int | Number of checkins |
stats_files | int | Checked in files |
stats_tickets | int | Amount of tickets |
stats_developers | int | Count of developer/contributor accounts |
stats_branches | int | How many branches exist |
stats_tags | int | Number of tags |
stats_forks | int | Count of different checkout/sync URLs |
stats_releases | int | Number of v1.2.3 tags |
stats_name | str | Project name |
stats_description | str | Project description |
Only the stats_social
takes a little while longer, because it queries http://api.include-once.org/links/social.ajax.php?url=http://localhost/
. Each repo.fossil may contain a custom "homepage"
entry in the config
table to override the standard fossil webserver URL, btw.