Add check for register_uninstall_hook
还没有人认领这个 Issue。
评估
调研方向
首先找到现有的 PHP_CodeSniffer sniff 和用于检测函数调用的测试,然后以该 issue 中的 register_uninstall_hook 示例作为切入点。当 register_uninstall_hook 调用被报告为错误,且 issue 中未发现误报案例时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
What problem would the enhancement address for VIP?
Because the contents of /wp-content/plugins and /wp-content/themes are setup as read-only directories on the VIP Go platform, admin users cannot uninstall plugins from within the wp-admin. This results in the function register_uninstall_hook never being able to run.
A VIP customer can deactivate a plugin through the admin, but uninstallation can only be done by removing the plugin from the GitHub repo and deploying the changes. If a customer needs to run any clean-up steps associated with a plugin or theme's use of register_uninstall_hook, their development team has to reverse engineer the code to execute any functionality that needs to run.
This is not entirely unique to VIP, but only impacts WordPress environments where the /wp-content/plugins and /wp-content/themes are read-only, so it may not be a good fit for the WordPress Coding Standards.
Describe the solution you'd like
A sniff that will flag places where the register_uninstall_hook function is used. Preferably as an error because it is functionality that will not work.
What code should be reported as a violation?
register_uninstall_hook( __FILE__, 'your_prefix_uninstall' );
What code should not be reported as a violation?
I'm unaware of cases where this might be detected as a false positive.
Additional context
None applicable
- 主要语言
- PHP
- 星标
- 261
- 派生
- 44
- 平均合并
- 3 天 17 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Automattic/VIP-Coding-Standards 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 48/100
-
Breaking Change Type: Maintenance
难度 4/5 3-5 天 新手友好度 35/100
Automattic/VIP-Coding-Standards#849 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
Status: Awaiting feedback
难度 2/5 1-3 小时 新手友好度 45/100
Automattic/VIP-Coding-Standards#754 · 3 条评论 ·
查看 Automattic/VIP-Coding-Standards 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
TYPO3BestPractices/tea#2409 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
api-platform/core#8690 ·
维护者通常 1 天内回复
-
No Code Attached Yet
难度 2/5 1-3 小时 新手友好度 72/100
joomla/joomla-cms#48626 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 70/100
DorsetDigital/silverstripe-schema-manager#26 ·
维护者通常 1 天内回复
-
sync-en
难度 1/5 1-3 小时 新手友好度 68/100
维护者通常 4 天内回复