Línea 89... |
Línea 89... |
89 |
*
|
89 |
*
|
90 |
* @param int $id If set, this is the id of an existing record, used to load the data.
|
90 |
* @param int $id If set, this is the id of an existing record, used to load the data.
|
91 |
* @param stdClass|null $record If set will be passed to from_record
|
91 |
* @param stdClass|null $record If set will be passed to from_record
|
92 |
* @param null|array $metadata
|
92 |
* @param null|array $metadata
|
93 |
*/
|
93 |
*/
|
94 |
public function __construct($id = 0, stdClass $record = null, ?array $metadata = null) {
|
94 |
public function __construct($id = 0, ?stdClass $record = null, ?array $metadata = null) {
|
95 |
if ($record) {
|
95 |
if ($record) {
|
96 |
$record->headless = $record->headless ?? false;
|
96 |
$record->headless = $record->headless ?? false;
|
97 |
$record->imported = $record->imported ?? false;
|
97 |
$record->imported = $record->imported ?? false;
|
98 |
$record->groupid = $record->groupid ?? 0;
|
98 |
$record->groupid = $record->groupid ?? 0;
|
99 |
$record->status = $record->status ?? self::RECORDING_STATUS_AWAITING;
|
99 |
$record->status = $record->status ?? self::RECORDING_STATUS_AWAITING;
|
Línea 712... |
Línea 712... |
712 |
return $recording->recordingid;
|
712 |
return $recording->recordingid;
|
713 |
}, $recordings));
|
713 |
}, $recordings));
|
Línea 714... |
Línea 714... |
714 |
|
714 |
|
715 |
// Fetch all metadata for these recordings.
|
715 |
// Fetch all metadata for these recordings.
|
- |
|
716 |
$metadatas = recording_proxy::fetch_recordings($recordingids);
|
Línea 716... |
Línea 717... |
716 |
$metadatas = recording_proxy::fetch_recordings($recordingids);
|
717 |
$failedids = recording_proxy::fetch_missing_recordings($recordingids);
|
717 |
|
718 |
|
718 |
// Return the instances.
|
719 |
// Return the instances.
|
719 |
return array_filter(array_map(function ($recording) use ($metadatas, $withindays) {
|
720 |
return array_filter(array_map(function ($recording) use ($metadatas, $withindays, $failedids) {
|
720 |
// Filter out if no metadata was fetched.
|
721 |
// Filter out if no metadata was fetched.
|
721 |
if (!array_key_exists($recording->recordingid, $metadatas)) {
|
722 |
if (!array_key_exists($recording->recordingid, $metadatas)) {
|
722 |
// Mark it as dismissed if it is older than 30 days.
|
723 |
// If the recording was successfully fetched, mark it as dismissed if it is older than 30 days.
|
723 |
if ($withindays > $recording->timecreated) {
|
724 |
if (!in_array($recording->recordingid, $failedids) && $withindays > $recording->timecreated) {
|
724 |
$recording = new self(0, $recording, null);
|
725 |
$recording = new self(0, $recording, null);
|
725 |
$recording->set_status(self::RECORDING_STATUS_DISMISSED);
|
726 |
$recording->set_status(self::RECORDING_STATUS_DISMISSED);
|
726 |
}
|
727 |
}
|