phoenix-media/magento2-mediastoragesync
Composer 安装命令:
composer require phoenix-media/magento2-mediastoragesync
包简介
The module retrieves files in /media from origin server.
README 文档
README
The module retrieves files in /media from an origin server.
What it does
Imagine you have a fresh local development environment with the Magento code checked out. You retrieved the database but you don't have any of the media assets and your store frontend just looks incomplete. You could grab a huge archive of the media folder from the production environment but no one really wants to download tens of gigabytes just to work on a few catalog pages.
This modules implements some plugins and observers that downloads images of categories, products and CMS blocks/pages from a configurable origin server similar to a CDN the first time you load an entity from the database. This means you can forget about the media folder and just browse the frontend as images are downloaded and saved transparently.
How it works
In the module's configuration you can configure a base URL, the domain where your production/staging Magento instance is located from which to picked the database. In the database the relative paths of categories and product images are stored. Once those entities are loaded the module simply checks if their images are already in media/catalog. If not it uses the base URL, appends the relative image path from the database and downloads the files from origin server. This slows down page generation the first time you access a page but improves pretty quickly.
For other assets in the media folder we make use of another mechanism: Maybe you recognized Magento is shipped with a get.php file in the Magento root. It was intended to retrieve image data from a database, save it on the host's filesystem and then deliver it. Well, our assets are located at a different web server but beside the retrieval of the asset data the rest is pretty similar. The get.php is called via a mod_rewrite rule in the media/.htaccess or equivalent rules in your nginx configuration. The process is triggered every time a file in /media is not found so it is only triggered the first time. The MediaStorageSync module downloads the file, saves it and the get.php delivers the file. On the second load the web service can directly deliver the static asset.
How to use
- Install the module via Composer:
composer require phoenix-media/magento2-mediastoragesync
- Enable it
bin/magento module:enable Phoenix_MediaStorageSync - Install the module and rebuild the DI cache
bin/magento setup:upgrade
How to configure
Find the modules configuration in the PHOENIX MEDIA section of your Magento configuration.
Enable: Enable or disable the functionality
URL: Configure the source URL where to retrieve the images (e.g. "https://magento.com/")
optionally configure credentials for BasicAuth.
phoenix-media/magento2-mediastoragesync 适用场景与选型建议
phoenix-media/magento2-mediastoragesync 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15.97k 次下载、GitHub Stars 达 28, 最近一次更新时间为 2019 年 03 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phoenix-media/magento2-mediastoragesync 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phoenix-media/magento2-mediastoragesync 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 15.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-07