Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: CerealGuy on April 1st, 2015, 01:19 AM

Title: apply_plugin_mods destroys Settings.php when error occurs
Post by: CerealGuy on April 1st, 2015, 01:19 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