bbb: Add migration + add fixes

pull/4017/head
Julio 5 years ago
parent a4ea6acd62
commit 9d0ef3f557
  1. 9
      public/plugin/bbb/README.md
  2. 10
      public/plugin/bbb/admin.php
  3. 25
      public/plugin/bbb/lib/bbb.lib.php
  4. 45
      src/CoreBundle/Migrations/Schema/V200/Version20211005065400.php

@ -60,14 +60,21 @@ ALTER TABLE plugin_bbb_room MODIFY COLUMN out_at datetime;
```
For version 2.8
```sql
ALTER TABLE plugin_bbb_meeting ADD COLUMN internal_meeting_id VARCHAR(255) DEFAULT NULL;
ALTER TABLE plugin_bbb_room ADD close INT NOT NULL DEFAULT 0;
```
For version 2.9 (Optional, requires an update version of BBB)
```sql
ALTER TABLE plugin_bbb_room DROP COLUMN interface;
ALTER TABLE plugin_bbb_meeting DROP COLUMN interface;
```
## Improve access tracking in BBB
You need to configure the cron using the *cron_close_meeting.php* file.
# Digital ocean VM
In order to use DigitalOceanVM classes a new package is required:

@ -16,14 +16,14 @@ api_protect_admin_script();
$plugin = BBBPlugin::create();
$tool_name = $plugin->get_lang('Videoconference');
$isGlobal = isset($_GET['global']) ? true : false;
$isGlobal = isset($_GET['global']);
$bbb = new bbb('', '', $isGlobal);
$action = isset($_GET['action']) ? $_GET['action'] : null;
$action = $_GET['action'] ?? null;
$currentMonth = date('n');
$dateStart = isset($_REQUEST['search_meeting_start']) ? $_REQUEST['search_meeting_start'] : date('Y-m-d', mktime(1, 1, 1, $currentMonth, 1, date('Y')));
$dateEnd = isset($_REQUEST['search_meeting_end']) ? $_REQUEST['search_meeting_end'] : date('Y-m-d', mktime(1, 1, 1, ++$currentMonth, 0, date('Y')));
$dateStart = $_REQUEST['search_meeting_start'] ?? date('Y-m-d', mktime(1, 1, 1, $currentMonth, 1, date('Y')));
$dateEnd = $_REQUEST['search_meeting_end'] ?? date('Y-m-d', mktime(1, 1, 1, ++$currentMonth, 0, date('Y')));
$dateRange = [
'search_meeting_start' => $dateStart,
@ -48,7 +48,7 @@ foreach ($meetings as &$meeting) {
/** @var User $participant */
$participant = $meetingParticipant['participant'];
if ($participant) {
$meeting['participants'][] = $participant->getCompleteName().' ('.$participant->getEmail().')';
$meeting['participants'][] = UserManager::formatUserFullName($participant).' ('.$participant->getEmail().')';
}
}
}

@ -167,7 +167,7 @@ class bbb
*/
public function getUrlParams($courseId = 0, $sessionId = 0, $groupId = 0)
{
if (empty($this->courseCode) && !$courseId) {
if (empty($this->courseId) && !$courseId) {
if ($this->isGlobalConferencePerUserEnabled()) {
return 'global=1&user_id='.$this->userId;
}
@ -179,19 +179,16 @@ class bbb
return '';
}
$courseCode = $this->courseCode;
$defaultCourseId = (int) $this->courseId;
if (!empty($courseId)) {
$course = api_get_course_info_by_id($courseId);
if ($course) {
$courseCode = $course['code'];
}
$defaultCourseId = (int) $courseId;
}
return http_build_query(
[
'cid' => $courseId,
'sid' => $sessionId ?: $this->sessionId,
'gid' => $groupId ?: $this->groupId,
'cid' => $defaultCourseId,
'sid' => (int) $sessionId ?: $this->sessionId,
'gid' => (int) $groupId ?: $this->groupId,
]
);
}
@ -366,12 +363,12 @@ class bbb
$params['user_id'] = (int) $this->userId;
}
$params['attendee_pw'] = isset($params['attendee_pw']) ? $params['attendee_pw'] : $this->getUserMeetingPassword();
$params['attendee_pw'] = $params['attendee_pw'] ?? $this->getUserMeetingPassword();
$attendeePassword = $params['attendee_pw'];
$params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword();
$params['moderator_pw'] = $params['moderator_pw'] ?? $this->getModMeetingPassword();
$moderatorPassword = $params['moderator_pw'];
$params['record'] = api_get_course_plugin_setting('bbb', 'big_blue_button_record_and_store') == 1;
$params['record'] = api_get_course_plugin_setting('bbb', 'big_blue_button_record_and_store') == 1 ? 1 : 0;
$max = api_get_course_plugin_setting('bbb', 'big_blue_button_max_students_allowed');
$max = isset($max) ? $max : -1;
@ -386,7 +383,6 @@ class bbb
$params['access_url'] = $this->accessUrl;
$params['closed_at'] = '';
$id = Database::insert($this->table, $params);
if ($id) {
@ -473,9 +469,8 @@ class bbb
if ($this->isGlobalConference()) {
return 'url_'.api_get_current_access_url_id();
}
$courseCode = empty($courseCode) ? api_get_course_id() : $courseCode;
return $courseCode;
return empty($courseCode) ? api_get_course_id() : $courseCode;
}
/**

@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CoreBundle\Repository\ToolRepository;
use Chamilo\CourseBundle\Entity\CTool;
use Chamilo\CourseBundle\Entity\CToolIntro;
use Chamilo\CourseBundle\Repository\CToolIntroRepository;
use Chamilo\CourseBundle\Repository\CToolRepository;
use Doctrine\DBAL\Schema\Schema;
final class Version20211005065400 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Plugins - bbb';
}
public function up(Schema $schema): void
{
if ($schema->hasTable('plugin_bbb_meeting')) {
$table = $schema->getTable('plugin_bbb_meeting');
if (!$table->hasColumn('internal_meeting_id')) {
//$this->addSql('ALTER TABLE plugin_bbb_meeting ADD COLUMN internal_meeting_id VARCHAR(255) DEFAULT NULL;');
}
}
if ($schema->hasTable('plugin_bbb_room')) {
$table = $schema->getTable('plugin_bbb_room');
if (!$table->hasColumn('ALTER TABLE plugin_bbb_room ADD close INT NOT NULL DEFAULT 0;')) {
$this->addSql('');
}
}
}
public function down(Schema $schema): void
{
}
}
Loading…
Cancel
Save