} if (isset($_POST['cancel'])) { if (!empty($referrer)) { header('Location: ' . $referrer); } else { header('Location: ' . $t . '.php?id=' . urlencode(array_shift($k))); } exit; } // Send headers here, because we need to be able to redirect above this point. $title = 'Delete from ' . $t; require LIBWWWDIR . '/header.php'; // Check if we can really delete this. $warnings = array(); foreach ($k as $key => $val) { if (($tables = fk_check("{$t}.{$key}", $val)) !== NULL) { foreach ($tables as $table => $action) { switch ($action) { case 'RESTRICT': error("{$t}.{$key} \"{$val}\" is still referenced in {$table}, cannot delete."); case 'CASCADE': $warnings[] = "cascade to {$table}"; break; case 'SETNULL': $warnings[] = "create dangling references in {$table}"; break; case 'NOCONSTRAINT': break; default: error("{$t}.{$key} is referenced in {$table} with unknown action '{$action}'."); }
} // check for FKs and TRIGGERs if (!isset($skip_trigger_check)) { if ($verbose) { print "Running trigger check\n"; } $check = trigger_check($conn, $table, $db_list); if (!$check) { continue; } } if (!isset($skip_fk_check)) { if ($verbose) { print "Running fk check\n"; } $check = fk_check($conn, $table, $db_list); if (!$check) { continue; } } foreach ($db_list as $db) { if (!ddl_guard($connection_limit, $conn)) { print "ERROR: Server did not fall below {$connection_limit} " . "connections afer 10 minutes\n "; exit(1); } $result = mysql_select_db($db, $conn); if (!$result) { print "Could not set default db to {$db}. Weird.\n"; continue; } if ($mysql_vars['mysql_version'] < $safe_compression_version) {