mDelegateManager->add( 'Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success' , 'xpress_message_append_onuninstall' ) ;
$ret = array() ;
} else {
if( ! is_array( $ret ) ) $ret = array() ;
}
$db =& Database::getInstance() ;
$mid = $module->getVar('mid') ;
/*
// TABLES (loading mysql.sql)
$sql_file_path = dirname(__FILE__).'/sql/mysql.sql' ;
$prefix_mod = $db->prefix() . '_' . $mydirname ;
if( file_exists( $sql_file_path ) ) {
$ret[] = "SQL file found at ".htmlspecialchars($sql_file_path).".
Deleting tables...
";
$sql_lines = file( $sql_file_path ) ;
foreach( $sql_lines as $sql_line ) {
if( preg_match( '/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i' , $sql_line , $regs ) ) {
$sql = 'DROP TABLE '.$prefix_mod.'_'.$regs[1] ;
if (!$db->query($sql)) {
$ret[] = 'ERROR: Could not drop table '.htmlspecialchars($prefix_mod.'_'.$regs[1]).'.
';
} else {
$ret[] = 'Table '.htmlspecialchars($prefix_mod.'_'.$regs[1]).' dropped.
';
}
}
}
}
*/
// TEMPLATES (Not necessary because modulesadmin removes all templates)
/* $tplfile_handler =& xoops_gethandler( 'tplfile' ) ;
$templates =& $tplfile_handler->find( null , 'module' , $mid ) ;
$tcount = count( $templates ) ;
if( $tcount > 0 ) {
$ret[] = 'Deleting templates...' ;
for( $i = 0 ; $i < $tcount ; $i ++ ) {
if( ! $tplfile_handler->delete( $templates[$i] ) ) {
$ret[] = 'ERROR: Could not delete template '.$templates[$i]->getVar('tpl_file','s').' from the database. Template ID: '.$templates[$i]->getVar('tpl_id','s').'
';
} else {
$ret[] = 'Template '.$templates[$i]->getVar('tpl_file','s').' deleted from the database. Template ID: '.$templates[$i]->getVar('tpl_id','s').'
';
}
}
}
unset($templates); */
return true ;
}
function xpress_message_append_onuninstall( &$module_obj , &$log )
{
if( is_array( @$GLOBALS['ret'] ) ) {
foreach( $GLOBALS['ret'] as $message ) {
$log->add( strip_tags( $message ) ) ;
}
}
// use mLog->addWarning() or mLog->addError() if necessary
}
}
?>