|
|
|
@ -49,7 +49,8 @@
|
|
|
|
|
private static function sdir_validate_entry(
|
|
|
|
|
array $room_entry,
|
|
|
|
|
bool &$missing_url,
|
|
|
|
|
bool &$missing_tags
|
|
|
|
|
bool &$missing_tags,
|
|
|
|
|
bool &$invalid_url
|
|
|
|
|
): bool {
|
|
|
|
|
if (!isset($room_entry['url']) || !is_string($room_entry['url'])) {
|
|
|
|
|
log_value($room_entry);
|
|
|
|
@ -63,10 +64,16 @@
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!filter_var($room_entry['url'], FILTER_VALIDATE_URL)) {
|
|
|
|
|
log_value($room_entry);
|
|
|
|
|
$invalid_url = true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static function sdir_report_errors(bool $entry_missing_url, bool $entry_missing_tags) {
|
|
|
|
|
private static function sdir_report_errors(bool $entry_missing_url, bool $entry_missing_tags, bool $entry_invalid_url) {
|
|
|
|
|
if ($entry_missing_url) {
|
|
|
|
|
log_error("One or more room entries from session.directory is missing the 'url' parameter.");
|
|
|
|
|
}
|
|
|
|
@ -74,6 +81,10 @@
|
|
|
|
|
if ($entry_missing_tags) {
|
|
|
|
|
log_error("One or more room entries from session.directory is missing the 'tags' parameter.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($entry_invalid_url) {
|
|
|
|
|
log_warning("One or more room entries from session.directory contain an invalid 'url' parameter.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function get_sdir_entries(): array|bool {
|
|
|
|
@ -97,7 +108,7 @@
|
|
|
|
|
|
|
|
|
|
foreach ($rooms as $room_entry) {
|
|
|
|
|
if (!SDIRCommunitySource::sdir_validate_entry(
|
|
|
|
|
$room_entry, $entry_missing_url, $entry_missing_tags
|
|
|
|
|
$room_entry, $entry_missing_url, $entry_missing_tags, $entry_invalid_url
|
|
|
|
|
)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -116,7 +127,7 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SDIRCommunitySource::sdir_report_errors($entry_missing_url, $entry_missing_tags);
|
|
|
|
|
SDIRCommunitySource::sdir_report_errors($entry_missing_url, $entry_missing_tags, $entry_invalid_url);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|