Repository navigation
Chore/extract setup modules #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a0ed10f
refactor: extract setup modules
bmfmancini b056ca6
test: fix setup module Pest regressions
bmfmancini e1a6afa
Update file references in setup-modules.md
bmfmancini 176c29a
fix: address setup module review findings
bmfmancini ecdbf37
docs: require lazy setup module loading
bmfmancini 1c03649
ci: allowlist extracted setup modules for coverage
bmfmancini ffe123b
fix: bootstrap setup facade for callbacks
bmfmancini 53c257e
test: guard direct callback module loading
bmfmancini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # `setup.php` module ownership | ||
|
|
||
| `setup.php` is the Syslog plugin's compatibility entry point. Page and worker | ||
| entry points may continue to include it directly; lifecycle code loads only | ||
| the module it needs, while Cacti loads hook callback modules by their registered | ||
| path. | ||
|
|
||
| This is a relocation refactor. A module move must not rename a function, | ||
| change SQL, or change hook ownership in the same commit. | ||
|
|
||
| ## Stable facade | ||
|
|
||
| `setup.php` owns the plugin lifecycle and upgrade orchestration: | ||
|
|
||
| - `plugin_syslog_install()` and `plugin_syslog_uninstall()` | ||
| - `plugin_syslog_check_config()` and `plugin_syslog_upgrade()` | ||
| - `plugin_syslog_version()` and `syslog_check_upgrade()` | ||
| - `syslog_connect()` as the compatibility facade for direct `setup.php` | ||
| consumers | ||
| - `syslog_determine_config()` and `syslog_config_safe()` | ||
| - realm/permission upgrade helpers called by `syslog_check_upgrade()` | ||
|
|
||
| ## Module map | ||
|
|
||
| | Module | Owns | | ||
| | --- | --- | | ||
| | `includes/schema.php` | Schema creation, migration helpers, capacity checks, and table setup | | ||
| | `includes/processing.php` | Poller and replication callbacks | | ||
| | `includes/settings.php` | Settings definitions, permission configuration, and Settings-page assets | | ||
| | `includes/navigation.php` | Tabs, navigation text, refresh handling, and graph buttons | | ||
| | `includes/installer.php` | Install/uninstall advisor and confirmation rendering | | ||
| | `includes/utilities.php` | Utilities menu/action callbacks and the purge dialog | | ||
|
|
||
| `includes/database.php` remains the dual-database `syslog_db_*` wrapper layer; | ||
| it is not replaced by `includes/schema.php`. | ||
|
|
||
| ## Hook ownership | ||
|
|
||
| After extraction, registrations must reference the owning module: | ||
|
|
||
| | Hook callback group | Owning file | | ||
| | --- | --- | | ||
| | `syslog_config_settings`, `syslog_settings_bottom`, `syslog_config_arrays`, `syslog_config_insert` | `includes/settings.php` | | ||
| | `syslog_show_tab`, `syslog_draw_navigation_text`, `syslog_graph_buttons` | `includes/navigation.php` | | ||
| | `syslog_poller_bottom`, `syslog_replicate_out` | `includes/processing.php` | | ||
| | `syslog_utilities_list`, `syslog_utilities_action` | `includes/utilities.php` | | ||
|
|
||
| Each hook-path change follows the move in a separate commit. The installer | ||
| entry points remain registered through `setup.php`. | ||
|
|
||
| ## Test rule | ||
|
|
||
| Source-inspection tests must obtain a function's source through | ||
| `plugin_test_read_function_source()` instead of hard-coding `setup.php`. | ||
| Whenever ownership changes, update that central map and the test in the same | ||
| commit. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.