Skip to content

Commit

Permalink
MDL-75383 mod_bigbluebuttonbn: Warn user when cron is disabled
Browse files Browse the repository at this point in the history
* Add a last update date for the recordings
* Check cron is running and if not show an error message
  • Loading branch information
laurentdavid committed Oct 6, 2022
1 parent 24f97ed commit cc3fe31
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
15 changes: 14 additions & 1 deletion mod/bigbluebuttonbn/classes/output/view_page.php
Expand Up @@ -16,6 +16,7 @@

namespace mod_bigbluebuttonbn\output;

use core\check\result;
use core\output\notification;
use mod_bigbluebuttonbn\instance;
use mod_bigbluebuttonbn\local\config;
Expand All @@ -24,6 +25,7 @@
use renderer_base;
use stdClass;
use templatable;
use tool_task\check\cronrunning;

/**
* View Page template renderable.
Expand Down Expand Up @@ -97,11 +99,22 @@ public function export_for_template(renderer_base $output): stdClass {
$templatedata->room = $roomdata;
}

$templatedata->recordingwarnings = [];
$check = new cronrunning();
$result = $check->get_result();
if ($result->status != result::OK && $this->instance->is_moderator()) {
$templatedata->recordingwarnings[] = (new notification(
get_string('view_message_cron_disabled', 'mod_bigbluebuttonbn',
$result->get_summary()),
notification::NOTIFY_ERROR,
false
))->export_for_template($output);
}
if ($this->instance->is_feature_enabled('showrecordings') && $this->instance->is_recorded()) {
$recordings = new recordings_session($this->instance);
$templatedata->recordings = $recordings->export_for_template($output);
} else if ($this->instance->is_type_recordings_only()) {
$templatedata->recordingwarning = (new notification(
$templatedata->recordingwarnings[] = (new notification(
get_string('view_message_recordings_disabled', 'mod_bigbluebuttonbn'),
notification::NOTIFY_WARNING,
false
Expand Down
2 changes: 2 additions & 0 deletions mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php
Expand Up @@ -476,6 +476,8 @@
$string['view_message_conference_has_ended'] = 'The session has ended.';
$string['view_message_tab_close'] = 'This tab/window must be closed manually';
$string['view_message_recordings_disabled'] = 'Recordings are disabled on the server. BigBlueButton activities of type \'Recordings only\' cannot be used.';
$string['view_message_cron_disabled'] = 'The scheduled task to fetch pending recordings has not been run for a while.
Please contact the site administrator with the following information: {$a}.';
$string['view_message_importrecordings_disabled'] = 'Import recording links is disabled on the server.';

$string['view_groups_selection_warning'] = 'There is a room for each group and you have access to more than one. Be sure to select the correct one.';
Expand Down
10 changes: 10 additions & 0 deletions mod/bigbluebuttonbn/templates/recordings_table.mustache
Expand Up @@ -31,6 +31,11 @@
<div>
<h4>{{$title}}{{/title}}</h4>
</div>
<div class="mt-3">
{{#recordingwarnings}}
{{>core/notification}}
{{/recordingwarnings}}
</div>
<div>
{{#search}}
{{>mod_bigbluebuttonbn/search_input_recordings}}
Expand All @@ -46,6 +51,11 @@
{{/has_recordings}}
{{^has_recordings}}
<div id="bigbluebuttonbn_recordings_table">{{#str}}view_message_norecordings, mod_bigbluebuttonbn{{/str}}</div>
<div class="mt-3">
{{#recordingwarnings}}
{{>core/notification}}
{{/recordingwarnings}}
</div>
{{/has_recordings}}
</div>

Expand Down
4 changes: 0 additions & 4 deletions mod/bigbluebuttonbn/templates/view_page.mustache
Expand Up @@ -59,10 +59,6 @@
{{>mod_bigbluebuttonbn/recordings_session}}
{{/recordings}}

{{#recordingwarning}}
{{>core/notification}}
{{/recordingwarning}}

{{#js}}
require(['mod_bigbluebuttonbn/rooms'], function(rooms) {
// Register action on all buttons.
Expand Down

0 comments on commit cc3fe31

Please sign in to comment.