Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 76 lines (67 sloc) 2.355 kb
fb9a3a5 Michal Čihař Check before commit!
nijel authored
1 <?php
817e790 synced/fixed vim line
Sebastian Mendel authored
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
374abd5 fixed/added page level docblock
Sebastian Mendel authored
3 /**
4 *
e56949f Michal Čihař Use package name PhpMyAdmin
nijel authored
5 * @package PhpMyAdmin-Designer
374abd5 fixed/added page level docblock
Sebastian Mendel authored
6 */
fb9a3a5 Michal Čihař Check before commit!
nijel authored
7
374abd5 fixed/added page level docblock
Sebastian Mendel authored
8 /**
9 *
10 */
c8b6865 Michal Čihař Move common includes to root files rather than to library (which should ...
nijel authored
11 require_once './libraries/common.inc.php';
31c8ca6 Rouslan Placella Disable Response class for XHR requests in PMD
roccivic authored
12
13 PMA_Response::getInstance()->disable();
14
b2fd866 Leading ./ paths for includes can be omitted, part 2
Jo Michael authored
15 require_once 'libraries/pmd_common.php';
11fe557 Marc Delisle avoid of existing variables during extract
lem9 authored
16 extract($_POST, EXTR_SKIP);
17 extract($_GET, EXTR_SKIP);
fb9a3a5 Michal Čihař Check before commit!
nijel authored
18 $die_save_pos = 0;
a30554b Dieter Adriaenssens use require() instead of include() when including file unconditionally
ruleant authored
19 require_once 'pmd_save_pos.php';
e67a0a2 Madhura Jayaratne Spaces between parameters in function calls
madhuracj authored
20 list($DB1, $T1) = explode(".", $T1);
21 list($DB2, $T2) = explode(".", $T2);
fb9a3a5 Michal Čihař Check before commit!
nijel authored
22
23 $tables = PMA_DBI_get_tables_full($db, $T1);
24 $type_T1 = strtoupper($tables[$T1]['ENGINE']);
25 $tables = PMA_DBI_get_tables_full($db, $T2);
26 $type_T2 = strtoupper($tables[$T2]['ENGINE']);
27
8505569 Marc Delisle Designer: their could be an internal relation to delete even if engine i...
lem9 authored
28 $try_to_delete_internal_relation = false;
29
e6894be Chanaka Indrajith Dharmarathna Renamed ->method() with PMA_Util::method()
Chanaka authored
30 if (PMA_Util::isForeignKeySupported($type_T1)
31 && PMA_Util::isForeignKeySupported($type_T2)
7664661 Chanaka Indrajith Dharmarathna Implement class behavior of common.lib.php file
Chanaka authored
32 && $type_T1 == $type_T2
33 ) {
9949e5c Marc Delisle Do not try to delete an internal relation if we just deleted an InnoDB o...
lem9 authored
34 // InnoDB
7c5d5c4 Marc Delisle PBXT: foreign key support
lem9 authored
35 $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
fb9a3a5 Michal Čihař Check before commit!
nijel authored
36
7c5d5c4 Marc Delisle PBXT: foreign key support
lem9 authored
37 if (isset($existrel_foreign[$F2]['constraint'])) {
e6894be Chanaka Indrajith Dharmarathna Renamed ->method() with PMA_Util::method()
Chanaka authored
38 $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($DB2)
39 . '.' . PMA_Util::backquote($T2) . ' DROP FOREIGN KEY '
40 . PMA_Util::backquote($existrel_foreign[$F2]['constraint'])
7e169fc Madhura Jayaratne Coding style improvements
madhuracj authored
41 . ';';
fb9a3a5 Michal Čihař Check before commit!
nijel authored
42 $upd_rs = PMA_DBI_query($upd_query);
8505569 Marc Delisle Designer: their could be an internal relation to delete even if engine i...
lem9 authored
43 } else {
44 // there can be an internal relation even if InnoDB
45 $try_to_delete_internal_relation = true;
fb9a3a5 Michal Čihař Check before commit!
nijel authored
46 }
9949e5c Marc Delisle Do not try to delete an internal relation if we just deleted an InnoDB o...
lem9 authored
47 } else {
8505569 Marc Delisle Designer: their could be an internal relation to delete even if engine i...
lem9 authored
48 $try_to_delete_internal_relation = true;
49 }
50 if ($try_to_delete_internal_relation) {
9949e5c Marc Delisle Do not try to delete an internal relation if we just deleted an InnoDB o...
lem9 authored
51 // internal relations
ec046f7 Madhura Jayaratne Use camel case for function names (PMA_query_as_controluser => PMA_query...
madhuracj authored
52 PMA_queryAsControlUser(
299da6d Madhura Jayaratne More style errors fixed
madhuracj authored
53 'DELETE FROM '
e6894be Chanaka Indrajith Dharmarathna Renamed ->method() with PMA_Util::method()
Chanaka authored
54 . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
299da6d Madhura Jayaratne More style errors fixed
madhuracj authored
55 . $cfg['Server']['relation'].' WHERE '
e6894be Chanaka Indrajith Dharmarathna Renamed ->method() with PMA_Util::method()
Chanaka authored
56 . 'master_db = \'' . PMA_Util::sqlAddSlashes($DB2) . '\''
57 . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($T2) . '\''
58 . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($F2) . '\''
59 . ' AND foreign_db = \'' . PMA_Util::sqlAddSlashes($DB1) . '\''
60 . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($T1) . '\''
61 . ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($F1) . '\'',
299da6d Madhura Jayaratne More style errors fixed
madhuracj authored
62 false,
63 PMA_DBI_QUERY_STORE
64 );
9949e5c Marc Delisle Do not try to delete an internal relation if we just deleted an InnoDB o...
lem9 authored
65 }
b05a903 Marc Delisle gettext conversion
lem9 authored
66 PMD_return_upd(1, __('Relation deleted'));
fb9a3a5 Michal Čihař Check before commit!
nijel authored
67
e67a0a2 Madhura Jayaratne Spaces between parameters in function calls
madhuracj authored
68 function PMD_return_upd($b, $ret)
fb9a3a5 Michal Čihař Check before commit!
nijel authored
69 {
299da6d Madhura Jayaratne More style errors fixed
madhuracj authored
70 global $K;
71 header("Content-Type: text/xml; charset=utf-8");
72 header("Cache-Control: no-cache");
73 die('<root act="relation_upd" return="'.$ret.'" b="'.$b.'" K="'.$K.'"></root>');
fb9a3a5 Michal Čihař Check before commit!
nijel authored
74 }
75 ?>
Something went wrong with that request. Please try again.