Plugin: BBB: Improve code readability

pull/4266/head
Angel Fernando Quiroz Campos 4 years ago
parent 6966c1ec7e
commit 0443e4bd7c
  1. 30
      plugin/bbb/cron_close_meeting.php
  2. 6
      plugin/bbb/lib/bbb.lib.php

@ -13,11 +13,18 @@ $roomTable = Database::get_main_table('plugin_bbb_room');
$applyAllUrls = 'true' === $plugin->get('plugin_bbb_multiple_urls_cron_apply_to_all');
$bbb = new bbb();
if ($bbb->pluginEnabled) {
$activeSessions = $bbb->getActiveSessions($applyAllUrls);
if (!empty($activeSessions)) {
foreach ($activeSessions as $value) {
if (!$bbb->pluginEnabled) {
return;
}
$activeSessions = $bbb->getActiveSessions($applyAllUrls);
if (empty($activeSessions)) {
return;
}
foreach ($activeSessions as $value) {
$meetingId = $value['id'];
$courseCode = null;
$courseInfo = api_get_course_info_by_id($value['c_id']);
@ -42,9 +49,16 @@ if ($bbb->pluginEnabled) {
$meetingBBB = $bbb->getMeetingInfo($params);
}
if (!empty($meetingBBB)) {
if (isset($meetingBBB['returncode'])) {
if (empty($meetingBBB)) {
continue;
}
if (!isset($meetingBBB['returncode'])) {
continue;
}
$action = (string) $meetingBBB['returncode'];
switch ($action) {
case 'FAILED':
$bbb->endMeeting($value['id'], $courseCode);
@ -96,8 +110,4 @@ if ($bbb->pluginEnabled) {
break;
}
}
}
}
}
}

@ -1880,7 +1880,7 @@ class bbb
*
* @return array
*/
public function getActiveSessions(bool $allSites = false)
public function getActiveSessions(bool $allSites = false): array
{
$where = ['where' => ['status = ?' => 1]];
@ -1888,13 +1888,11 @@ class bbb
$where['where'][' AND access_url = ?'] = $this->accessUrl;
}
$meetingList = Database::select(
return Database::select(
'*',
$this->table,
$where
);
return $meetingList;
}
/**

Loading…
Cancel
Save