Browse Source

Fix delete record see BT#13451

jmontoyaa 7 years ago
parent
commit
1a597b9afd
1 changed files with 23 additions and 14 deletions
  1. 23 14
      plugin/bbb/lib/bbb.lib.php

+ 23 - 14
plugin/bbb/lib/bbb.lib.php

@@ -1070,21 +1070,30 @@ class bbb
             'first'
         );
 
-        $recordingParams = array(
-            /*
-             * NOTE: Set the recordId below to a valid id after you have
-             * created a recorded meeting, and received a real recordID
-             * back from your BBB server using the
-             * getRecordingsWithXmlResponseArray method.
-             */
-
-            // REQUIRED - We have to know which recording:
-            'recordId' => $meetingData['remote_id'],
-        );
-
-        $result = $this->api->deleteRecordingsWithXmlResponseArray($recordingParams);
+        $delete = false;
+        // Check if there are recordings for this meeting
+        $recordings = $this->api->getRecordingsWithXmlResponseArray(['meetingId' => $meetingData['remote_id']]);
+        if (!empty($recordings) && isset($recordings['messageKey']) && $recordings['messageKey'] == 'noRecordings') {
+            $delete = true;
+        } else {
+            $recordingParams = array(
+                /*
+                 * NOTE: Set the recordId below to a valid id after you have
+                 * created a recorded meeting, and received a real recordID
+                 * back from your BBB server using the
+                 * getRecordingsWithXmlResponseArray method.
+                 */
+
+                // REQUIRED - We have to know which recording:
+                'recordId' => $meetingData['remote_id'],
+            );
+            $result = $this->api->deleteRecordingsWithXmlResponseArray($recordingParams);
+            if (!empty($result) && isset($result['deleted']) && $result['deleted'] === 'true') {
+                $delete = true;
+            }
+        }
 
-        if (!empty($result) && isset($result['deleted']) && $result['deleted'] === 'true') {
+        if ($delete) {
             Database::delete(
                 'plugin_bbb_room',
                 array('meeting_id = ?' => array($id))