blackbird/scoped-maintenance
Composer 安装命令:
composer require blackbird/scoped-maintenance
包简介
This module allows you to enable maintenance mode for specific stores in a Magento instance while leaving others accessible.
README 文档
README
This module allows you to enable maintenance mode for specific stores in a Magento instance while leaving others accessible. It provides fine-grained control over store access during maintenance mode and optionally allows specific IP addresses to bypass maintenance restrictions.
Key functionality includes:
- Activating maintenance mode for specific stores (scoped maintenance).
- Specifying IP addresses to allow access during maintenance mode.
- Automatically managing cache to reflect store maintenance state.
The source code is available at the GitHub repository.
Setup
Get the Package
Zip Package:
Unzip the package into app/code/Blackbird/ScopedMaintenance, from the root of your Magento instance.
Composer Package:
composer require blackbird/scoped-maintenance
Install the Module
Go to your Magento root directory, then run the following Magento command:
If you are in production mode, do not forget to recompile and redeploy the static resources, or to use the --keep-generated option.
bin/magento setup:upgrade
Features
Scoped Maintenance
The Scoped Maintenance module introduces the ability to enable maintenance mode for specific Magento stores, instead of forcing it globally across all stores. You can target individual stores or groups of store IDs to restrict access while ensuring other stores remain fully operational.
This module add a .maintenance.store file to store the list of stores in maintenance.
IP Whitelisting
While in maintenance mode, you can specify a list of IP addresses that will still have access to the stores under maintenance, bypassing the restrictions. This feature is useful for developers or a specific set of users who need to test or access the stores during downtime. The native ip whitelist of the maintenance is kept.
Automatic Cache Purging
When maintenance mode is activated or deactivated for specific stores, the module handles purging the full-page cache for the affected stores to ensure consistency and immediate effect of the maintenance status.
A special cache tag store_{$id} is added to all pages to specify the store_id and clean only the full page cache of specified stores.
Usage
Enabling Maintenance for Specific Stores
To enable maintenance mode for specific stores, use the built-in Magento CLI command provided by this module:
<store_ids>: A comma-separated list of store IDs for which maintenance mode should be enabled.--ip: (Optional) A comma-separated list of IP addresses that are allowed access to the stores during maintenance mode.
Example:
Enable maintenance mode for stores with IDs 1 and 2, while allowing access to IPs 192.168.1.1 and 192.168.1.2:
bin/magento maintenance:enable-store 1,2 --ip=192.168.1.1,192.168.1.2
Disabling Maintenance Mode
To disable maintenance mode for all stores, use Magento's standard maintenance disable command:
bin/magento maintenance:disable
Checking Store Maintenance Mode Status
The module includes the ability to check whether maintenance mode is enabled for a specific store programmatically. You can use the \Blackbird\ScopedMaintenance\Service\Maintenance service for this purpose.
bin/magento maintenance:status
Support
- If you have any issue with this code, feel free to open an issue.
- If you want to contribute to this project, feel free to create a pull request.
Contact
For further information, contact us:
- by email: hello@bird.eu
- or by form: https://black.bird.eu/en/contacts/
Authors
- Blackbird Team - Maintainer - They're awesome!
License
This project is licensed under the MIT License - see the LICENSE file for details.
That's all folks!
blackbird/scoped-maintenance 适用场景与选型建议
blackbird/scoped-maintenance 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.16k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 blackbird/scoped-maintenance 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 blackbird/scoped-maintenance 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-07