mDelegateManager->add( 'Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success' , 'xpress_message_append_onuninstall' ) ;
$ret = array() ;
} else {
if( ! is_array( $ret ) ) $ret = array() ;
}
$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
$mid = $module->getVar('mid') ;
$xp_prefix = preg_replace('/wordpress/','wp',$mydirname);
$xoops_prefix = $db->prefix();
if (empty($xoops_prefix) || empty($xp_prefix)) {
$ret[] = 'ERROR: Empty Prefix.
';
return false;
}
$prefix_mod = $xoops_prefix . '_' . $xp_prefix;
$sql = "SHOW TABLES LIKE '$prefix_mod%'";
if ($result = $db->query($sql)) {
while ($table = $db->fetchRow($result)){
$drop_sql = 'DROP TABLE '. $table[0] ;
if (!$db->queryF($drop_sql)) {
$ret[] = 'ERROR: Could not drop table '.htmlspecialchars($table[0]).'.
';
} else {
$ret[] = 'Table '.htmlspecialchars($table[0]).' dropped.
';
}
}
} else {
$ret[] = 'ERROR: Table not found of prefix '.htmlspecialchars($prefix_mod).' .
';
return false;
}
// 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
}
}
?>