Since around version 1.5 or 1.6, Magento's had a file in the root folder named get.php
. This file, using the core/file_storage_data
model, allows Magento system owners to serve their product media files directly from blob columns in the the database without having an image file on the file system. PHP handles sending the file
#File: get.php
function sendFile($file)
{
if (file_exists($file) || is_readable($file)) {
$transfer = new Varien_File_Transfer_Adapter_Http();
$transfer->send($file);
exit;
}
}
This is veering into Magento history territory, but why was this feature developed? It seems — slightly insane. PHP isn't the most efficient way to serve a file, MySQL's blob storage has a history of being unstable, and even a stable database blob implementation is a pain in the behind to work with, and from what I can see Varien_File_Transfer_Adapter_Http
doesn't add any caching headers to these files.
Does anyone know why Magento developed this feature? Does it actually accomplish whatever goal/problem it set out to solve? Is anyone using it?