Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-7015

"Updates API" migration

XMLWordPrintable

    • MDLSITE Sprint 2023-I1.1, MDLSITE Sprint 2023-I1.2, MDLSITE Sprint 2023-I1.3

      The Updates API is the interface that enables developers and Moodle LMS instances to access the available updates of the core or a particular plugin.

      Repository:

      serverscripts

      Endpoints:

      • updates.php: given a Moodle branch and version, and optionally a list of third-party plugins, returns the available updates for them.
      • pluginfo.php: to get information about a specific plugin.
      • pluglist.php: provides the list of all available plugins in the Plugins directory

      There are two additional scripts to generate the information the API requires:

      • calculate_pluginsinfo.php: fetches the plugin's information from the plugins directory (moodle.org server) and generates a json file with it.
      • calculate_releasesinfo.php: generates a json file with the Moodle releases packages data. It is invoked on moodle-package-extract-and-postprocess.

      The endpoint queries are recorded in files (a file per day/month/year) in the data/logs folder. There are two scripts to process these logs (via cron), storing the statistics in the data/stats folder:

      • make_daily_stats.php: generates the stats for a single day.
      • make_monthly_stats.php: generates the stats for a single month.

      Path

      /var/www/vhosts/download.moodle.org/html-extra/api

      Folder structure:

      • one folder for each API version; the last Moodle versions use 1.3
      • current: link referencing the folder of the API version in use
      • data: folder with files required and generated by the API:
        • logs: files where queries to the endpoints are recorded
        • stats: files with the generated statistics by year, month and day
        • plugins.json: plugins info file generated by calculate_pluginsinfo.php
        • releases.json: releases info file, generated by calculate_releasesinfo.php

      cron entries

      Linux jobs to keep the API code and the stats updated :

      # Puppet Name: downloadmoodleorg auto-deploy updates-api
      6 * * * * /var/www/vhosts/download.moodle.org/bin/moodle-autodeploy-updates_api > /dev/null 2>&1
      # Puppet Name: downloadmoodleorg update plugins info
      */15 * * * * /var/www/vhosts/download.moodle.org/bin/moodle-updatepluginsinfo > /dev/null 2>&1
      # Puppet Name: downloadmoodleorg calculate daily stats
      20 5 * * * /var/www/vhosts/download.moodle.org/bin/moodle-updatedailystats > /dev/null 2>&1
      # Puppet Name: downloadmoodleorg calculate monthly stats
      30 5 1 * * /var/www/vhosts/download.moodle.org/bin/moodle-updatemonthlystats > /dev/null 2>&1
      

      After migrating to the new server, the Updates API endpoints and additional scripts MUST work.

            vmdef Victor Déniz Falcón
            vmdef Victor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.