#2821 closed Defect (fixed)
deleting an inactive plugin throws a warning
| Reported by: | cash | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.8.1 |
| Component: | Core | Version: | Github Master |
| Severity: | minor | Keywords: | |
| Cc: | brett@… | Difficulty: |
Description
WARNING: Failed to load 1125 as a plugin. /<snip>/mod/ecml/ is an invalid plugin path
Change History (17)
comment:1 Changed 2 years ago by brettp
- Resolution set to worksforme
- Status changed from new to closed
comment:2 Changed 2 years ago by brettp
- Resolution worksforme deleted
- Status changed from closed to reopened
Found it and can confirm. It throws a debug warning. I thought you meant a register_error() warning.
comment:3 Changed 2 years ago by brettp
- Resolution set to wontfix
- Status changed from reopened to closed
This warning should only appear when calling elgg_generate_plugin_entities().
This was done to handle cases where a user adds a plugin, creates some plugin settings, renames / removes it, then adds it again. ElggPlugin entities are created when it detects a new plugin, then disabled when it detects they've been removed. We can't delete them because it would delete the settings, too.
What's happening is that it's loading all ElggPlugin entities including disabled to check if any have been re-added and need to be re-enabled.
Open to suggestions on better approaches....
comment:4 Changed 2 years ago by brettp
If I wasn't clear, on disabled entities the plugin path point to an invalid path since the plugin was physically removed. That's why the warning is thrown.
comment:5 Changed 2 years ago by cash
- Resolution wontfix deleted
- Status changed from closed to reopened
Giving a warning 4 times for something that is a normal operation is not a good thing. People routinely add and remove plugins when they first build an Elgg site. If they ever set the debug to warning, they will get a screen full of warnings.
comment:6 Changed 2 years ago by brettp
I don't think the solution is to suppress these messages either.
How about we add another option to the advanced plugins admin. When it detects that the plugin has been physically removed, it still shows up in the list, but with the action button saying "Remove." Clicking that would remove the entity, its private settings, and all user private settings for that plugin.
comment:7 Changed 2 years ago by cash
If I delete the files of a plugin, I want it removed. For users, deleting the files means:
- they no longer want the plugin
- they believe the plugin has caused problems with the site
Either way, it seems appropriate to delete the plugin object.
comment:8 Changed 2 years ago by brettp
I'm thinking about problematic upgrades. A user botches a plugin's upgrade, then removes the directory because he's going to re-upload it. For plugins with complex settings, it would be frustrating to have that blow away your configuration.
comment:9 Changed 2 years ago by cash
How about checking if there are any plugin settings and automatically deleting if there aren't any?
For those that do we add a remove button.
comment:10 Changed 21 months ago by brettp
- Milestone changed from Elgg 1.8.0 to Elgg 1.8.1b
comment:11 Changed 21 months ago by cash
As an admin what would I want?
- If I deactivate a plugin and then delete the folder, I do not want to see warnings. I'd prefer that the plugin entity is deleted.
- If I delete a folder when the plugin is active, something has really gone wrong. Seeing a warning would be expected.
- I do not want to lose my plugin settings if I intend to activate a plugin later - even if I delete the folder.
Possible solution:
- Show a single warning per plugin for those plugins that are active but missing their folder.
- Do not show warnings for plugins that are inactive.
- Automatic garbage collection of plugin entities when the plugin has not been active for x days and its folder is missing (prevents plugin entities leaving behind a lot of cruft).
comment:12 Changed 20 months ago by cash
How about we implement the first 2 points from my possible solution and open a new ticket for the third?
comment:13 Changed 20 months ago by brettp
That should be fine.
comment:14 Changed 20 months ago by cash
- Milestone changed from Elgg 1.8.1b to Elgg 1.8.1
comment:15 Changed 19 months ago by Brett Profitt
- Resolution set to fixed
- Status changed from reopened to closed
Fixes #2821. Plugins that are active and cannot be started emit an admin notice.
Changeset: 3f9abf384029bf3fc899be2eead4e3121d20e331
comment:16 Changed 19 months ago by brettp
Most of this was already done, but I changed the register_error() to adding an admin notice.
comment:17 Changed 19 months ago by Brett Profitt
Fixes #2821. Plugins that are active and cannot be started emit an admin notice.
Changeset: 3f9abf384029bf3fc899be2eead4e3121d20e331

I can't reproduce this. Steps tried:
Test A is removed from the plugins list as expected. No warnings emitted.
Test B is removed from the plugins list as expected and a register_error() is emitted: test_old (guid: 63) is a misconfigured plugin. It has been disabled. Please search the Elgg wiki for possible causes (http://docs.elgg.org/wiki/).
Please reopen if you can reproduce.