Jump to content

Plugin uninstall hook/extension point?


wohali

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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