wohali Posted December 3, 2017 Posted December 3, 2017 I've read through the docs, as well as system/Plugin/Plugin.php, and it looks like there's no way to have a plugin perform its own uninstallation actions on delete. Have I missed something? This seems rather a large oversight, given that the official docs mention modifying the core tables multiple times (including in the official example!) without a way to undo these changes when deleting the plugin.
CodingJungle Posted December 3, 2017 Posted December 3, 2017 in system/Plugins/Plugins.php on line 530: if ( file_exists( \IPS\ROOT_PATH . '/plugins/' . $this->location . '/uninstall.php') ) { require_once \IPS\ROOT_PATH . '/plugins/' . $this->location . '/uninstall.php'; } i imagine if you created a uninstall.php in your plugin's root, you could do stuff in it like: \IPS\Db::i()->dropColumn( 'mytable', 'myaddedcolumn'); \IPS\Db::i()->dropTable('myaddedtable'); //etc (sorry i don't really make all that many plugins, just apps, and the process is a bit different there).
wohali Posted December 3, 2017 Author Posted December 3, 2017 How did I miss that! Thanks. Yeah, I mostly do apps myself...thus my lack of familiarity with how to do this in plugins
CodingJungle Posted December 3, 2017 Posted December 3, 2017 i almost missed it, its sorta messy in that area, and you might've not to think "delete" was the "uninstall" method to a plugin. i backtraced it from the plugins controller to in Core to see what it was doing
Recommended Posts
Archived
This topic is now archived and is closed to further replies.