Merge remote branch 'upstream/master'

This commit is contained in:
Chanaka Indrajith 2012-08-06 06:43:59 +05:30
commit bb8fa38e87
10 changed files with 1646 additions and 1082 deletions

View File

@ -18,6 +18,11 @@
require_once 'libraries/common.inc.php';
require_once 'libraries/mysql_charsets.lib.php';
/**
* functions implementation for this script
*/
require_once 'libraries/operations.lib.php';
// add a javascript file for jQuery functions to handle Ajax actions
$response = PMA_Response::getInstance();
$header = $response->getHeader();
@ -25,76 +30,27 @@ $scripts = $header->getScripts();
$scripts->addFile('db_operations.js');
$common_functions = PMA_CommonFunctions::getInstance();
/**
* Sets globals from $_REQUEST (we're using GET on ajax, POST otherwise)
*/
$request_params = array(
'add_constraints',
'comment',
'create_database_before_copying',
'db_collation',
'db_copy',
'db_rename',
'drop_if_exists',
'newname',
'sql_auto_increment',
'submitcollation',
'switch_to_new',
'what'
);
foreach ($request_params as $one_request_param) {
if (isset($_REQUEST[$one_request_param])) {
$GLOBALS[$one_request_param] = $_REQUEST[$one_request_param];
}
}
/**
* Rename/move or copy database
*/
if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
if (strlen($db) && (! empty($_REQUEST['db_rename']) || ! empty($_REQUEST['db_copy']))) {
if (! empty($db_rename)) {
if (! empty($_REQUEST['db_rename'])) {
$move = true;
} else {
$move = false;
}
if (! isset($newname) || ! strlen($newname)) {
if (! isset($_REQUEST['newname']) || ! strlen($_REQUEST['newname'])) {
$message = PMA_Message::error(__('The database name is empty!'));
} else {
$sql_query = ''; // in case target db exists
$_error = false;
if ($move
|| (isset($create_database_before_copying)
&& $create_database_before_copying)
|| (isset($_REQUEST['create_database_before_copying'])
&& $_REQUEST['create_database_before_copying'])
) {
// lower_case_table_names=1 `DB` becomes `db`
if (! PMA_DRIZZLE) {
$lower_case_table_names = PMA_DBI_fetch_value(
'SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1
);
if ($lower_case_table_names === '1') {
$newname = PMA_strtolower($newname);
}
}
$local_query = 'CREATE DATABASE ' . $common_functions->backquote($newname);
if (isset($db_collation)) {
$local_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
}
$local_query .= ';';
$sql_query = $local_query;
// save the original db name because Tracker.class.php which
// may be called under PMA_DBI_query() changes $GLOBALS['db']
// for some statements, one of which being CREATE DATABASE
$original_db = $db;
PMA_DBI_query($local_query);
$db = $original_db;
unset($original_db);
// rebuild the database list because PMA_Table::moveCopy
// checks in this list if the target db exists
$GLOBALS['pma']->databases->build();
$sql_query = PMA_getSqlQueryAndCreateDbBeforeCopy();
}
// here I don't use DELIMITER because it's not part of the
@ -103,37 +59,12 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
// to avoid selecting alternatively the current and new db
// we would need to modify the CREATE definitions to qualify
// the db name
$procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
if ($procedure_names) {
foreach ($procedure_names as $procedure_name) {
PMA_DBI_select_db($db);
$tmp_query = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name);
// collect for later display
$GLOBALS['sql_query'] .= "\n" . $tmp_query;
PMA_DBI_select_db($newname);
PMA_DBI_query($tmp_query);
}
}
$function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
if ($function_names) {
foreach ($function_names as $function_name) {
PMA_DBI_select_db($db);
$tmp_query = PMA_DBI_get_definition($db, 'FUNCTION', $function_name);
// collect for later display
$GLOBALS['sql_query'] .= "\n" . $tmp_query;
PMA_DBI_select_db($newname);
PMA_DBI_query($tmp_query);
}
}
PMA_runProcedureAndFunctionDefinitions($db);
// go back to current db, just in case
PMA_DBI_select_db($db);
$GLOBALS['sql_constraints_query_full_db'] = array();
$tables_full = PMA_DBI_get_tables_full($db);
$views = array();
require_once "libraries/plugin_interface.lib.php";
// remove all foreign key constraints, otherwise we can get errors
@ -145,173 +76,43 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
'single_table' => isset($single_table)
)
);
foreach ($tables_full as $each_table => $tmp) {
$sql_constraints = '';
$sql_drop_foreign_keys = '';
$sql_structure = $export_sql_plugin->getTableDef(
$db, $each_table, "\n", '', false, false
$GLOBALS['sql_constraints_query_full_db'] =
PMA_getSqlConstraintsQueryForFullDb(
$tables_full, $export_sql_plugin, $move, $db
);
if ($move && ! empty($sql_drop_foreign_keys)) {
PMA_DBI_query($sql_drop_foreign_keys);
}
// keep the constraint we just dropped
if (! empty($sql_constraints)) {
$GLOBALS['sql_constraints_query_full_db'][] = $sql_constraints;
}
}
unset($sql_constraints, $sql_drop_foreign_keys, $sql_structure);
foreach ($tables_full as $each_table => $tmp) {
// to be able to rename a db containing views,
// first all the views are collected and a stand-in is created
// the real views are created after the tables
if (PMA_Table::isView($db, $each_table)) {
$views[] = $each_table;
// Create stand-in definition to resolve view dependencies
$sql_view_standin = $export_sql_plugin->getTableDefStandIn(
$db, $each_table, "\n"
);
PMA_DBI_select_db($newname);
PMA_DBI_query($sql_view_standin);
$GLOBALS['sql_query'] .= "\n" . $sql_view_standin;
}
}
$views = PMA_getViewsAndCreateSqlViewStandIn(
$tables_full, $export_sql_plugin, $db
);
foreach ($tables_full as $each_table => $tmp) {
// skip the views; we have creted stand-in definitions
if (PMA_Table::isView($db, $each_table)) {
continue;
}
$back = $sql_query;
$sql_query = '';
// value of $what for this table only
$this_what = $what;
// do not copy the data from a Merge table
// note: on the calling FORM, 'data' means 'structure and data'
if (PMA_Table::isMerge($db, $each_table)) {
if ($this_what == 'data') {
$this_what = 'structure';
}
if ($this_what == 'dataonly') {
$this_what = 'nocopy';
}
}
if ($this_what != 'nocopy') {
// keep the triggers from the original db+table
// (third param is empty because delimiters are only intended
// for importing via the mysql client or our Import feature)
$triggers = PMA_DBI_get_triggers($db, $each_table, '');
if (! PMA_Table::moveCopy(
$db, $each_table, $newname, $each_table,
isset($this_what) ? $this_what : 'data',
$move, 'db_copy'
)) {
$_error = true;
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
break;
}
// apply the triggers to the destination db+table
if ($triggers) {
PMA_DBI_select_db($newname);
foreach ($triggers as $trigger) {
PMA_DBI_query($trigger['create']);
$GLOBALS['sql_query'] .= "\n" . $trigger['create'] . ';';
}
unset($trigger);
}
unset($triggers);
// this does not apply to a rename operation
if (isset($GLOBALS['add_constraints'])
&& ! empty($GLOBALS['sql_constraints_query'])
) {
$GLOBALS['sql_constraints_query_full_db'][] = $GLOBALS['sql_constraints_query'];
unset($GLOBALS['sql_constraints_query']);
}
}
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
} // end (foreach)
unset($each_table);
list($sql_query, $_error) = PMA_getSqlQueryForCopyTable(
$tables_full, $sql_query, $move, $db
);
// handle the views
if (! $_error) {
// temporarily force to add DROP IF EXIST to CREATE VIEW query,
// to remove stand-in VIEW that was created earlier
if (isset($GLOBALS['drop_if_exists'])) {
$temp_drop_if_exists = $GLOBALS['drop_if_exists'];
}
$GLOBALS['drop_if_exists'] = 'true';
foreach ($views as $view) {
if (! PMA_Table::moveCopy($db, $view, $newname, $view, 'structure', $move, 'db_copy')) {
$_error = true;
break;
}
}
unset($GLOBALS['drop_if_exists']);
if (isset($temp_drop_if_exists)) {
// restore previous value
$GLOBALS['drop_if_exists'] = $temp_drop_if_exists;
unset($temp_drop_if_exists);
}
$_error = PMA_handleTheViews($views, $move, $db);
}
unset($view, $views);
unset($views);
// now that all tables exist, create all the accumulated constraints
if (! $_error && count($GLOBALS['sql_constraints_query_full_db']) > 0) {
PMA_DBI_select_db($newname);
foreach ($GLOBALS['sql_constraints_query_full_db'] as $one_query) {
PMA_DBI_query($one_query);
// and prepare to display them
$GLOBALS['sql_query'] .= "\n" . $one_query;
}
unset($GLOBALS['sql_constraints_query_full_db'], $one_query);
PMA_createAllAccumulatedConstraints();
}
if (! PMA_DRIZZLE && PMA_MYSQL_INT_VERSION >= 50100) {
// here DELIMITER is not used because it's not part of the
// language; each statement is sent one by one
// to avoid selecting alternatively the current and new db
// we would need to modify the CREATE definitions to qualify
// the db name
$event_names = PMA_DBI_fetch_result(
'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \''
. $common_functions->sqlAddSlashes($db, true) . '\';'
);
if ($event_names) {
foreach ($event_names as $event_name) {
PMA_DBI_select_db($db);
$tmp_query = PMA_DBI_get_definition($db, 'EVENT', $event_name);
// collect for later display
$GLOBALS['sql_query'] .= "\n" . $tmp_query;
PMA_DBI_select_db($newname);
PMA_DBI_query($tmp_query);
}
}
PMA_runEventDefinitionsForDb($db);
}
// go back to current db, just in case
PMA_DBI_select_db($db);
// Duplicate the bookmarks for this db (done once for each db)
if (! $_error && $db != $newname) {
$get_fields = array('user', 'label', 'query');
$where_fields = array('dbase' => $db);
$new_fields = array('dbase' => $newname);
PMA_Table::duplicateInfo(
'bookmarkwork', 'bookmark', $get_fields,
$where_fields, $new_fields
);
}
PMA_duplicateBookmarks($_error, $db);
if (! $_error && $move) {
/**
* cleanup pmadb stuff for this db
@ -326,21 +127,21 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$message = PMA_Message::success(__('Database %1$s has been renamed to %2$s'));
$message->addParam($db);
$message->addParam($newname);
$message->addParam($_REQUEST['newname']);
} elseif (! $_error) {
$message = PMA_Message::success(__('Database %1$s has been copied to %2$s'));
$message->addParam($db);
$message->addParam($newname);
$message->addParam($_REQUEST['newname']);
}
$reload = true;
/* Change database to be used */
if (! $_error && $move) {
$db = $newname;
$db = $_REQUEST['newname'];
} elseif (! $_error) {
if (isset($switch_to_new) && $switch_to_new == 'true') {
if (isset($_REQUEST['switch_to_new']) && $_REQUEST['switch_to_new'] == 'true') {
$GLOBALS['PMA_Config']->setCookie('pma_switch_to_new', 'true');
$db = $newname;
$db = $_REQUEST['newname'];
} else {
$GLOBALS['PMA_Config']->setCookie('pma_switch_to_new', '');
}
@ -359,7 +160,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$response = PMA_Response::getInstance();
$response->isSuccess($message->isSuccess());
$response->addJSON('message', $message);
$response->addJSON('newname', $newname);
$response->addJSON('newname', $_REQUEST['newname']);
$response->addJSON(
'sql_query',
$common_functions->getMessage(null, $sql_query)
@ -368,7 +169,6 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
}
}
/**
* Settings for relations stuff
*/
@ -380,7 +180,7 @@ $cfgRelation = PMA_getRelationsParam();
* (must be done before displaying the menu tabs)
*/
if (isset($_REQUEST['comment'])) {
PMA_setDbComment($db, $comment);
PMA_setDbComment($db, $_REQUEST['comment']);
}
/**
@ -402,7 +202,7 @@ if (empty($is_info)) {
}
}
$db_collation = PMA_getDbCollation($db);
$_REQUEST['db_collation'] = PMA_getDbCollation($db);
$is_information_schema = PMA_is_system_schema($db);
if (!$is_information_schema) {
@ -410,237 +210,69 @@ if (!$is_information_schema) {
/**
* database comment
*/
?>
<div class="operations_half_width">
<form method="post" action="db_operations.php">
<?php echo PMA_generate_common_hidden_inputs($db); ?>
<fieldset>
<legend>
<?php
if ($cfg['PropertiesIconic']) {
echo '<img class="icon ic_b_comment" src="themes/dot.gif" alt="" />';
}
echo __('Database comment: ');
?>
</legend>
<input type="text" name="comment" class="textfield" size="30"
value="<?php
echo htmlspecialchars(PMA_getDBComment($db)); ?>" />
</fieldset>
<fieldset class="tblFooters">
<input type="submit" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
<?php
$response->addHTML(PMA_getHtmlForDatabaseComment($db));
}
?>
<div class="operations_half_width">
<?php include 'libraries/display_create_table.lib.php'; ?>
</div>
<?php
$response->addHTML('<div class="operations_half_width">');
ob_start();
include 'libraries/display_create_table.lib.php';
$content = ob_get_contents();
ob_end_clean();
$response->addHTML($content);
$response->addHTML('</div>');
/**
* rename database
*/
if ($db != 'mysql') {
?>
<div class="operations_half_width">
<form id="rename_db_form" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : ''); ?>method="post" action="db_operations.php"
onsubmit="return emptyFormElements(this, 'newname')">
<?php
if (isset($db_collation)) {
echo '<input type="hidden" name="db_collation" value="' . $db_collation
.'" />' . "\n";
if ($db != 'mysql') {
$response->addHTML(PMA_getHtmlForRenameDatabase($db));
}
?>
<input type="hidden" name="what" value="data" />
<input type="hidden" name="db_rename" value="true" />
<?php echo PMA_generate_common_hidden_inputs($db); ?>
<fieldset>
<legend>
<?php
if ($cfg['PropertiesIconic']) {
echo $common_functions->getImage('b_edit.png');
}
echo __('Rename database to') . ':';
?>
</legend>
<input id="new_db_name" type="text" name="newname" size="30" class="textfield" value="" />
</fieldset>
<fieldset class="tblFooters">
<input id="rename_db_input" type="submit" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
<?php
} // end if
// Drop link if allowed
// Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
// Don't allow to easily drop mysql database, RFE #1327514.
if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase'])
&& ! $db_is_information_schema
&& (PMA_DRIZZLE || $db != 'mysql')
) {
?>
<div class="operations_half_width">
<fieldset class="caution">
<legend><?php
if ($cfg['PropertiesIconic']) {
echo $common_functions->getImage('b_deltbl.png');
}
echo __('Remove database');
?></legend>
<ul>
<?php
$this_sql_query = 'DROP DATABASE ' . $common_functions->backquote($GLOBALS['db']);
$this_url_params = array(
'sql_query' => $this_sql_query,
'back' => 'db_operations.php',
'goto' => 'main.php',
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(__('Database %s has been dropped.'), htmlspecialchars($common_functions->backquote($db))),
'db' => null,
);
?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'id="drop_db_anchor"' : ''); ?>>
<?php echo __('Drop the database (DROP)'); ?></a>
<?php echo $common_functions->showMySQLDocu('SQL-Syntax', 'DROP_DATABASE'); ?>
</li>
</ul>
</fieldset>
</div>
<?php
}
/**
* Copy database
*/
?>
<div class="operations_half_width clearfloat">
<form id="copy_db_form" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : ''); ?>method="post" action="db_operations.php"
onsubmit="return emptyFormElements(this, 'newname')">
<?php
if (isset($db_collation)) {
echo '<input type="hidden" name="db_collation" value="' . $db_collation
.'" />' . "\n";
}
echo '<input type="hidden" name="db_copy" value="true" />' . "\n";
echo PMA_generate_common_hidden_inputs($db);
?>
<fieldset>
<legend>
<?php
if ($cfg['PropertiesIconic']) {
echo $common_functions->getImage('b_edit.png');
}
echo __('Copy database to') . ':';
$drop_clause = 'DROP TABLE / DROP VIEW';
?>
</legend>
<input type="text" name="newname" size="30" class="textfield" value="" /><br />
<?php
$choices = array(
'structure' => __('Structure only'),
'data' => __('Structure and data'),
'dataonly' => __('Data only'));
echo $common_functions->getRadioFields(
'what', $choices, 'data', true
);
unset($choices);
?>
<input type="checkbox" name="create_database_before_copying" value="1"
id="checkbox_create_database_before_copying"
checked="checked" />
<label for="checkbox_create_database_before_copying">
<?php echo __('CREATE DATABASE before copying'); ?></label><br />
<input type="checkbox" name="drop_if_exists" value="true"
id="checkbox_drop" />
<label for="checkbox_drop"><?php echo sprintf(__('Add %s'), $drop_clause); ?></label><br />
<input type="checkbox" name="sql_auto_increment" value="1" checked="checked"
id="checkbox_auto_increment" />
<label for="checkbox_auto_increment">
<?php echo __('Add AUTO_INCREMENT value'); ?></label><br />
<input type="checkbox" name="add_constraints" value="1"
id="checkbox_constraints" />
<label for="checkbox_constraints">
<?php echo __('Add constraints'); ?></label><br />
<?php
unset($drop_clause);
if (isset($_COOKIE)
&& isset($_COOKIE['pma_switch_to_new'])
&& $_COOKIE['pma_switch_to_new'] == 'true'
// Drop link if allowed
// Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
// Don't allow to easily drop mysql database, RFE #1327514.
if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase'])
&& ! $db_is_information_schema
&& (PMA_DRIZZLE || $db != 'mysql')
) {
$pma_switch_to_new = 'true';
$response->addHTML(PMA_getHtmlForDropDatabaseLink($db));
}
?>
<input type="checkbox" name="switch_to_new" value="true"
id="checkbox_switch"
<?php echo ((isset($pma_switch_to_new) && $pma_switch_to_new == 'true') ? ' checked="checked"' : ''); ?>
/>
<label for="checkbox_switch"><?php echo __('Switch to copied database'); ?></label>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_copy" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
<?php
/**
* Copy database
*/
$response->addHTML(PMA_getHtmlForCopyDatabase($db));
/**
* Change database charset
*/
echo '<div class="operations_half_width"><form id="change_db_charset_form" ';
if ($GLOBALS['cfg']['AjaxEnable']) {
echo ' class="ajax" ';
}
echo 'method="post" action="db_operations.php">'
. PMA_generate_common_hidden_inputs($db, $table)
. '<fieldset>' . "\n"
. ' <legend>';
if ($cfg['PropertiesIconic']) {
echo $common_functions->getImage('s_asci.png');
}
echo ' <label for="select_db_collation">' . __('Collation') . ':</label>' . "\n"
. ' </legend>' . "\n"
. PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION, 'db_collation',
'select_db_collation', $db_collation, false, 3
)
. '</fieldset>'
. '<fieldset class="tblFooters">'
. ' <input type="submit" name="submitcollation"'
. ' value="' . __('Go') . '" />' . "\n"
. '</fieldset>' . "\n"
. '</form></div>' . "\n";
$response->addHTML(PMA_getHtmlForChangeDatabaseCharset($db, $table));
if ($num_tables > 0
&& ! $cfgRelation['allworks']
&& $cfg['PmaNoRelation_DisableWarning'] == false
) {
$message = PMA_Message::notice(__('The phpMyAdmin configuration storage has been deactivated. To find out why click %shere%s.'));
$message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">', false);
$message = PMA_Message::notice(
__('The phpMyAdmin configuration storage has been deactivated. To find out why click %shere%s.')
);
$message->addParam(
'<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">',
false
);
$message->addParam('</a>', false);
/* Show error if user has configured something, notice elsewhere */
if (!empty($cfg['Servers'][$server]['pmadb'])) {
$message->isError(true);
}
echo '<div class="operations_full_width">';
$message->display();
echo '</div>';
$response->addHTML('<div class="operations_full_width">');
$response->addHTML($message->getDisplay());
$response->addHTML('</div>');
} // end if
} // end if (!$is_information_schema)
// not sure about displaying the PDF dialog in case db is information_schema
if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
<!-- Work on PDF Pages -->
<?php
if ($cfgRelation['pdfwork'] && $num_tables > 0) {
// We only show this if we find something in the new pdf_pages table
$test_query = '
SELECT *
FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
@ -651,11 +283,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
/*
* Export Relational Schema View
*/
echo '<div class="operations_full_width"><fieldset><a href="schema_edit.php?' . $url_query . '">';
if ($cfg['PropertiesIconic']) {
echo $common_functions->getImage('b_edit.png');
}
echo __('Edit or export relational schema') . '</a></fieldset></div>';
$response->addHTML(PMA_getHtmlForExportRelationalSchemaView($url_query));
} // end if
?>

View File

@ -2789,6 +2789,7 @@ class PMA_DisplayResults
$vertical_display = $this->__get('_vertical_display');
// Check whether the field needs to display with syntax highlighting
if ($this->_isNeedToSytaxHighlight($meta->name)
&& (trim($row[$i]) != '')
) {
@ -2811,7 +2812,7 @@ class PMA_DisplayResults
'_', '/',
$this->sytax_highlighting_column_info[strtolower($this->__get('_db'))][strtolower($this->__get('_table'))][strtolower($meta->name)][2]
);
}
// Check for the predefined fields need to show as link in schemas
@ -3042,7 +3043,6 @@ class PMA_DisplayResults
return false;
}
/**
* Check whether the field needs to be link
*
@ -3644,6 +3644,7 @@ class PMA_DisplayResults
if ((PMA_strlen($column) > $GLOBALS['cfg']['LimitChars'])
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
&& ! $this->_isNeedToSytaxHighlight(strtolower($meta->name))
) {
$column = PMA_substr($column, 0, $GLOBALS['cfg']['LimitChars'])
. '...';

View File

@ -319,7 +319,6 @@ class PMA_Table
static public function sGetStatusInfo($db, $table, $info = null,
$force_read = false, $disable_error = false
) {
if (! empty($_SESSION['is_multi_query'])) {
$disable_error = true;
}

1392
libraries/operations.lib.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1732,7 +1732,7 @@ function PMA_getStandardLinks($conditional_class)
* @return array $extra_data
*/
function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
$link_edit, $dbname_is_wildcard
$link_edit, $dbname_is_wildcard, $hostname, $username
) {
if (strlen($sql_query)) {
$extra_data['sql_query']
@ -1745,16 +1745,16 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
*/
$new_user_string = '<tr>'."\n"
. '<td> <input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_"'
. 'value="'
. htmlspecialchars($_REQUEST['username'])
. '&amp;#27;' . htmlspecialchars($_REQUEST['hostname']) . '" />'
. 'value="'
. htmlspecialchars($username)
. '&amp;#27;' . htmlspecialchars($hostname) . '" />'
. '</td>' . "\n"
. '<td><label for="checkbox_sel_users_">'
. (empty($_REQUEST['username'])
? '<span style="color: #FF0000">' . __('Any') . '</span>'
: htmlspecialchars($_REQUEST['username']) ) . '</label></td>' . "\n"
. '<td>' . htmlspecialchars($_REQUEST['hostname']) . '</td>' . "\n";
: htmlspecialchars($username) ) . '</label></td>' . "\n"
. '<td>' . htmlspecialchars($hostname) . '</td>' . "\n";
$new_user_string .= '<td>';
if (! empty($password) || isset($_POST['pma_pw'])) {
@ -1781,15 +1781,15 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
$new_user_string .= '<td>'
. sprintf($link_edit,
urlencode($_REQUEST['username']),
urlencode($_REQUEST['hostname']),
urlencode($username),
urlencode($hostname),
'', ''
)
. '</td>' . "\n";
$new_user_string .= '<td>'
. sprintf($link_export,
urlencode($_REQUEST['username']),
urlencode($_REQUEST['hostname']),
urlencode($username),
urlencode($hostname),
(isset($_GET['initial']) ? $_GET['initial'] : '')
)
. '</td>' . "\n";
@ -1802,7 +1802,7 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
* Generate the string for this alphabet's initial, to update the user
* pagination
*/
$new_user_initial = strtoupper(substr($_REQUEST['username'], 0, 1));
$new_user_initial = strtoupper(substr($username, 0, 1));
$new_user_initial_string = '<a href="server_privileges.php?'
. $GLOBALS['url_query'] . '&initial=' . $new_user_initial .'">'
. $new_user_initial . '</a>';

View File

@ -13974,6 +13974,12 @@ msgstr "{concurrent_insert} està establert a 0"
#~ msgid "PHP array"
#~ msgstr "matriu PHP"
#~ msgid "PDF"
#~ msgstr "PDF"
#~ msgid "PHP array"
#~ msgstr "matriu PHP"
#~ msgid ""
#~ "No description is available for this transformation.<br />Please ask the "
#~ "author what %s does."

142
po/da.po
View File

@ -4,15 +4,15 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.0.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2012-07-27 10:40+0200\n"
"PO-Revision-Date: 2012-07-23 04:24+0200\n"
"PO-Revision-Date: 2012-08-05 02:30+0200\n"
"Last-Translator: Aputsiaq Niels Janussen <aj@isit.gl>\n"
"Language-Team: danish <da@li.org>\n"
"Language-Team: Danish <http://l10n.cihar.com/projects/phpmyadmin/master/da/>\n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 1.1\n"
"X-Generator: Weblate 1.2\n"
#: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:354
#: libraries/DisplayResults.class.php:794
@ -3450,24 +3450,32 @@ msgid ""
"A variable-length (%s) string, the effective maximum length is subject to "
"the maximum row size"
msgstr ""
"En streng med variabel længde (%s). Den effektive, maksimale længde er "
"subjektet for din maksimale rækkestørrelse"
#: libraries/Types.class.php:333
msgid ""
"A TEXT column with a maximum length of 255 (2^8 - 1) characters, stored with "
"a one-byte prefix indicating the length of the value in bytes"
msgstr ""
"En TEXT-kolonne med en maksimal længde på 255 (2^8 - 1) tegn, lagret med et "
"præfiks på én byte, der indikerer længden af værdien i bytes"
#: libraries/Types.class.php:335 libraries/Types.class.php:731
msgid ""
"A TEXT column with a maximum length of 65,535 (2^16 - 1) characters, stored "
"with a two-byte prefix indicating the length of the value in bytes"
msgstr ""
"En TEXT-kolonne med en maksimal længde på 65.535 (2^16 - 1) tegn, lagret med "
"et præfiks på to bytes, der indikerer længden af værdien i bytes"
#: libraries/Types.class.php:337
msgid ""
"A TEXT column with a maximum length of 16,777,215 (2^24 - 1) characters, "
"stored with a three-byte prefix indicating the length of the value in bytes"
msgstr ""
"En TEXT-kolonne med en maksimal længde på 16.777.215 (2^24 - 1) tegn, lagret "
"med et præfiks på tre bytes, der indikerer længden af værdien i bytes"
#: libraries/Types.class.php:339
msgid ""
@ -3475,12 +3483,17 @@ msgid ""
"characters, stored with a four-byte prefix indicating the length of the "
"value in bytes"
msgstr ""
"En TEXT-kolonne med en maksimal længde på 4.294.967.295 (2^32 - 1) tegn, "
"lagret med et præfiks på fire bytes, der indikerer længden af værdien i "
"bytes"
#: libraries/Types.class.php:341
msgid ""
"Similar to the CHAR type, but stores binary byte strings rather than non-"
"binary character strings"
msgstr ""
"Ligner CHAR-typen, men lagrer binære byte-strenge i stedet for ikkebinære "
"tegnstrenge"
#: libraries/Types.class.php:343
msgid ""
@ -3527,10 +3540,12 @@ msgid ""
"An enumeration, chosen from the list of up to 65,535 values or the special "
"'' error value"
msgstr ""
"En optælling, udvalgt fra listen med op til 65.535 værdier eller den særlige "
"''-fejlværdi"
#: libraries/Types.class.php:355
msgid "A single value chosen from a set of up to 64 members"
msgstr ""
msgstr "En enkelt værdi udvalgt fra et sæt på op til 64 medlemmer"
#: libraries/Types.class.php:357
msgid "A type that can store a geometry of any type"
@ -4035,6 +4050,8 @@ msgid ""
"Defines the minimum size for input fields generated for CHAR and VARCHAR "
"columns"
msgstr ""
"Definerer den mindste størrelse på input-felter som genereres for CHAR- og "
"VARCHAR-kolonner"
#: libraries/config/messages.inc.php:37
msgid "Minimum size for input field"
@ -4045,6 +4062,8 @@ msgid ""
"Defines the maximum size for input fields generated for CHAR and VARCHAR "
"columns"
msgstr ""
"Definerer den maksimale størrelse på input-felter som genereres for CHAR- og "
"VARCHAR-kolonner"
#: libraries/config/messages.inc.php:39
msgid "Maximum size for input field"
@ -5377,6 +5396,8 @@ msgid ""
"An alternate host to hold the configuration storage; leave blank to use the "
"already defined host"
msgstr ""
"En alternativ vært til lageropbevaring af konfiguration; lad stå tom for at "
"benytte den vært som allerede er defineret"
#: libraries/config/messages.inc.php:388
msgid "Control host"
@ -5460,6 +5481,8 @@ msgid ""
"Limits number of table preferences which are stored in database, the oldest "
"records are automatically removed"
msgstr ""
"Begrænser antallet af tabel-præferencer som lagres i databasen. De ældte "
"poster fjernes automatisk"
#: libraries/config/messages.inc.php:405
msgid "Maximal number of table preferences to store"
@ -5846,6 +5869,7 @@ msgstr "Vis SQL-forespørgsler"
msgid ""
"Defines whether the query box should stay on-screen after its submission"
msgstr ""
"Definerer som forespørgselsboksen skal forblive på siden efter indsendelse"
#: libraries/config/messages.inc.php:480 libraries/sql_query_form.lib.php:377
msgid "Retain query box"
@ -6193,7 +6217,7 @@ msgstr "Serveren svarer ikke."
#: libraries/database_interface.lib.php:1997
msgid "Please check privileges of directory containing database."
msgstr ""
msgstr "Tjek venligst privilegier for mappen som indeholder databasen."
#: libraries/database_interface.lib.php:2006
msgid "Details..."
@ -6896,7 +6920,7 @@ msgstr "Relaterede links"
#: libraries/engines/pbxt.lib.php:137
msgid "The PrimeBase XT Blog by Paul McCullagh"
msgstr ""
msgstr "Bloggen The PrimeBase XT af Paul McCullagh"
#: libraries/gis_visualization.lib.php:135
msgid "No data found for GIS visualization."
@ -8523,7 +8547,6 @@ msgid "Trigger name"
msgstr "Triggernavn"
#: libraries/rte/rte_triggers.lib.php:334
#, fuzzy
#| msgid "Time"
msgctxt "Trigger action time"
msgid "Time"
@ -9490,7 +9513,7 @@ msgstr "Datalager"
#: libraries/tbl_properties.inc.php:871
msgid "PARTITION definition"
msgstr ""
msgstr "PARTITION-definition"
#: libraries/user_preferences.inc.php:29
msgid "Manage your settings"
@ -11289,7 +11312,6 @@ msgid "Using the monitor:"
msgstr "Brug af monitor:"
#: server_status.php:1704
#, fuzzy
#| msgid ""
#| "Ok, you are good to go! Once you click 'Start monitor' your browser will "
#| "refresh all displayed charts in a regular interval. You may add charts "
@ -11300,10 +11322,10 @@ msgid ""
"may add charts and change the refresh rate under 'Settings', or remove any "
"chart using the cog icon on each respective chart."
msgstr ""
"Når du klikker på 'Start monitor' vil din browser opdatere alle viste "
"diagrammer regelmæssigt. Du kan tilføje diagrammer og ændre "
"opdateringsfrekvensen under 'Indstilinger' eller fjerne diagrammer ved at "
"bruge ikonet cog på det relevante diagram. "
"Din browser vil opdatere alle viste diagrammer i et regelmæssigt interval. "
"Du kan tilføje diagrammer og ændre opdateringsfrekvensen under "
"'Indstillinger', eller fjerne hvilket som helst diagram ved at bruge ikonet "
"cog på det relevante diagram."
#: server_status.php:1706
msgid ""
@ -11855,10 +11877,10 @@ msgstr ""
"dette system."
#: setup/lib/index.lib.php:344
#, fuzzy
#| msgid "You should use SSL connections if your web server supports it."
msgid "You should use SSL connections if your database server supports it."
msgstr "Du bør bruge en SSL-forbindelse, hvis din webserver understøtter det. "
msgstr ""
"Du bør bruge SSL-forbindelser, hvis din database-server understøtter det."
#: setup/lib/index.lib.php:359
msgid "You should use mysqli for performance reasons."
@ -11928,39 +11950,34 @@ msgid "The columns have been moved successfully."
msgstr "De valgte brugere er blevet korrekt slettet."
#: tbl_chart.php:83
#, fuzzy
#| msgid "Bar"
msgctxt "Chart type"
msgid "Bar"
msgstr "Søjle"
msgstr "Bjælke"
#: tbl_chart.php:85
#, fuzzy
#| msgid "Column"
msgctxt "Chart type"
msgid "Column"
msgstr "Kolonnenavn"
msgstr "Kolonne"
#: tbl_chart.php:87
#, fuzzy
#| msgid "Line"
msgctxt "Chart type"
msgid "Line"
msgstr "Linje"
#: tbl_chart.php:89
#, fuzzy
#| msgid "Spline"
msgctxt "Chart type"
msgid "Spline"
msgstr "Spline"
#: tbl_chart.php:92
#, fuzzy
#| msgid "Pie"
msgctxt "Chart type"
msgid "Pie"
msgstr "Lagkage"
msgstr "Cirkel"
#: tbl_chart.php:96
msgid "Stacked"
@ -11997,7 +12014,7 @@ msgstr "Y-værdier"
#: tbl_create.php:31
#, php-format
msgid "Table %s already exists!"
msgstr ""
msgstr "Tabellen %s eksisterer allerede!"
#: tbl_create.php:230
#, php-format
@ -12061,10 +12078,9 @@ msgid "Add index"
msgstr "Tilføj indeks"
#: tbl_indexes.php:194
#, fuzzy
#| msgid "Edit mode"
msgid "Edit index"
msgstr "Redigeringstilstand"
msgstr "Redigér indeks"
#: tbl_indexes.php:206
msgid "Index name:"
@ -12202,10 +12218,9 @@ msgid "Check referential integrity:"
msgstr "Check reference-integriteten:"
#: tbl_printview.php:66
#, fuzzy
#| msgid "Show tables"
msgid "Showing tables"
msgstr "Vis tabeller"
msgstr "Viser tabeller"
#: tbl_printview.php:294 tbl_structure.php:833
msgid "Space usage"
@ -12855,10 +12870,10 @@ msgstr ""
"sekund."
#: libraries/advisory_rules.txt:160
#, fuzzy, php-format
#, php-format
#| msgid "Query cache efficiency (%)"
msgid "Query cache efficiency (%%)"
msgstr "Effektivitet (%) af forespørgselsmellemlager "
msgstr "Effektiviteten af forespørgselsmellemlager (%%)"
#: libraries/advisory_rules.txt:163
msgid "Query cache not running efficiently, it has a low hit rate."
@ -12962,7 +12977,7 @@ msgstr ""
"og check resultatet."
#: libraries/advisory_rules.txt:186
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "The ratio of removed queries to inserted queries is %s%%. The lower this "
#| "value is, the better (This rules firing limit: 0.1%)"
@ -12971,7 +12986,7 @@ msgid ""
"value is, the better (This rules firing limit: 0.1%%)"
msgstr ""
"Andelen af fjernede forespørgsler til indsatte forespørgsler er %s%%. Jo "
"mindre denne værdi er des bedre. (Denne regel aktiveres ved 0,1%)"
"mindre denne værdi er des bedre. (Denne regels aktiveringsgrænse: 0.1%%)"
#: libraries/advisory_rules.txt:188
msgid "Query cache max size"
@ -13079,7 +13094,6 @@ msgid "There are lots of rows being sorted."
msgstr "Der er mange rækker, der sorteres."
#: libraries/advisory_rules.txt:222
#, fuzzy
#| msgid ""
#| "there is nothing wrong with a high amount of row sorting, you might t to "
#| "e sure that the queries which require a lot of sorting use exed fields "
@ -13090,9 +13104,10 @@ msgid ""
"indexed columns in the ORDER BY clause, as this will result in much faster "
"sorting"
msgstr ""
"Selvom der intet er galt med en stor del rækkesorteringer, så bør "
"forespørgsler, som har brug for meget sortering bruge indekserede felter i "
"ORDER BY, da dette vil resultere i en meget hurtigere sortering."
"Selvom der intet er galt med en stor del rækkesorteringer, så bør du "
"eventuelt sikre, at forespørgsler som kræver meget sortering bruger "
"indekserede kolonner i klausulen ORDER BY, da dette vil resultere i en meget "
"hurtigere sortering"
#: libraries/advisory_rules.txt:223
#, php-format
@ -13108,7 +13123,6 @@ msgid "There are too many joins without indexes."
msgstr "Der er for mange joins uden indeks."
#: libraries/advisory_rules.txt:230
#, fuzzy
#| msgid ""
#| "eans that joins are doing full table scans. Adding indexes for the lds ng "
#| "used in the join conditions will greatly speed up table joins"
@ -13117,8 +13131,8 @@ msgid ""
"columns being used in the join conditions will greatly speed up table joins"
msgstr ""
"Dette betyder, at joins foretager en fuld tabelskanning. Oprettelse af "
"indeks for felter, der bruges i join-betingelserne vil forøge hastigheden af "
"joins."
"indeks for kolonner, der bruges i join-betingelserne vil forøge hastigheden "
"af tabel-joins"
#: libraries/advisory_rules.txt:231
#, php-format
@ -13274,7 +13288,6 @@ msgid "Temp disk rate"
msgstr "Frekvens af midlertidig disk"
#: libraries/advisory_rules.txt:273
#, fuzzy
#| msgid ""
#| "sing {max_heap_table_size} and {tmp_table_size} might help. However e "
#| "porary tables are always being written to disk, independent of value of "
@ -13296,12 +13309,12 @@ msgstr ""
"skrives nogle midlertidige tabeller altid til disk uafhængig af disse "
"variable. For at undgå disse skal man omskrive sine forespørgsler for at "
"undgå disse betingelser (inden for en midlertidig tabel: Tilstedeværelse af "
"BLOB eller TEXT felter eller et felt større end 512 bytes) som nævnt i <a "
"href=\"http://dev.mysql.com/doc/refman/5.5/en/internal-temporary-tables.html"
"\">MySQL Documentation</a>"
"BLOB eller TEXT-kolonne eller en kolonne større end 512 bytes) som nævnt i "
"<a href=\"http://dev.mysql.com/doc/refman/5.5/en/internal-temporary-"
"tables.html\">MySQL Documentation</a>"
#: libraries/advisory_rules.txt:274
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "f temporay tables being written to disk: %s, this value should be s than "
#| "er hour"
@ -13309,8 +13322,8 @@ msgid ""
"Rate of temporary tables being written to disk: %s, this value should be "
"less than 1 per hour"
msgstr ""
"Frekvens af midlertidige tabeller skrevet til disk: %s. Denne værdi bør være "
"mindre end 1 pr time"
"Frekvens af midlertidige tabeller som skrives til disk: %s. Denne værdi bør "
"være mindre end 1 pr time"
#: libraries/advisory_rules.txt:289
msgid "MyISAM key buffer size"
@ -13355,24 +13368,24 @@ msgstr ""
"indeks der bruges."
#: libraries/advisory_rules.txt:301
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "max %% MyISAM key buffer ever used: %s, this value should be above 95%%"
msgid ""
"max %% MyISAM key buffer ever used: %s%%, this value should be above 95%%"
msgstr ""
"maksimal %% MyISAM nøglebuffer nogensinde brugt: %s. Denne værdi bør være "
"over 95%%"
"maksimal %% MyISAM-nøglebuffer som nogensinde bruges: %s%%. Denne værdi bør "
"være over 95%%"
#: libraries/advisory_rules.txt:304
msgid "Percentage of MyISAM key buffer used"
msgstr "Procentdel brugt af MyISAM nøglebuffer"
#: libraries/advisory_rules.txt:309
#, fuzzy, php-format
#, php-format
#| msgid "%% MyISAM key buffer used: %s, this value should be above 95%%"
msgid "%% MyISAM key buffer used: %s%%, this value should be above 95%%"
msgstr "%% MyISAM nøglebuffer brugt: %s. Denne værdi bør være over 95%%"
msgstr "%% MyISAM-nøglebuffer som bruges: %s%%. Denne værdi bør være over 95%%"
#: libraries/advisory_rules.txt:311
msgid "Percentage of index reads from memory"
@ -13692,7 +13705,7 @@ msgstr ""
"buffer poolen."
#: libraries/advisory_rules.txt:433
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "ally one a system with a lot of writes to InnoDB tables you should "
#| "odb_log_file_size to 25%% of {innodb_buffer_pool_size}. However bigger s "
@ -13714,12 +13727,13 @@ msgid ""
"fine. See also <a href=\"http://mysqldatabaseadministration.blogspot."
"com/2007/01/increase-innodblogfilesize-proper-way.html\">this blog entry</a>"
msgstr ""
"Særligt på et system med mange skrivninger til InnoDB tabeller bør "
"innodb_log_file_size sættes til 25%% af{innodb_buffer_pool_size}. Dog jo "
"Særligt på et system med mange skrivninger til InnoDB-tabeller bør "
"innodb_log_file_size sættes til 25%% af {innodb_buffer_pool_size}. Dog jo "
"større værdi, jo længere er genoprettelsestiden ved databasenedbrud. Derfor "
"bør værdien ikke være højere end 256 MiB. Bemærk, at man ikke bare kan ændre "
"denne værdi. Man skal lukke serveren ned, fjerne InnoDB logfiler, sætte den "
"nye værdi i my.cnf, starte serveren og checke logfiler for fejl. Se også <a "
"denne værdi. Man skal lukke serveren ned, fjerne InnoDB-logfiler, sætte den "
"nye værdi i my.cnf, starte serveren og tjekke at alt gik fint i "
"fejlloggene. Se også <a "
"href=\"http://mysqldatabaseadministration.blogspot.com/2007/01/increase-"
"innodblogfilesize-proper-way.html\">dette blogindlæg</a>"
@ -13741,7 +13755,7 @@ msgid "The InnoDB log file size is inadequately large."
msgstr "InnoDB logfilen er utilstrækkelig stor."
#: libraries/advisory_rules.txt:440
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "usually sufficient to set innodb_log_file_size to 25%% of the size "
#| "nodb_buffer_pool_size}. A very innodb_log_file_size slows down the overy "
@ -13767,17 +13781,17 @@ msgstr ""
"størrelsen af {innodb_buffer_pool_size}. En meget høj innodb_log_file_size "
"reducerer genoprettelsestiden betydeligt efter et databasenedbrud. Se også "
"<a href=\"http://www.mysqlperformanceblog.com/2006/07/03/choosing-proper-"
"innodb_log_file_size/\">denne artikel</a>.Man skal lukke serveren ned, "
"fjerne InnoDB logfiler, sætte den nye værdi i my.cnf, starte serveren og "
"checke logfiler for fejl. Se også <a href=\"http://"
"mysqldatabaseadministration.blogspot.com/2007/01/increase-innodblogfilesize-"
"proper-way.html\">dette blogindlæg</a>"
"innodb_log_file_size/\">denne artikel</a>.Man skal lukke serveren ned, fjerne "
"InnoDB-logfiler, sætte den nye værdi i my.cnf, starte serveren og tjekke at "
"alt gik godt i fejllogene. Se også <a "
"href=\"http://mysqldatabaseadministration.blogspot.com/2007/01/increase-"
"innodblogfilesize-proper-way.html\">dette blogindlæg</a>"
#: libraries/advisory_rules.txt:441
#, fuzzy, php-format
#, php-format
#| msgid "Your absolute InnoD log size is %s MiB"
msgid "Your absolute InnoDB log size is %s MiB"
msgstr "Din absolutte InnoDB logstørrelse er %s MiB"
msgstr "Din absolutte InnoDB-logstørrelse er %s MiB"
#: libraries/advisory_rules.txt:443
msgid "InnoDB buffer pool size"

View File

@ -289,6 +289,7 @@ msgstr "Databasen er uten navn!"
#: db_operations.php:327
#, php-format
#| msgid "Database %s has been renamed to %s"
msgid "Database %1$s has been renamed to %2$s"
msgstr "Databasen %1$s har endret navn til %2$s"

View File

@ -384,10 +384,12 @@ if ($GLOBALS['is_ajax_request']
if (isset($password)) {
$isPass = true;
}
$extra_data = PMA_getExtraDataForAjaxBehavior(
$isPass, $link_export,
(isset($sql_query) ? $sql_query : ''),
$link_edit, $dbname_is_wildcard
$link_edit, $dbname_is_wildcard,
$hostname, $username
);
if ($message instanceof PMA_Message) {

View File

@ -10,6 +10,11 @@
*/
require_once 'libraries/common.inc.php';
/**
* functions implementation for this script
*/
require_once 'libraries/operations.lib.php';
$pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
$common_functions = PMA_CommonFunctions::getInstance();
@ -197,21 +202,20 @@ if (isset($_REQUEST['submitoptions'])) {
* Reordering the table has been requested by the user
*/
if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
$sql_query = '
ALTER TABLE ' . $common_functions->backquote($GLOBALS['table']) . '
ORDER BY ' . $common_functions->backquote(urldecode($_REQUEST['order_field']));
if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') {
$sql_query .= ' DESC';
}
$sql_query .= ';';
$result = PMA_DBI_query($sql_query);
list($sql_query, $result) = PMA_getQueryAndResultForReorderingTable();
} // end if
/**
* A partition operation has been requested by the user
*/
if (isset($_REQUEST['submit_partition']) && ! empty($_REQUEST['partition_operation'])) {
$sql_query = 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table']) . ' ' . $_REQUEST['partition_operation'] . ' PARTITION ' . $_REQUEST['partition_name'] . ';';
if (isset($_REQUEST['submit_partition'])
&& ! empty($_REQUEST['partition_operation'])
) {
$sql_query = 'ALTER TABLE '
. $common_functions->backquote($GLOBALS['table']) . ' '
. $_REQUEST['partition_operation']
. ' PARTITION '
. $_REQUEST['partition_name'] . ';';
$result = PMA_DBI_query($sql_query);
} // end if
@ -271,71 +275,16 @@ $columns = PMA_DBI_get_columns($GLOBALS['db'], $GLOBALS['table']);
/**
* Displays the page
*/
?>
<!-- Order the table -->
<div class="operations_half_width">
<form method="post" id="alterTableOrderby" action="tbl_operations.php" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '');?>>
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<fieldset id="fieldset_table_order">
<legend><?php echo __('Alter table order by'); ?></legend>
<select name="order_field">
<?php
foreach ($columns as $fieldname) {
echo ' <option value="' . htmlspecialchars($fieldname['Field']) . '">'
. htmlspecialchars($fieldname['Field']) . '</option>' . "\n";
}
unset($columns);
?>
</select> <?php echo __('(singly)'); ?>
<select name="order_order">
<option value="asc"><?php echo __('Ascending'); ?></option>
<option value="desc"><?php echo __('Descending'); ?></option>
</select>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submitorderby" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
/**
* Order the table
*/
echo PMA_getHtmlForOrderTheTable($columns);
<!-- Move table -->
<div class="operations_half_width">
<form method="post" action="tbl_operations.php"
onsubmit="return emptyFormElements(this, 'new_name')">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<input type="hidden" name="reload" value="1" />
<input type="hidden" name="what" value="data" />
<fieldset id="fieldset_table_rename">
<legend><?php echo __('Move table to (database<b>.</b>table):'); ?></legend>
<?php if (count($GLOBALS['pma']->databases) > $GLOBALS['cfg']['MaxDbList']) {
?>
<input type="text" maxlength="100" size="30" name="target_db" value="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
<?php
} else {
?>
<select name="target_db">
<?php echo $GLOBALS['pma']->databases->getHtmlOptions(true, false); ?>
</select>
<?php
} // end if
?>
&nbsp;<strong>.</strong>&nbsp;
<input type="text" size="20" name="new_name" onfocus="this.select()"
value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" /><br />
<?php
// starting with MySQL 5.0.24, SHOW CREATE TABLE includes the AUTO_INCREMENT
// next value but users can decide if they want it or not for the operation
?>
<input type="checkbox" name="sql_auto_increment" value="1" id="checkbox_auto_increment_mv" checked="checked" />
<label for="checkbox_auto_increment_mv"><?php echo __('Add AUTO_INCREMENT value'); ?></label><br />
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_move" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
/**
* Move table
*/
echo PMA_getHtmlForMoveTable();
<?php
if (strstr($show_comment, '; InnoDB free') === false) {
if (strstr($show_comment, 'InnoDB free') === false) {
// only user entered comment
@ -356,464 +305,77 @@ if (strstr($show_comment, '; InnoDB free') === false) {
// Here should be version check for InnoDB, however it is supported
// in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
// check for version
?>
<!-- Table options -->
<div class="operations_half_width clearfloat">
<form method="post" action="tbl_operations.php">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<input type="hidden" name="reload" value="1" />
<fieldset>
<legend><?php echo __('Table options'); ?></legend>
<table>
<!-- Change table name -->
<tr><td><?php echo __('Rename table to'); ?></td>
<td><input type="text" size="20" name="new_name" onfocus="this.select()"
value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
</td>
</tr>
<!-- Table comments -->
<tr><td><?php echo __('Table comments'); ?></td>
<td><input type="text" name="comment" maxlength="60" size="30"
value="<?php echo htmlspecialchars($comment); ?>" onfocus="this.select()" />
<input type="hidden" name="prev_comment" value="<?php echo htmlspecialchars($comment); ?>" />
</td>
</tr>
<!-- Storage engine -->
<tr><td><?php echo __('Storage Engine'); ?>
<?php echo $common_functions->showMySQLDocu('Storage_engines', 'Storage_engines'); ?>
</td>
<td><?php echo PMA_StorageEngine::getHtmlSelect('new_tbl_storage_engine', null, $tbl_storage_engine); ?>
</td>
</tr>
<!-- Table character set -->
<tr><td><?php echo __('Collation'); ?></td>
<td><?php echo PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION,
'tbl_collation', null, $tbl_collation, false, 3
); ?>
</td>
</tr>
<?php
if ($is_myisam_or_aria || $is_isam) {
?>
<tr>
<td><label for="new_pack_keys">PACK_KEYS</label></td>
<td><select name="new_pack_keys" id="new_pack_keys">
<option value="DEFAULT" <?php
if ($pack_keys == 'DEFAULT') {
echo 'selected="selected"';
} ?>>DEFAULT</option>
<option value="0" <?php
if ($pack_keys == '0') {
echo 'selected="selected"';
} ?>>0</option>
<option value="1" <?php
if ($pack_keys == '1') {
echo 'selected="selected"';
} ?>>1</option>
</select>
</td>
</tr>
<?php
} // end if (MYISAM|ISAM)
if ($is_myisam_or_aria) {
?>
<tr><td><label for="new_checksum">CHECKSUM</label></td>
<td><input type="checkbox" name="new_checksum" id="new_checksum"
value="1"
<?php echo (isset($checksum) && $checksum == 1)
? ' checked="checked"'
: ''; ?> />
</td>
</tr>
<tr><td><label for="new_delay_key_write">DELAY_KEY_WRITE</label></td>
<td><input type="checkbox" name="new_delay_key_write" id="new_delay_key_write"
value="1"
<?php echo (isset($delay_key_write) && $delay_key_write == 1)
? ' checked="checked"'
: ''; ?> />
</td>
</tr>
<?php
} // end if (MYISAM)
if ($is_aria) {
?>
<tr><td><label for="new_transactional">TRANSACTIONAL</label></td>
<td><input type="checkbox" name="new_transactional" id="new_transactional"
value="1"
<?php echo (isset($transactional) && $transactional == 1)
? ' checked="checked"'
: ''; ?> />
</td>
</tr>
<tr><td><label for="new_page_checksum">PAGE_CHECKSUM</label></td>
<td><input type="checkbox" name="new_page_checksum" id="new_page_checksum"
value="1"
<?php echo (isset($page_checksum) && $page_checksum == 1)
? ' checked="checked"'
: ''; ?> />
</td>
</tr>
<?php
} // end if (ARIA)
if (isset($auto_increment) && strlen($auto_increment) > 0
&& ($is_myisam_or_aria || $is_innodb || $is_pbxt)
) {
?>
<tr><td><label for="auto_increment_opt">AUTO_INCREMENT</label></td>
<td><input type="text" name="new_auto_increment" id="auto_increment_opt"
value="<?php echo $auto_increment; ?>" /></td>
</tr>
<?php
} // end if (MYISAM|INNODB)
// the outer array is for engines, the inner array contains the dropdown
// option values as keys then the dropdown option labels
$possible_row_formats = array(
'ARIA' => array(
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC',
'PAGE' => 'PAGE'
),
'MARIA' => array(
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC',
'PAGE' => 'PAGE'
),
'MYISAM' => array(
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC'
),
'PBXT' => array(
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC'
),
'INNODB' => array(
'COMPACT' => 'COMPACT',
'REDUNDANT' => 'REDUNDANT')
echo PMA_getTableOptionDiv(
$comment, $tbl_collation, $tbl_storage_engine,
$is_myisam_or_aria, $is_isam, $pack_keys,
$auto_increment,
(empty($delay_key_write) ? '0' : '1'),
((isset($transactional) && $transactional == '0') ? '0' : '1'),
((isset($page_checksum)) ? $page_checksum : ''),
$is_innodb, $is_pbxt, $is_aria
);
$innodb_engine_plugin = PMA_StorageEngine::getEngine('innodb');
$innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion();
if (!empty($innodb_plugin_version)) {
$innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat();
} else {
$innodb_file_format = '';
}
if ('Barracuda' == $innodb_file_format && $innodb_engine_plugin->supportsFilePerTable()) {
$possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC';
$possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED';
}
unset($innodb_engine_plugin, $innodb_plugin_version, $innodb_file_format);
/**
* Copy table
*/
echo PMA_getHtmlForCopytable();
// for MYISAM there is also COMPRESSED but it can be set only by the
// myisampack utility, so don't offer here the choice because if we
// try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
// does not return a warning
// (if the table was compressed, it can be seen on the Structure page)
echo '<br class="clearfloat"/>';
if (isset($possible_row_formats[$tbl_storage_engine])) {
$current_row_format = strtoupper($showtable['Row_format']);
echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
echo '<td>';
echo $common_functions->getDropdown(
'new_row_format', $possible_row_formats[$tbl_storage_engine],
$current_row_format, 'new_row_format'
/**
* Table maintenance
*/
echo PMA_getHtmlForTableMaintenance($is_myisam_or_aria, $is_innodb,
$is_berkeleydb, $url_params
);
unset($possible_row_formats, $current_row_format);
echo '</td>';
echo '</tr>';
}
?>
</table>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submitoptions" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
<!-- Copy table -->
<div class="operations_half_width">
<form method="post" action="tbl_operations.php" name="copyTable" id="copyTable" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '');?>
onsubmit="return emptyFormElements(this, 'new_name')">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<input type="hidden" name="reload" value="1" />
<fieldset>
<legend><?php echo __('Copy table to (database<b>.</b>table):'); ?></legend>
<?php if (count($GLOBALS['pma']->databases) > $GLOBALS['cfg']['MaxDbList']) {
?>
<input type="text" maxlength="100" size="30" name="target_db" value="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
<?php
} else {
?>
<select name="target_db">
<?php echo $GLOBALS['pma']->databases->getHtmlOptions(true, false); ?>
</select>
<?php
} // end if
?>
&nbsp;<strong>.</strong>&nbsp;
<input type="text" size="20" name="new_name" onfocus="this.select()" value="<?php echo htmlspecialchars($GLOBALS['table']); ?>"/><br />
<?php
$choices = array(
'structure' => __('Structure only'),
'data' => __('Structure and data'),
'dataonly' => __('Data only'));
echo $common_functions->getRadioFields('what', $choices, 'data', true);
unset($choices);
?>
<input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" />
<label for="checkbox_drop"><?php echo sprintf(__('Add %s'), 'DROP TABLE'); ?></label><br />
<input type="checkbox" name="sql_auto_increment" value="1" id="checkbox_auto_increment_cp" />
<label for="checkbox_auto_increment_cp"><?php echo __('Add AUTO_INCREMENT value'); ?></label><br />
<?php
// display "Add constraints" choice only if there are
// foreign keys
if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
?>
<input type="checkbox" name="add_constraints" value="1" id="checkbox_constraints" />
<label for="checkbox_constraints"><?php echo __('Add constraints'); ?></label><br />
<?php
} // endif
if (isset($_COOKIE['pma_switch_to_new'])
&& $_COOKIE['pma_switch_to_new'] == 'true'
) {
$pma_switch_to_new = 'true';
}
?>
<input type="checkbox" name="switch_to_new" value="true"
id="checkbox_switch"<?php echo
isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
? ' checked="checked"'
: ''; ?> />
<label for="checkbox_switch"><?php echo __('Switch to copied table'); ?></label>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_copy" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
<br class="clearfloat"/>
<div class="operations_half_width">
<fieldset>
<legend><?php echo __('Table maintenance'); ?></legend>
<ul id="tbl_maintenance" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '');?>>
<?php
// Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
if ($is_myisam_or_aria || $is_innodb) {
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => 'CHECK TABLE ' . $common_functions->backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
)
);
?>
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Check table'); ?></a>
<?php echo $common_functions->showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?>
</li>
<?php
}
if ($is_innodb) {
$this_url_params = array_merge(
$url_params,
array('sql_query' => 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table']) . ' ENGINE = InnoDB;')
);
?>
<li><a class='maintain_action' href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Defragment table'); ?></a>
<?php echo $common_functions->showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?>
</li>
<?php
}
if ($is_myisam_or_aria || $is_berkeleydb) {
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => 'ANALYZE TABLE ' . $common_functions->backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
)
);
?>
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Analyze table'); ?></a>
<?php echo $common_functions->showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?>
</li>
<?php
}
if ($is_myisam_or_aria && !PMA_DRIZZLE) {
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => 'REPAIR TABLE ' . $common_functions->backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
)
);
?>
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Repair table'); ?></a>
<?php echo $common_functions->showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?>
</li>
<?php
}
if (($is_myisam_or_aria || $is_innodb || $is_berkeleydb) && !PMA_DRIZZLE) {
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => 'OPTIMIZE TABLE ' . $common_functions->backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
)
);
?>
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Optimize table'); ?></a>
<?php echo $common_functions->showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?>
</li>
<?php
}
} // end MYISAM or BERKELEYDB case
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => 'FLUSH TABLE ' . $common_functions->backquote($GLOBALS['table']),
'message_to_show' => sprintf(
__('Table %s has been flushed'),
htmlspecialchars($GLOBALS['table'])
),
'reload' => 1,
)
);
?>
<li><a class='maintain_action' href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Flush the table (FLUSH)'); ?></a>
<?php echo $common_functions->showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?>
</li>
</ul>
</fieldset>
</div>
<?php if (! (isset($db_is_information_schema) && $db_is_information_schema)) { ?>
<div class="operations_half_width">
<fieldset class="caution">
<legend><?php echo __('Delete data or table'); ?></legend>
<ul>
<?php
if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
$this_sql_query = 'TRUNCATE TABLE ' . $common_functions->backquote($GLOBALS['table']);
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => $this_sql_query,
'goto' => 'tbl_structure.php',
'reload' => '1',
'message_to_show' => sprintf(__('Table %s has been emptied'), htmlspecialchars($table)),
)
);
?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'id="truncate_tbl_anchor" class="ajax"' : ''); ?>>
<?php echo __('Empty the table (TRUNCATE)'); ?></a>
<?php echo $common_functions->showMySQLDocu('SQL-Syntax', 'TRUNCATE_TABLE'); ?>
</li>
<?php
}
if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$this_sql_query = 'DROP TABLE ' . $common_functions->backquote($GLOBALS['table']);
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => $this_sql_query,
'goto' => 'db_operations.php',
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table)),
// table name is needed to avoid running
// PMA_relationsCleanupDatabase() on the whole db later
'table' => $GLOBALS['table'],
)
$truncate_table_url_params = array();
$drop_table_url_params = array();
if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
$this_sql_query = 'TRUNCATE TABLE ' . $common_functions->backquote($GLOBALS['table']);
$truncate_table_url_params = array_merge(
$url_params,
array(
'sql_query' => $this_sql_query,
'goto' => 'tbl_structure.php',
'reload' => '1',
'message_to_show' => sprintf(__('Table %s has been emptied'), htmlspecialchars($table)),
)
);
}
if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$this_sql_query = 'DROP TABLE ' . $common_functions->backquote($GLOBALS['table']);
$drop_table_url_params = array_merge(
$url_params,
array(
'sql_query' => $this_sql_query,
'goto' => 'db_operations.php',
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table)),
// table name is needed to avoid running
// PMA_relationsCleanupDatabase() on the whole db later
'table' => $GLOBALS['table'],
)
);
}
echo PMA_getHtmlForDeleteDataOrTable($truncate_table_url_params,
$drop_table_url_params
);
?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'id="drop_tbl_anchor"' : ''); ?>>
<?php echo __('Delete the table (DROP)'); ?></a>
<?php echo $common_functions->showMySQLDocu('SQL-Syntax', 'DROP_TABLE'); ?>
</li>
<?php
}
?>
</ul>
</fieldset>
</div>
<?php
}
?>
<br class="clearfloat">
<?php if (PMA_Partition::havePartitioning()) {
echo '<br class="clearfloat">';
if (PMA_Partition::havePartitioning()) {
$partition_names = PMA_Partition::getPartitionNames($db, $table);
// show the Partition maintenance section only if we detect a partition
if (! is_null($partition_names[0])) {
?>
<div class="operations_half_width">
<form method="post" action="tbl_operations.php">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<fieldset>
<legend><?php echo __('Partition maintenance'); ?></legend>
<?php
$html_select = '<select name="partition_name">' . "\n";
foreach ($partition_names as $one_partition) {
$one_partition = htmlspecialchars($one_partition);
$html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
}
$html_select .= '</select>' . "\n";
printf(__('Partition %s'), $html_select);
unset($partition_names, $one_partition, $html_select);
$choices = array(
'ANALYZE' => __('Analyze'),
'CHECK' => __('Check'),
'OPTIMIZE' => __('Optimize'),
'REBUILD' => __('Rebuild'),
'REPAIR' => __('Repair'));
echo $common_functions->getRadioFields('partition_operation', $choices, '', false);
unset($choices);
echo $common_functions->showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
// I'm not sure of the best way to display that; this link does
// not depend on the Go button
$this_url_params = array_merge(
$url_params,
array(
'sql_query' => 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;'
)
);
?>
<br /><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Remove partitioning'); ?></a>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_partition" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
</div>
<?php
} // end if
echo PMA_getHtmlForPartitionMaintenance($partition_names, $url_params);
} // end if
} // end if
unset($partition_names);
// Referential integrity check
// The Referential integrity check was intended for the non-InnoDB
@ -826,48 +388,7 @@ if ($cfgRelation['relwork'] && ! $is_innodb) {
$foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
if ($foreign) {
?>
<!-- Referential integrity check -->
<div class="operations_half_width">
<fieldset>
<legend><?php echo __('Check referential integrity:'); ?></legend>
<ul>
<?php
echo "\n";
foreach ($foreign AS $master => $arr) {
$join_query = 'SELECT ' . $common_functions->backquote($GLOBALS['table']) . '.* FROM '
. $common_functions->backquote($GLOBALS['table']) . ' LEFT JOIN '
. $common_functions->backquote($arr['foreign_table']);
if ($arr['foreign_table'] == $GLOBALS['table']) {
$foreign_table = $GLOBALS['table'] . '1';
$join_query .= ' AS ' . $common_functions->backquote($foreign_table);
} else {
$foreign_table = $arr['foreign_table'];
}
$join_query .= ' ON '
. $common_functions->backquote($GLOBALS['table']) . '.' . $common_functions->backquote($master)
. ' = ' . $common_functions->backquote($foreign_table) . '.' . $common_functions->backquote($arr['foreign_field'])
. ' WHERE '
. $common_functions->backquote($foreign_table) . '.' . $common_functions->backquote($arr['foreign_field'])
. ' IS NULL AND '
. $common_functions->backquote($GLOBALS['table']) . '.' . $common_functions->backquote($master)
. ' IS NOT NULL';
$this_url_params = array_merge(
$url_params,
array('sql_query' => $join_query)
);
echo ' <li>'
. '<a href="sql.php'
. PMA_generate_common_url($this_url_params)
. '">' . $master . '&nbsp;->&nbsp;' . $arr['foreign_table'] . '.' . $arr['foreign_field']
. '</a></li>' . "\n";
} // foreach $foreign
unset($foreign_table, $join_query);
?>
</ul>
</fieldset>
</div>
<?php
echo PMA_getHtmlForReferentialIntegrityCheck($foreign, $url_params);
} // end if ($foreign)
} // end if (!empty($cfg['Server']['relation']))