Split Admin god-class into focused collaborator classes. - #1992
Open
shadyvb wants to merge 2 commits into
Open
Conversation
Extract menu, assets, screens, Ajax, and purge logic from Admin into dedicated classes with hook registration colocated per collaborator, while Admin retains cross-cutting init, caps, notices, and constants.
Bring the new Admin split test classes in line with the tests coding standard so lint stays green after the god-class extraction.
shadyvb
marked this pull request as ready for review
September 6, 2026 20:27
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes XWPENG-49.
Stacks on #1991 (
ticket/XWPENG-48-plugin-boot).Adminhad grown into a god-class (~1,900 lines) mixing menu registration, asset loading, screen rendering, Ajax handlers, and purge/erase scheduling. This PR extracts those concerns into six focused collaborator classes while keepingAdminas a thin façade for cross-cutting behaviour (init, capabilities, notices, shared constants, and plugin action links). Hook registration is colocated on each collaborator using namedarray( $this, 'method' )callbacks; runtime behaviour and hook names are unchanged.Summary
Admin_Menu— admin menu/submenu registration, screen IDs, and multisite site-access gating.Admin_Assets—admin_enqueue_scripts, admin body class, and menu CSS.Admin_Screen_Records— records list-table construction and render callback.Admin_Screen_Settings— settings page render, option registration, and feature-request notice.Admin_Ajax— reset, orphan-meta cleanup, filter autocomplete, and redirect confirmation notices.Admin_Purge— TTL auto-purge scheduling (Action Scheduler / WP-Cron), batched erase, orphan-meta reaper, and large-table cron warnings.Admin— retains purge-related constants, capability filters, notice pipeline,init()wiring forNetwork/Live_Update/Export, and exposes public collaborator properties forNetwork,Export, andSettingscall sites.Network,Export,Settings, andAbility_Purge_Recordsnow target collaborators directly (e.g.$admin->menu,$admin->purge) instead of monolithicAdminmethods.Admin_Menu_Test,Admin_Assets_Test,Admin_Ajax_Test,Admin_Purge_Test,Admin_Screen_*_Test);Admin_Testslimmed to façade concerns;testcase.phpgains helpers for constructing collaborators in isolation.Checklist
contributing.md).Release Changelog
Admingod-class into focused collaborator classes to improve testability and maintainability. No user-facing behaviour change.Release Checklist
masterbranch.readme.txt.stream.php.Stable taginreadme.txt.classes/class-plugin.php.Test plan
composer lint-phppasses on PR-changed filesAdmin_Cron_Purge_TestandScheduler_Handoff_Testupdated for collaborator entry points