Add check for register_uninstall_hook
まだ誰も着手していません。
評価
調査の方向性
まず、関数呼び出しを検出するための既存の PHP_CodeSniffer の sniffs とテストを見つけ、次にこの 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
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Automattic/VIP-Coding-Standards のほかの issue
-
AlwaysReturnInFilter: isInsideIfConditonal() guards the conditions array after reading it対応中かも @tomjn が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
Bug: PreGetPosts warns when the early is_main_query() return is not the first statement in its if対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
-
Suppress filters in get_posts false positive対応中かも @tomjn が 3 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
Breaking Change Type: Maintenance
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
Automattic/VIP-Coding-Standards#849 · コメント 1 件 ·
Automattic/VIP-Coding-Standards の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
PrestaShopCorp/ps_accounts#666 ·
-
Security SecurityBundle
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
symfony/symfony-docs#23173 ·
メンテナーはふだん 3 日以内に返信
-
incomplete
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
opnsense/plugins#5763 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
fossology/fossology#3893 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Documentation Feature: Self-Register / Verify UI
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信