-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathlib.php
More file actions
55 lines (42 loc) · 1.81 KB
/
lib.php
File metadata and controls
55 lines (42 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
use BigBlueButton\BigBlueButton;
define ("BBB_USAGE_VERSION", "1.1");
function getCurrentData ($show_server = "%")
{
require_once './vendor/autoload.php';
require_once 'conf.php';
global $bbb_secret , $servername;
putenv ("BBB_SECRET=$bbb_secret");
putenv ("BBB_SERVER_BASE_URL=$servername/bigbluebutton/");
$data = array ();
$bbb = new BigBlueButton();
$response = $bbb->getMeetings();
if ($response->getReturnCode() == 'SUCCESS') {
$content = $response->getRawXml();
foreach ($content->meetings->meeting as $meeting) {
// process all meetings and save usage data to array (by server)
$server = (string)$meeting->metadata->{'bbb-origin-server-name'};
if (($show_server == "%") or ($show_server == $server))
{
if (!array_key_exists($server, $data))
{
// new server - init stats (to avoid php warning undefined index)
$data [$server]['meeting_count'] = 0;
$data [$server]['participant_count'] = 0;
$data [$server]['voice_participant_count'] = 0;
$data [$server]['video_count'] = 0;
$data [$server]['breakout_count'] = 0;
}
$data [$server]['meeting_count'] += 1;
$data [$server]['participant_count'] += $meeting->participantCount;
$data [$server]['voice_participant_count'] += $meeting->voiceParticipantCount + $meeting->listenerCount;
$data [$server]['video_count'] += $meeting->videoCount;
if ((string)$meeting->isBreakout == "true")
{
$data [$server]['breakout_count'] += 1;
}
}
}
return $data;
}
}