If the list of URI schemes to show in the Media Browser library tab includes both public and private schemes, both are excluded. This is because the query is:
SELECT file_managed.fid AS fid, file_managed.timestamp AS file_managed_timestamp,
SUM(file_usage.count) AS file_usage_count
FROM file_managed file_managed
LEFT JOIN file_usage file_usage
ON file_managed.fid = file_usage.fid
LEFT JOIN field_data_field_folder field_data_field_folder
ON file_managed.fid = field_data_field_folder.entity_id
AND (field_data_field_folder.entity_type = 'file'
AND field_data_field_folder.deleted = '0')
WHERE (( (file_managed.status IN ('1'))
AND (field_data_field_folder.field_folder_tid = '106') ))
AND (file_managed.type IN ('image', 'video', 'audio', 'document'))
AND (( (file_managed.uri LIKE 'vimeo://%' ESCAPE '\\')
OR (file_managed.uri LIKE 'youtube://%' ESCAPE '\\')
OR ( (file_managed.uri LIKE 'public://%' ESCAPE '\\')
AND (file_managed.filemime
IN ('image/png', 'image/gif', 'image/jpeg', 'image/jpeg',
'image/vnd.microsoft.icon', 'application/pdf', 'text/plain'))
AND (file_managed.uri LIKE 'private://%' ESCAPE '\\')
AND (file_managed.filemime
IN ('image/png', 'image/gif', 'image/jpeg', 'image/jpeg',
'image/vnd.microsoft.icon', 'application/pdf', 'text/plain')
)
)
)) GROUP BY fid, file_managed_timestamp
ORDER BY file_managed_timestamp DESC
LIMIT 10 OFFSET 0
which requires the uri field to be LIKE both public and private.
The test should require a supported extension and any supported local URI.
The problem appears to be in function media_query_media_browser_alter, in the code:
$local_and->condition($alias . '.uri', db_like($scheme . '://') . '%', 'LIKE');
if (count($mimetypes)) {
$local_and->condition($alias . '.filemime', $mimetypes, 'IN');
}
This is part of the loop on $schemes. If there are mimetypes, both the test for the mime type and the test for uri are included, but all tests are anded. The outer level uri tests should all use OR tests, with optional extensions as necessary ANDed with the individual uri test.
Selecting only "public" works as long as there are no private files to include.
Comments
Comment #1
longlivelance CreditAttribution: longlivelance commentedI believe this is a duplicate of #2215619: Library and My Files in Overlay empty if there is more than one scheme