billerickson/be-media-from-production
Composer 安装命令:
composer require billerickson/be-media-from-production
包简介
Uses local media when available, and uses the production server for the rest.
README 文档
README
Contributors: billerickson,magicroundabout
Requires at least: 4.3
Tested up to: 6.8
Stable tag: 1.12.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Uses local media when available, and uses the production server for the rest.
Description
When redesigning a website with a large uploads directory, you might not need all those uploads in your development or staging environment, but you also don't want to see broken images throughout the site.
This plugin lets you use the production server for missing media. Define the production URL using a constant BE_MEDIA_FROM_PRODUCTION_URL or filter be_media_from_production_url.
In all cases, if a local file exists, it will be used in preference to the remote file.
Installation
Once the plugin is installed, add the following constant to wp-config.php with your production URL.
define( 'BE_MEDIA_FROM_PRODUCTION_URL', 'https://www.billerickson.net' );
Alternatively, you can use the filter in your theme's functions.php file, a core functionality plugin, or a mu-plugin:
add_filter( 'be_media_from_production_url', function() {
return 'https://www.billerickson.net';
});
Installation via WP-CLI and constants
wp plugin install https://github.com/billerickson/be-media-from-production/releases/latest/download/be-media-from-production.zip --force --activate
wp config set BE_MEDIA_FROM_PRODUCTION_URL https://www.billerickson.net --type=constant
Using with WP Migrate
WP Migrate is my preferred tool for pushing/pulling databases between environments. The media files functionality allows you to transfer media between environments along with the database.
When redesigning a website, I keep all the media on my development server and push up new media uploads along with the database.
Set up a "push" profile to push your local database to the development server. Make sure "Media Files" is checked and select "Compare, then upload".
Set up a "pull" profile to pull the development database locally. Do not include media in your pull. Any missing media will be handled by BE Media from Production.
billerickson/be-media-from-production 适用场景与选型建议
billerickson/be-media-from-production 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 516 次下载、GitHub Stars 达 242, 最近一次更新时间为 2025 年 02 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 billerickson/be-media-from-production 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 billerickson/be-media-from-production 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 516
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 242
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2025-02-17