Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ad96f6a
fix: stop deleting ClickMeeting rooms that are still in use
bmarcinkowski Oct 8, 2026
fa25bc5
chore: fix coding style violations reported by Moodle Code Checker
bmarcinkowski Oct 8, 2026
f87c899
fix: shorten new table name to install on Moodle 4.1 and earlier
bmarcinkowski Oct 9, 2026
6b485c7
Merge branch 'fix/deferred-room-deletion' into chore/coding-style
bmarcinkowski Oct 9, 2026
e2ac072
fix: honour erasure requests for the room owner
bmarcinkowski Oct 9, 2026
7bd2683
Merge branch 'fix/deferred-room-deletion' into chore/coding-style
bmarcinkowski Oct 9, 2026
39ad80d
ci: test against currently supported Moodle releases
bmarcinkowski Oct 9, 2026
86cd6fe
Merge branch 'fix/deferred-room-deletion' into chore/coding-style
bmarcinkowski Oct 9, 2026
9b51f39
ci: pin release actions to commit SHAs and drop unneeded token scope
bmarcinkowski Oct 9, 2026
0647837
Merge branch 'fix/deferred-room-deletion' into chore/coding-style
bmarcinkowski Oct 9, 2026
0801e4e
feat: declare supported Moodle branches
bmarcinkowski Oct 9, 2026
356c15f
Merge branch 'fix/deferred-room-deletion' into chore/coding-style
bmarcinkowski Oct 9, 2026
53880f2
fix: stop the release ZIP from nesting a copy of the plugin inside it…
bmarcinkowski Oct 9, 2026
c01f502
Merge branch 'fix/deferred-room-deletion' into chore/coding-style
bmarcinkowski Oct 9, 2026
7c9293a
Merge pull request #48 from ClickMeeting/chore/coding-style
bmarcinkowski Oct 9, 2026
436053b
fix: book a new ClickMeeting room when an activity is restored
bmarcinkowski Oct 13, 2026
15d2d05
fix: send the edited values when updating a ClickMeeting room
bmarcinkowski Oct 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 33 additions & 23 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ name: Moodle Plugin CI

on: [push, pull_request]

# Nothing here writes to the repository.
permissions:
contents: read

jobs:
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

services:
postgres:
image: postgres:15
image: postgres:17
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
Expand All @@ -17,51 +21,57 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3

mariadb:
image: mariadb:10.11
image: mariadb:11.4
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
fail-fast: false
matrix:
# Each Moodle branch is paired only with PHP versions it actually supports, so a red
# job means the plugin is broken rather than the combination being impossible.
include:
# Moodle 4.0.1 - PHP 7.4, 8.0, 8.1
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: pgsql
- php: '8.0'
moodle-branch: 'MOODLE_401_STABLE'
database: pgsql
# Moodle 4.1 LTS - oldest release this plugin is tested against.
- php: '8.1'
moodle-branch: 'MOODLE_401_STABLE'
database: pgsql
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: mariadb
- php: '8.0'
moodle-branch: 'MOODLE_401_STABLE'
database: mariadb
- php: '8.1'
moodle-branch: 'MOODLE_401_STABLE'
database: mariadb
# Moodle 4.0.5 - 8.1, 8.2
# Moodle 4.5 LTS - what the plugins directory currently advertises.
- php: '8.1'
moodle-branch: 'MOODLE_405_STABLE'
database: pgsql
- php: '8.2'
moodle-branch: 'MOODLE_405_STABLE'
database: pgsql
- php: '8.1'
- php: '8.3'
moodle-branch: 'MOODLE_405_STABLE'
database: mariadb
# Moodle 5.0
- php: '8.2'
moodle-branch: 'MOODLE_405_STABLE'
moodle-branch: 'MOODLE_500_STABLE'
database: pgsql
- php: '8.3'
moodle-branch: 'MOODLE_500_STABLE'
database: mariadb
# Moodle 5.1 - first release with the public/ directory layout.
- php: '8.3'
moodle-branch: 'MOODLE_501_STABLE'
database: pgsql
# Moodle 5.2
- php: '8.3'
moodle-branch: 'MOODLE_502_STABLE'
database: mariadb
# Moodle 5.3 - latest release.
- php: '8.3'
moodle-branch: 'MOODLE_503_STABLE'
database: pgsql
- php: '8.3'
moodle-branch: 'MOODLE_503_STABLE'
database: mariadb

steps:
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ on:
release:
types: [created]

# Publishing the release asset is the only thing this workflow needs to write.
permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
# Checking out straight into the plugin directory name gives the ZIP its required
# layout without copying, which previously nested a partial copy of the plugin
# inside itself because the glob already matched the freshly created directory.
- name: Check out into the plugin directory
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
path: mod_clickmeeting

- name: Create ZIP file
run: |
mkdir mod_clickmeeting
cp -R * mod_clickmeeting/ 2>/dev/null || true
zip -r mod_clickmeeting.zip mod_clickmeeting -x "*.git*"
run: zip -r mod_clickmeeting.zip mod_clickmeeting -x "*.git*"

- name: Upload Release Asset
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
files: mod_clickmeeting.zip
env:
Expand Down
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Changelog

## v1.2.0 (2026-10-08)

Fixes meetings and recordings disappearing from ClickMeeting without anyone deleting them
on purpose.

### Fixed

- **Deleting an activity no longer destroys the room immediately.** Moodle activity deletion
is reversible — it goes through the recycle bin and runs from cron — but the room in
ClickMeeting was being deleted right away. Restoring the activity brought back a link to a
room that no longer existed. Rooms now outlive their activity by a configurable grace
period, five months by default.
- **A room shared by several activities survives.** Copying, importing or restoring a course
duplicates the activity while both copies keep pointing at the same ClickMeeting room.
Deleting either copy destroyed the room for the other one, in a course nobody had touched.
A room is now only deleted once no activity refers to it.
- **Deletions use the room owner's API key.** The key was taken from whoever happened to be
acting, which under cron is nobody in particular, so the request fell back to the main
account key and could reach a room on a different subaccount.
- **Activities whose room record is missing can be deleted again.** Previously the deletion
failed indefinitely and the activity could never be removed from the course.
- **Access tokens are removed with their activity.** They identify participants and were
being left behind in the database.

### Added

- Admin setting "Keep deleted rooms for" (`clickmeeting/graceperiod`), default five months.
- Scheduled task `mod_clickmeeting\task\purge_deleted_rooms`, which deletes rooms once their
grace period has passed. Runs daily at 03:20.
- Event `mod_clickmeeting\event\room_deleted`, logged whenever a room is really deleted, so
a missing meeting can be traced back to when and why it went away.
- PHPUnit coverage for the deletion lifecycle.
- Privacy API support for the new table: the room owner is discoverable and is cleared on an
erasure request, while the room itself stays scheduled for deletion.

### Compatibility

Declares `$plugin->supported = [39, 503]`: Moodle 3.9 LTS through 5.3, each verified with a
clean install and a v1.1.5 upgrade. This is advisory - it does not block installation - and
makes the plugin show as compatible for Moodle 5.x in the plugins directory.

### Upgrade notes

Adds the table `clickmeeting_room_deletions`. Existing data is untouched. Rooms already
deleted before this release cannot be recovered.
1 change: 0 additions & 1 deletion backup/moodle2/backup_clickmeeting_activity_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_clickmeeting_activity_task extends backup_activity_task {

/**
* Define (add) particular settings this activity can have
*/
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_clickmeeting_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* Define the complete choice structure
*/
class backup_activity_structure_step extends \backup_activity_structure_step {

/**
* Define the complete structure for backup
*/
Expand All @@ -45,6 +44,7 @@ protected function define_structure() {
'course',
'name',
'description',
'room_type',
'lobby_msg',
'start_time',
'access_type',
Expand Down
14 changes: 9 additions & 5 deletions backup/moodle2/restore_clickmeeting_activity_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_clickmeeting_activity_task extends restore_activity_task {

/**
* Define (add) particular settings this activity can have
*/
Expand Down Expand Up @@ -68,7 +67,6 @@ public static function define_decode_rules() {
$rules[] = new restore_decode_rule('CLICKMEETINGINDEX', '/mod/clickmeeting/index.php?id=$1', 'course');

return $rules;

}

/**
Expand Down Expand Up @@ -104,11 +102,17 @@ public static function define_restore_log_rules_for_course() {
$rules = [];

// Fix old wrong uses (missing extension)
$rules[] = new restore_log_rule('clickmeeting', 'view all', 'index?id={course}', null,
null, null, 'index.php?id={course}');
$rules[] = new restore_log_rule(
'clickmeeting',
'view all',
'index?id={course}',
null,
null,
null,
'index.php?id={course}'
);
$rules[] = new restore_log_rule('clickmeeting', 'view all', 'index.php?id={course}', null);

return $rules;
}

}
56 changes: 51 additions & 5 deletions backup/moodle2/restore_clickmeeting_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_activity_structure_step extends \restore_activity_structure_step {

/**
* Defines table structure
*/
Expand Down Expand Up @@ -60,19 +59,66 @@ protected function process_clickmeeting($data) {
}

/**
* Inserts conference data into new table
* Creates a brand new ClickMeeting room for the restored activity.
*
* The backed up room belongs to the original activity and must not be shared: a copy would
* let two activities (and two courses) drive the same conference, and deleting one would
* take the other down with it. Restoring therefore books a fresh room through the API,
* owned by whoever is running the restore.
*
* @param object $data
*/
protected function process_clickmeeting_conferences($data) {
global $DB, $USER;
global $CFG, $DB, $USER;
global $clickmeetingowner;
require_once($CFG->dirroot . '/mod/clickmeeting/lib.php');

$data = (object)$data;
$oldid = $data->id;
$data->user_id = $USER->id;
$data->clickmeeting_id = $this->get_new_parentid('clickmeeting');

$newitemid = $DB->insert_record('clickmeeting_conferences', $data);
$clickmeeting = $DB->get_record('clickmeeting', ['id' => $data->clickmeeting_id], '*', MUST_EXIST);

// The room is created with the restoring user's API key, so it has to be billed to them too.
$clickmeetingowner = $USER->id;

$password = clickmeeting_generate_password(8);

$params = [
'name' => $clickmeeting->name,
// Backups taken before room_type was exported carry no type; webinar is the plugin default.
'room_type' => !empty($clickmeeting->room_type) ? $clickmeeting->room_type : 'webinar',
'permanent_room' => '0',
'access_type' => $clickmeeting->access_type,
'lobby_description' => $clickmeeting->lobby_msg,
'starts_at' => $clickmeeting->start_time,
'duration' => $clickmeeting->duration,
'timezone' => date_default_timezone_get(),
'password' => $password,
];

$r = json_decode(clickmeeting_add_conference($params), true);

if (!empty($r['code'])) {
$error = '';
foreach ($r['errors'] as $err) {
$error .= $err['message'] . '<br />';
}
throw new \moodle_exception($error, 'error');
}

if (!isset($r['room'])) {
throw new \moodle_exception('cannotcreateroom', 'clickmeeting');
}

$room = $r['room'];
$data->conference_id = $room['id'];
$data->room_url = $room['room_url'];
$data->embed_room = $room['embed_room_url'];
$data->room_pin = $room['room_pin'];
$data->password = $password;

$DB->insert_record('clickmeeting_conferences', $data);
}

/**
Expand Down
56 changes: 56 additions & 0 deletions classes/event/room_deleted.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace mod_clickmeeting\event;

/**
* Fired when a room is permanently removed from ClickMeeting.
*
* Deletion happens long after the Moodle activity disappears, so this event is what
* ties a missing meeting back to the moment and the reason it was destroyed.
*
* @package mod_clickmeeting
* @copyright 2026 Clickmeeting
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class room_deleted extends \core\event\base {
/**
* Sets the event metadata.
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
}

/**
* Returns the localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('event:roomdeleted', 'clickmeeting');
}

/**
* Returns a description of what happened.
*
* @return string
*/
public function get_description() {
return "The ClickMeeting room with id '{$this->other['conferenceid']}' was deleted " .
"because its Moodle activity had been removed and the grace period expired.";
}
}
Loading
Loading