Wiki page
[fossil-stats-table.php] by
mario
2015-02-12 12:48:24.
D 2015-02-12T12:48:24.565
L fossil-stats-table.php
N text/x-markdown
P be46f59d4880f62889f2a155a9ae475f7c68d04b
U mario
W 2347
<h3> fossil-stats-table.php </h3>
This is a cron script that populates a statistics table in *.fossil repositories.
* The [fx_stats](wiki/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 a <b>`projects.json`</b> file. I'm using this [for the overview](http://fossil.include-once.org/) list.
* The <s>[fx_search](wiki/fx_search)</s> is now redundant and will no longer be populated, because /search is built into new Fossil versions.
<h4> Configuration </h4>
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.
<h4> Operation </h4>
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](wiki/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.
Z 9f348ed0f1165c41e35336dc20f028b0