onInstall and onUninstall
The module installation system features a way for mods to specify a custom installation / uninstallation script that will be called once the kernel has finished its own work. In xoops_version.php:
$modversion['onInstall'] = 'install_funcs.php'; $modversion['onUninstall'] = 'install_funcs.php'; (Soon)$modversion['onUpdate'] = 'install_funcs.php';
Then in install_funcs.php:
function xoops_module_install_<DIRNAME>( $xoopsMod ) {
if (everythingIsOK) {
return true;
} else {
return false;
}
}
function xoops_module_uninstall_<DIRNAME>( $xoopsMod ) {
if (everythingIsOK) {
return true;
} else {
return false;
}
}
function xoops_module_update_<DIRNAME> ( $xoopsMod, $oldversion) {
switch ($oldversion) { //remember that version is multiplied with 100 to get an integer
case 100: //perform actions to upgrade from version 1.00
break;
case 110: //perform actions to upgrade from version 1.10
break;
}
}
Back to the dev:Main Page

![[Main Page]](/modules/mediawiki/images/mediawiki.png)






