Server IP : 127.0.0.2 / Your IP : 3.141.29.119 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/phpmyadmin/templates/table/relation/ |
Upload File : |
<?php $js_msg = ''; $this_params = null; if (isset($one_key['constraint'])) { $drop_fk_query = 'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table']) . ' DROP FOREIGN KEY ' . PMA_Util::backquote($one_key['constraint']) . ';'; $this_params = $GLOBALS['url_params']; $this_params['goto'] = 'tbl_relation.php'; $this_params['back'] = 'tbl_relation.php'; $this_params['sql_query'] = $drop_fk_query; $this_params['message_to_show'] = sprintf( __('Foreign key constraint %s has been dropped'), $one_key['constraint'] ); $js_msg = PMA_jsFormat( 'ALTER TABLE ' . $GLOBALS['table'] . ' DROP FOREIGN KEY ' . $one_key['constraint'] . ';' ); } // For ON DELETE and ON UPDATE, the default action // is RESTRICT as per MySQL doc; however, a SHOW CREATE TABLE // won't display the clause if it's set as RESTRICT. $on_delete = isset($one_key['on_delete']) ? $one_key['on_delete'] : 'RESTRICT'; $on_update = isset($one_key['on_update']) ? $one_key['on_update'] : 'RESTRICT'; $column_array = array(); $column_array[''] = ''; foreach ($columns as $column) { if (! empty($column['Key'])) { $column_array[$column['Field']] = $column['Field']; } } $foreign_table = false; // foreign database dropdown $foreign_db = (isset($one_key['ref_db_name'])) ? $one_key['ref_db_name'] : $db; $tables = array(); if ($foreign_db) { $foreign_table = isset($one_key['ref_table_name']) ? $one_key['ref_table_name'] : ''; // In Drizzle, 'SHOW TABLE STATUS' will show status only for the tables // which are currently in the table cache. Hence we have to use // 'SHOW TABLES' and manualy retrieve table engine values. if (PMA_DRIZZLE) { $tables_rs = $GLOBALS['dbi']->query( 'SHOW TABLES FROM ' . PMA_Util::backquote($foreign_db), null, PMA_DatabaseInterface::QUERY_STORE ); while ($row = $GLOBALS['dbi']->fetchArray($tables_rs)) { $engine = $GLOBALS['dbi']->getTable( $foreign_db, $row[0] )->getStatusInfo('Engine'); if (isset($engine) && /*overload*/mb_strtoupper($engine) == $tbl_storage_engine ) { $tables[] = $row[0]; } } } else { $tables_rs = $GLOBALS['dbi']->query( 'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($foreign_db), null, PMA_DatabaseInterface::QUERY_STORE ); while ($row = $GLOBALS['dbi']->fetchRow($tables_rs)) { if (isset($row[1]) && /*overload*/mb_strtoupper($row[1]) == $tbl_storage_engine ) { $tables[] = $row[0]; } } } } ?> <tr class="<?php echo ($odd_row ? 'odd' : 'even'); ?>"> <!-- Drop key anchor --> <td> <?php if (isset($one_key['constraint'])): ?> <input type="hidden" class="drop_foreign_key_msg" value="<?php echo $js_msg; ?>" /> <a class="drop_foreign_key_anchor ajax" href="sql.php<?php echo PMA_URL_getCommon($this_params); ?>" > <?php echo PMA_Util::getIcon('b_drop.png', __('Drop')); ?> </a> <?php endif; ?> </td> <td> <span class="formelement clearfloat"> <input type="text" name="constraint_name[<?php echo $i; ?>]" value="<?php if (isset($one_key['constraint'])) echo htmlspecialchars($one_key['constraint']); ?>" placeholder="<?php echo __('Constraint name'); ?>" maxlength="64" /> </span> <div class="floatleft"> <span class="formelement"> <?php echo PMA\Template::get('table/relation/dropdown_generate')->render( array( 'dropdown_question' => 'ON DELETE', 'select_name' => 'on_delete[' . $i . ']', 'choices' => $options_array, 'selected_value' => $on_delete ) ); ?> </span> <span class="formelement"> <?php echo PMA\Template::get('table/relation/dropdown_generate')->render( array( 'dropdown_question' => 'ON UPDATE', 'select_name' => 'on_update[' . $i . ']', 'choices' => $options_array, 'selected_value' => $on_update ) ); ?> </span> </div> </td> <td> <?php if (isset($one_key['index_list'])): ?> <?php foreach ($one_key['index_list'] as $key => $column): ?> <span class="formelement clearfloat"> <?php echo PMA\Template::get('table/relation/dropdown_generate')->render( array( 'dropdown_question' => '', 'select_name' => 'foreign_key_fields_name[' . $i . '][]', 'choices' => $column_array, 'selected_value' => $column ) ); ?> </span> <?php endforeach; ?> <?php else: ?> <span class="formelement clearfloat"> <?php echo PMA\Template::get('table/relation/dropdown_generate')->render( array( 'dropdown_question' => '', 'select_name' => 'foreign_key_fields_name[' . $i . '][]', 'choices' => $column_array, 'selected_value' => '' ) ); ?> </span> <?php endif; ?> <a class="formelement clearfloat add_foreign_key_field" href="" data-index="<?php echo $i; ?>"> <?php echo __('+ Add column'); ?> </a> </td> <td> <span class="formelement clearfloat"> <?php echo PMA\Template::get('table/relation/relational_dropdown')->render( array( 'name' => 'destination_foreign_db[' . $i . ']', 'title' => __('Database'), 'values' => $GLOBALS['pma']->databases, 'foreign' => $foreign_db ) ); ?> </td> <td> <span class="formelement clearfloat"> <?php echo PMA\Template::get('table/relation/relational_dropdown')->render( array( 'name' => 'destination_foreign_table[' . $i . ']', 'title' => __('Table'), 'values' => $tables, 'foreign' => $foreign_table ) ); ?> </span> </td> <td> <?php if ($foreign_db && $foreign_table): ?> <?php foreach ($one_key['ref_index_list'] as $foreign_column): ?> <?php $table_obj = new PMA_Table($foreign_table, $foreign_db); $columns = $table_obj->getUniqueColumns(false, false); ?> <span class="formelement clearfloat"> <?php echo PMA\Template::get('table/relation/relational_dropdown')->render( array( 'name' => 'destination_foreign_column[' . $i . '][]', 'title' => __('Column'), 'values' => $columns, 'foreign' => $foreign_column ) ); ?> </span> <?php endforeach; ?> <?php else: ?> <span class="formelement clearfloat"> <?php echo PMA\Template::get('table/relation/relational_dropdown')->render( array( 'name' => 'destination_foreign_column[' . $i . '][]', 'title' => __('Column'), 'values' => array(), 'foreign' => '' ) ); ?> </span> <?php endif; ?> </td> </tr>