Fix PHP errors if file doesn't exist my_parse_ini_file#2372
Conversation
WalkthroughSuppress PHP warning on INI file reads by using @file_get_contents in my_parse_ini_file; and in the plugin not-installed path, call post_hooks(1) (constant) instead of post_hooks($error), leaving surrounding behavior unchanged. Changes
Sequence Diagram(s)sequenceDiagram
participant Manager as plugin script
participant Hooks as post_hooks
Manager->>Manager: check plugin installed?
alt not installed
Manager->>Manager: write "not installed" message
Manager->>Hooks: post_hooks(1) %% changed: now a constant 1 is passed
Manager->>Manager: exit(1)
else installed
Manager->>Manager: continue normal flow
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–30 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
emhttp/plugins/dynamix/include/Wrappers.php(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Squidly271
PR: unraid/webgui#0
File: :0-0
Timestamp: 2025-05-31T05:10:13.120Z
Learning: Squidly271 prefers not to receive CodeRabbit reviews or feedback while PRs are in draft status. Only provide reviews after PRs are moved out of draft.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
emhttp/plugins/dynamix.plugin.manager/scripts/plugin (1)
733-733: Pass a descriptive error string to post_hooks() instead of a bare integerpost_hooks($error='') expects a string (docs: "error (empty if none)") and other callers pass strings — replace the numeric literal with a short message and still exit 1.
- post_hooks(1); + $error = 'not installed'; + post_hooks($error);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
emhttp/plugins/dynamix.plugin.manager/scripts/plugin(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Squidly271
PR: unraid/webgui#0
File: :0-0
Timestamp: 2025-05-31T05:10:13.120Z
Learning: Squidly271 prefers not to receive CodeRabbit reviews or feedback while PRs are in draft status. Only provide reviews after PRs are moved out of draft.
Summary by CodeRabbit