Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Developer credits processor

From MoodleDocs
Developer credits processor
Project state In production
Tracker issue MDLSITE-1663
Discussion N/A
Assignee David Mudrak


Project goals

We need to replace part of the functionality provided by the legacy cvsadmin plugin at moodle.org. The new local plugin /local/dev is supposed to:

  • gather activity traces of git commits in the main moodle.git repository
  • gather activity traces of comments and transitions in JIRA
  • assign activity traces to real moodle.org users
  • produce a list of Moodle developers and simple amount of their contribution (per branch and per release)

Design principles

  • It must be cheap to display the data to the visitors of moodle.org site (with just one or two SQL queries)
  • Data collecting and processing should be implemented in CLI scripts. Then we can schedule their execution accurately via robust Unix crontab syntax and we don't pollute Apache's access logs.

Overall architecture

The following image displays the basic architecture of the plugin and how it applies to the two sources of activity records - moodle.git repository and the JIRA tracker.

Basic processes of collecting and aggregating activity traces in Moodle development


There is a table {dev_activity} that is the only one used when displaying the contribution data. A subclass of table_sql is used so it takes care of sorting and pagination.

Rows in the {dev_activity} table are updated by the script cli/aggregate.php. For every tracked activity source (like moodle.git, JIRA or whatever else in the future) there is a class that is responsible for updating its activity metric (eg. gitcommits, gitmerges etc).

There can be various tables for each tracked activity source to hold the data for the aggregating class. These tables are populated with data as needed.

Processing moodle.git commits

  • The plugin keeps its own mirror of moodle.git in moodledata (cloned with --mirror parameter)
  • The script cli/git-commits.php reads commits from all MOODLE_xx_STABLE branches as well as from the master branch and records them in the {dev_git_commits} table
  • The script cli/git-tags.php assigns each commit to the Moodle release it belongs to
  • The script cli/git-aliases.php tries to assign each commit to the real moodle.org user account (based on the email in the commit and eventually any explicit mapping defined in {dev_git_user_aliases} table).
  • The script cli/aggregates.php uses two classes dev_gitcommits_aggregator and dev_gitmerges_aggregator that are responsible for aggregating commits and merges (respectively) and linking them to Moodle versions (by converting the associated Git tag to a Moodle version).