Where to look

The tasks are in site administration, not inside a course:

  1. Sign in as a site administrator.
  2. Open Site administration → Server → Scheduled tasks (/admin/tool/task/scheduledtasks.php).
  3. Search for local_stream. You should see six tasks for the local_stream component.

Each row shows the task name, the last run, and the next run. A disabled row is skipped by Cron.

Requirement: Moodle Cron

Changing the schedule does not run anything by itself. The Moodle server must run Cron, usually every minute:

* * * * * php /path/to/moodle/admin/cli/cron.php

Replace /path/to/moodle with the real site path. Without that line, the “next run” time passes and the task never starts.

Task order

A class recording passes through three steps, then separate maintenance tasks. The plugin sets the defaults; you can change them without editing code.

Name in the admin UI Class Default
Index recordings local_stream\task\listing Every 5 minutes
Upload recordings local_stream\task\upload Every 5 minutes
Embedded recordings local_stream\task\embed Every 5 minutes
Delete recordings local_stream\task\delete Every minute during hours 0, 6, 12, and 18
Refresh token local_stream\task\refresh_token At 00:00, every 5 days
Revoke Zoom license from inactive users local_stream\task\revoke_zoom_license At minute 30, every 2 hours

Index recordings

The task calls the platform selected in the plugin — Zoom, Teams, Webex, or Unicko — and stores the recording list in local_stream_rec. It does not upload a file to Stream and it does not place a video in a course.

For Zoom and Unicko the window is the number of days in Days to listing. Webex walks that same window one day at a time. Teams pulls the list through the configured connection.

A healthy Zoom or Webex run prints a JSON line with from and to. No output and no error means there is nothing new in the window, or the platform is not Zoom or Webex.

Upload recordings

The task takes rows that are queued or still processing, downloads the recording file, and uploads it to Stream storage.

  • If the queue is empty, the output is Task: No meetings were found.
  • If there are rows, the output counts them: Task: Found N meetings, then one line per recording.
  • After more than two failed attempts while processing, the row is marked invalid and is not tried again.
  • When storage is Stream and “upload only with a course” is on, a recording with no Moodle course is skipped.

A successful upload queues a message to the lecturer. That message is not a scheduled task: it appears under Ad hoc tasks and runs on the next Cron. It has no schedule of its own.

Embedded recordings

The task takes up to 100 recordings that are ready and not yet embedded, and adds them to the STREAM activity in the course linked to the meeting. It follows the meeting host’s embed preferences.

If grouping by meeting is on, one recording is kept per meeting and the rest are marked so they are not processed again.

If there is nothing to embed, the output is There are no recordings to be embedded. If mod_stream is not installed, the task stops with mod_stream module type not found.

Delete recordings

This task cleans up. It is not part of the regular sync:

  • Rows marked for deletion are moved to the archive.
  • On Zoom, if Delete Zoom recording after embedding is set, the cloud copy is removed that many hours after embedding. Playback in Moodle continues from the Stream copy.
  • On Unicko, if cleanup days are set, older recordings are deleted from Unicko.

The default is minute * and hour */6: the task may run every minute during 00:00–00:59, 06:00–06:59, 12:00–12:59, and 18:00–18:59. If that is too often, set the minute to 0 so it runs once in each of those hours.

Refresh token

This matters only when the platform is Webex. The task replaces the access token using the refresh token stored in the plugin settings. On Zoom, Teams, and Unicko it has nothing to do.

Default: minute 0, hour 0, day */5 — at midnight, every five days. Success looks like Task: refresh token expires in: .... Failure looks like Task: followed by the Webex error.

Revoke Zoom license

Runs only when the platform is Zoom and revoking licenses from inactive users is enabled. It skips members of the Zoom groups you excluded, anyone currently in a meeting, and anyone who signed in recently.

Default: minute 30 and hour */2 — at 00:30, 02:30, 04:30, and so on. If licenses were removed, the output includes Revoked Zoom license for N user(s). If Zoom cannot be read, the task prints the reason and exits without revoking anything.

Run by hand

A manual run starts the task immediately, without waiting for the schedule. Use it after a class, after a settings change, or when the last run failed.

From the admin page

  1. On Scheduled tasks, find the row.
  2. Click Run now.
  3. Wait until it finishes. Moodle shows the same output the server would print.

If there is no button, the task is disabled or you are not a site admin. Enable it, save, and try again.

From the command line

Run this on the server, as the same user that serves the site. Replace the path and the class name:

php /path/to/moodle/admin/cli/scheduled_task.php --execute='\local_stream\task\listing'

Use the same command for the other tasks. Change only the last part:

  • \local_stream\task\listing
  • \local_stream\task\upload
  • \local_stream\task\embed
  • \local_stream\task\delete
  • \local_stream\task\refresh_token
  • \local_stream\task\revoke_zoom_license

To list every task and the saved schedule:

php /path/to/moodle/admin/cli/scheduled_task.php --list

To test one new recording, run them in order: listing, then upload, then embed. Delete, token refresh, and license revoke are not part of that check.

Change the schedule

  1. On Scheduled tasks, open the edit icon on the task row.
  2. Edit the five fields: Minute, Hour, Day, Month, Day of week.
  3. Save. “Next run” updates immediately. The next Cron honours the new schedule.

The syntax is Cron syntax:

  • * — every value.
  • */15 — every 15 units.
  • 30 — only at 30.
  • 1-5 — a range. For day of week: 0 is Sunday, 1 is Monday, through 6 Saturday.

Examples you can copy. Leave any field that is not listed as *.

WhenMinuteHourDay of week
Every 15 minutes, all day*/15**
Every hour, on the hour0**
Once a night, at 02:30302*
Weekdays at 08:00081-5
Cleanup once a day, at 03:0003*
Note: listing, upload, and embed depend on each other. If indexing runs once a night and upload runs every 5 minutes, a new recording waits until the next index. Keep those three on a similar cadence, for example every 15 minutes.

To restore the plugin default, put the five fields back to the values in the table above. If the edit page offers a reset to default, you can use that instead.

What to check afterwards

  • On the task row, “Last run” is the time of this check, and there is no failure mark.
  • The output has no Task Error, no API error, and no message about missing database fields. A missing-field message on delete means the plugin needs an upgrade.
  • After listing, a new row exists. After upload, the status moves forward. After embed, the video appears in the course STREAM activity.
  • If a task keeps failing, Moodle delays the next run. A successful manual run clears that delay.

Plugin setup, including days to listing and the Zoom connection, is in the Moodle integration guide.