Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: relation_cleanup.lib.php,v 2.3 2005/08/08 19:54:57 lem9 Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00010 require_once('./libraries/relation.lib.php'); 00011 $cfgRelation = PMA_getRelationsParam(); 00012 00013 function PMA_relationsCleanupColumn($db, $table, $column) { 00014 global $cfgRelation; 00015 if ($cfgRelation['commwork']) { 00016 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) 00017 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' 00018 . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' 00019 . ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; 00020 $rmv_rs = PMA_query_as_cu($remove_query); 00021 unset($remove_query); 00022 } 00023 00024 if ($cfgRelation['displaywork']) { 00025 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) 00026 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' 00027 . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' 00028 . ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; 00029 $rmv_rs = PMA_query_as_cu($remove_query); 00030 unset($remove_query); 00031 } 00032 00033 if ($cfgRelation['relwork']) { 00034 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) 00035 . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' 00036 . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'' 00037 . ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; 00038 $rmv_rs = PMA_query_as_cu($remove_query); 00039 unset($remove_query); 00040 00041 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) 00042 . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'' 00043 . ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'' 00044 . ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; 00045 $rmv_rs = PMA_query_as_cu($remove_query); 00046 unset($remove_query); 00047 } 00048 } 00049 00050 function PMA_relationsCleanupTable($db, $table) { 00051 global $cfgRelation; 00052 00053 if ($cfgRelation['commwork']) { 00054 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) 00055 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' 00056 . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; 00057 $rmv_rs = PMA_query_as_cu($remove_query); 00058 unset($remove_query); 00059 } 00060 00061 if ($cfgRelation['displaywork']) { 00062 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) 00063 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' 00064 . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; 00065 $rmv_rs = PMA_query_as_cu($remove_query); 00066 unset($remove_query); 00067 } 00068 00069 if ($cfgRelation['pdfwork']) { 00070 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) 00071 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' 00072 . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; 00073 $rmv_rs = PMA_query_as_cu($remove_query); 00074 unset($remove_query); 00075 } 00076 00077 if ($cfgRelation['relwork']) { 00078 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) 00079 . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' 00080 . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''; 00081 $rmv_rs = PMA_query_as_cu($remove_query); 00082 unset($remove_query); 00083 00084 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) 00085 . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'' 00086 . ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''; 00087 $rmv_rs = PMA_query_as_cu($remove_query); 00088 unset($remove_query); 00089 } 00090 } 00091 00092 function PMA_relationsCleanupDatabase($db) { 00093 global $cfgRelation; 00094 00095 if ($cfgRelation['commwork']) { 00096 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) 00097 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; 00098 $rmv_rs = PMA_query_as_cu($remove_query); 00099 unset($remove_query); 00100 } 00101 00102 if ($cfgRelation['bookmarkwork']) { 00103 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['bookmark']) 00104 . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''; 00105 $rmv_rs = PMA_query_as_cu($remove_query); 00106 unset($remove_query); 00107 } 00108 00109 if ($cfgRelation['displaywork']) { 00110 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) 00111 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; 00112 $rmv_rs = PMA_query_as_cu($remove_query); 00113 unset($remove_query); 00114 } 00115 00116 if ($cfgRelation['pdfwork']) { 00117 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages']) 00118 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; 00119 $rmv_rs = PMA_query_as_cu($remove_query); 00120 unset($remove_query); 00121 00122 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) 00123 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; 00124 $rmv_rs = PMA_query_as_cu($remove_query); 00125 unset($remove_query); 00126 } 00127 00128 if ($cfgRelation['relwork']) { 00129 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) 00130 . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''; 00131 $rmv_rs = PMA_query_as_cu($remove_query); 00132 unset($remove_query); 00133 00134 $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) 00135 . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''; 00136 $rmv_rs = PMA_query_as_cu($remove_query); 00137 unset($remove_query); 00138 } 00139 } 00140 00141 ?>