Changeset 188 for trunk/include/onuninstall.php
- Timestamp:
- Apr 21, 2009, 12:51:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/onuninstall.php
r1 r188 24 24 $db =& Database::getInstance() ; 25 25 $mid = $module->getVar('mid') ; 26 /* 27 // TABLES (loading mysql.sql) 28 $sql_file_path = dirname(__FILE__).'/sql/mysql.sql' ; 29 $prefix_mod = $db->prefix() . '_' . $mydirname ; 30 if( file_exists( $sql_file_path ) ) { 31 $ret[] = "SQL file found at <b>".htmlspecialchars($sql_file_path)."</b>.<br /> Deleting tables...<br />"; 32 $sql_lines = file( $sql_file_path ) ; 33 foreach( $sql_lines as $sql_line ) { 34 if( preg_match( '/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i' , $sql_line , $regs ) ) { 35 $sql = 'DROP TABLE '.$prefix_mod.'_'.$regs[1] ; 36 if (!$db->query($sql)) { 37 $ret[] = '<span style="color:#ff0000;">ERROR: Could not drop table <b>'.htmlspecialchars($prefix_mod.'_'.$regs[1]).'<b>.</span><br />'; 38 } else { 39 $ret[] = 'Table <b>'.htmlspecialchars($prefix_mod.'_'.$regs[1]).'</b> dropped.<br />'; 40 } 26 27 $xp_prefix = $mydirname; 28 if ($xp_prefix == 'wordpress'){ 29 $xp_prefix = 'wp'; 30 } 31 32 $xoops_prefix = $db->prefix(); 33 34 if (empty($xoops_prefix) || empty($xp_prefix)) { 35 $ret[] = '<span style="color:#ff0000;">ERROR: Empty Prefix.</span><br />'; 36 return false; 37 } 38 39 $prefix_mod = $xoops_prefix . '_' . $xp_prefix; 40 $sql = "SHOW TABLES LIKE '$prefix_mod%'"; 41 if ($result = $db->query($sql)) { 42 while ($table = $db->fetchRow($result)){ 43 $drop_sql = 'DROP TABLE '. $table[0] ; 44 if (!$db->queryF($drop_sql)) { 45 $ret[] = '<span style="color:#ff0000;">ERROR: Could not drop table <b>'.htmlspecialchars($table[0]).'<b>.</span><br />'; 46 } else { 47 $ret[] = 'Table <b>'.htmlspecialchars($table[0]).'</b> dropped.<br />'; 41 48 } 42 49 } 50 } else { 51 $ret[] = '<span style="color:#ff0000;">ERROR: Table not found of prefix <b>'.htmlspecialchars($prefix_mod).'<b> .</span><br />'; 52 return false; 43 53 } 44 */ 54 55 45 56 // TEMPLATES (Not necessary because modulesadmin removes all templates) 46 57 /* $tplfile_handler =& xoops_gethandler( 'tplfile' ) ;
Note: See TracChangeset
for help on using the changeset viewer.