This topic was marked solved by its starter, on January 9th, 2016, 04:41 PM
apply_plugin_mods destroys Settings.php when error occurs

CerealGuy

  • Posts: 343
apply_plugin_mods destroys Settings.php when error occurs
« on April 1st, 2015, 01:19 AM »Last edited on April 1st, 2015, 01:27 AM
apply_plugin_mods() destroys the Settings.php when an error occurs.

array_diff() needs two arrays as arguments but only gets one (the other one is the plugin string).
Code: (Subs-CachePHP) [Select]
$enabled_plugins = array_diff($enabled_plugins, $plugin);
I changed it to
Code: (Fix1) [Select]
$enabled_plugins = array_diff($enabled_plugins, array($plugin));
but perhaps something with array_search and unset would be better.

And updateSettingsFile() wants an assoc but it gets something weird:
Code: (Subs-CachePHP) [Select]
updateSettingsFile(array('my_plugins' => $my_plugins = implode(',', $enabled_plugins)));

I changed it to
Code: (Fix2) [Select]
updateSettingsFile(array('my_plugins' => implode(',', $enabled_plugins)));

Will create a pull request...

EDIT:
https://github.com/Wedge/wedge/pull/28
Includes some other fixes