Difference between revisions of "Uninstall Function"
From GeeklogWiki
m (added link to Plugin Auto-Uninstall) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | If you want to give your plugin the ability to uninstall itself then you must implement this function. | + | If you want to give your plugin the ability to uninstall itself then you must implement this function. |
<table cellpadding="2" cellspacing="2" border="1" width="90%" align="Center"> | <table cellpadding="2" cellspacing="2" border="1" width="90%" align="Center"> | ||
Line 14: | Line 14: | ||
</tr> | </tr> | ||
</table> | </table> | ||
+ | |||
+ | As of Geeklog 1.5.0 you can also use the internal plugin uninstall function, "[[Plugin Auto-Uninstall|Autouninstall]]". | ||
+ | |||
+ | <table cellpadding="2" cellspacing="2" border="1" width="90%" align="Center"> | ||
+ | <caption align="bottom">Table 7. Autouninstall function</caption> | ||
+ | <tr> | ||
+ | <th valign="top">Function</th> | ||
+ | <th valign="top">Description of Function</th> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td valign="top" class="codeheader">plugin_autouninstall_<plugin | ||
+ | name></td> | ||
+ | <td valign="top" class="code">This function does not take any parameters. The plugin has to return an array listing all the elemts that should be uninstalled. This array needs to have a specific format. Here is a sample for the links plugin:<br> | ||
+ | <pre> | ||
+ | function plugin_autouninstall_links () | ||
+ | { | ||
+ | $out = array ( | ||
+ | /* give the name of the tables, without $_TABLES[] */ | ||
+ | 'tables' => array('links','linksubmission'), | ||
+ | /* give the full name of the group, as in the db */ | ||
+ | 'groups' => array('Links Admin'), | ||
+ | /* give the full name of the feature, as in the db */ | ||
+ | 'features' => array('links.edit', 'links.moderate', 'links.submit'), | ||
+ | /* give the full name of the block, including 'phpblock_', etc */ | ||
+ | 'php_blocks' => array(), | ||
+ | /* give all vars with their name */ | ||
+ | 'vars'=> array() | ||
+ | ); | ||
+ | return $out; | ||
+ | } | ||
+ | </pre> | ||
+ | If you have other things to remove then tables, groups, features, blocks and default values, please remove them before returning the array. If the removal fails, please return "false" instead of the array. | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
[[Category:Plugin Development]] | [[Category:Plugin Development]] |
Latest revision as of 08:05, 6 May 2009
If you want to give your plugin the ability to uninstall itself then you must implement this function.
Function | Description of Function |
---|---|
plugin_uninstall_<plugin name> | This function does not take any parameters. The plugin should try and uninstall itself, especially removing all its tables and data structures from the database. The function should return true if the uninstall succeeded and false if it failed. |
As of Geeklog 1.5.0 you can also use the internal plugin uninstall function, "Autouninstall".
Function | Description of Function |
---|---|
plugin_autouninstall_<plugin name> | This function does not take any parameters. The plugin has to return an array listing all the elemts that should be uninstalled. This array needs to have a specific format. Here is a sample for the links plugin:function plugin_autouninstall_links () { $out = array ( /* give the name of the tables, without $_TABLES[] */ 'tables' => array('links','linksubmission'), /* give the full name of the group, as in the db */ 'groups' => array('Links Admin'), /* give the full name of the feature, as in the db */ 'features' => array('links.edit', 'links.moderate', 'links.submit'), /* give the full name of the block, including 'phpblock_', etc */ 'php_blocks' => array(), /* give all vars with their name */ 'vars'=> array() ); return $out; } If you have other things to remove then tables, groups, features, blocks and default values, please remove them before returning the array. If the removal fails, please return "false" instead of the array. |