Jump to content

Plugin uninstall hook/extension point?


wohali

Recommended Posts

Posted

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.

Posted

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).

Posted

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 :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...