Open
Description
Preconditions and environment
- Any version
- Disabled and never used media Db storage
Steps to reproduce
- Disable and never use DB media storage
- Make sure the table
media_storage_file_storage
does not exists
- Allow nginx to fallback to
pub/get.php
to resolve image - Access non existent image e.g.
https://magento.local/media/wysiwyg/someImage.jpg
Expected result
- The code execution does not trigger queries to
media_storage_file_storage
table - The user gets placeholder image without triggering
media_storage_file_storage
table - Mysql service does not contain warning logs about accessing the table
media_storage_file_storage
- Exceptions are logged in and not silently suppressed
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
does not use disabled DB media storage
Actual result
- The request triggers the queries to
media_storage_file_storage
table - Mysql service contains warning logs about accessing the table
media_storage_file_storage
that does not exists - Exceptions are not logged and silently suppressed in
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
does not uses disabled DB media storage
Additional information
The execution path according blackfire
PDOStatement::execute(select e.* from media_storage_file_storage as e where (filename = ?) and (directory = ?))
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
Magento\MediaStorage\App\Media\Interceptor::createLocalCopy
Magento\MediaStorage\App\Media\Interceptor::launch
Magento\Framework\App\Bootstrap::run
run_init::pub/get.php
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php#L57
The Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
executes a this code:
/** @var $storage Database */
$storage = $this->storageFactory->create();
try {
$storage->loadByFilename($relativeFileName);
} catch (\Exception $e) {
}
The workaround can be to adjust nginx config, but still the code has to be refactored, as no warnings logged, and query is fired to non-existent table.
Release note
During accessing images via pub/get.php
the select queries to media_storage_file_storage
are not fired when DB media storage is disabled.
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmedMay be fixed according to the position in the backlog.Indicates original Magento version for the Issue report.The issue has been reproduced on latest 2.4-develop branchIssue related to Developer Experience and needs help with Triage to Confirm or Reject it