Merge remote-tracking branch 'origin/master' into useNamespaces_master
This commit is contained in:
commit
6c8c288067
@ -4,6 +4,8 @@ phpMyAdmin - ChangeLog
|
||||
4.6.0.0 (not yet released)
|
||||
+ issue #11456 Disabled storage engines
|
||||
+ issue #11479 Allow setting routine wise privileges
|
||||
- issue Hide Insert tab for non-updatable views
|
||||
+ issue #11490 UI for defining partitioning in create table window
|
||||
|
||||
4.5.1.0 (not yet released)
|
||||
- issue Invalid argument supplied for foreach()
|
||||
@ -15,6 +17,9 @@ phpMyAdmin - ChangeLog
|
||||
- issue #11495 'PMA_Microhistory' is undefined
|
||||
- issue #11496 Incorrect definition for getTablesWhenOpen()
|
||||
- issue #11500 Error when creating new user on MariaDB 10.0.21
|
||||
- issue #11505 Notice on htmlspecialchars()
|
||||
- issue Notice in Structure page of views
|
||||
- issue #11510 AUTO_INCREMENT always exported when IF NOT EXISTS is on
|
||||
|
||||
4.5.0.2 (2015-09-25)
|
||||
- issue #11497 Incorrect indexes when exporting
|
||||
|
||||
@ -2039,7 +2039,7 @@ on its own. By selecting this option, phpMyAdmin will adjust the privilege
|
||||
table so that users have the same privileges on the new items.
|
||||
|
||||
For example: A user 'bob'@'localhost' has a 'SELECT' privilege on a
|
||||
column named 'id'. Now, if this column is renamed to 'id_new'; MySQL,
|
||||
column named 'id'. Now, if this column is renamed to 'id_new', MySQL,
|
||||
on its own, would **not** adjust the column privileges to the new column name.
|
||||
phpMyAdmin can make this adjustment for you automatically.
|
||||
|
||||
|
||||
@ -2742,6 +2742,9 @@ AJAX.registerTeardown('functions.js', function () {
|
||||
$(document).off('submit', "form.create_table_form.ajax");
|
||||
$(document).off('click', "form.create_table_form.ajax input[name=submit_num_fields]");
|
||||
$(document).off('keyup', "form.create_table_form.ajax input");
|
||||
$(document).off('change', "form.create_table_form.ajax input[name=partition_count]," +
|
||||
"form.create_table_form.ajax input[name=subpartition_count]," +
|
||||
"form.create_table_form.ajax select[name=partition_by]");
|
||||
});
|
||||
|
||||
/**
|
||||
@ -2855,24 +2858,21 @@ AJAX.registerOnload('functions.js', function () {
|
||||
}); // end create table form (save)
|
||||
|
||||
/**
|
||||
* Attach event handler for create table form (add fields)
|
||||
* Submits the intermediate changes in the table creation form
|
||||
* to refresh the UI accordingly
|
||||
*/
|
||||
$(document).on('click', "form.create_table_form.ajax input[name=submit_num_fields]", function (event) {
|
||||
event.preventDefault();
|
||||
function submitChangesInCreateTableForm (actionParam) {
|
||||
|
||||
/**
|
||||
* @var the_form object referring to the create table form
|
||||
*/
|
||||
var $form = $(this).closest('form');
|
||||
|
||||
if (!checkFormElementInRange(this.form, 'added_fields', PMA_messages.strLeastColumnError, 1)) {
|
||||
return;
|
||||
}
|
||||
var $form = $('form.create_table_form.ajax');
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
//User wants to add more fields to the table
|
||||
$.post($form.attr('action'), $form.serialize() + "&submit_num_fields=1", function (data) {
|
||||
$.post($form.attr('action'), $form.serialize() + "&" + actionParam, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
var $pageContent = $("#page_content");
|
||||
$pageContent.html(data.message);
|
||||
@ -2884,6 +2884,19 @@ AJAX.registerOnload('functions.js', function () {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}); //end $.post()
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach event handler for create table form (add fields)
|
||||
*/
|
||||
$(document).on('click', "form.create_table_form.ajax input[name=submit_num_fields]", function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (!checkFormElementInRange(this.form, 'added_fields', PMA_messages.strLeastColumnError, 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
submitChangesInCreateTableForm('submit_num_fields=1');
|
||||
}); // end create table form (add fields)
|
||||
|
||||
$(document).on('keydown', "form.create_table_form.ajax input[name=added_fields]", function (event) {
|
||||
@ -2896,6 +2909,16 @@ AJAX.registerOnload('functions.js', function () {
|
||||
.click();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler to manage changes in number of partitions and subpartitions
|
||||
*/
|
||||
$(document).on('change', "form.create_table_form.ajax input[name=partition_count]," +
|
||||
"form.create_table_form.ajax input[name=subpartition_count]," +
|
||||
"form.create_table_form.ajax select[name=partition_by]", function (event) {
|
||||
submitChangesInCreateTableForm('submit_partition_change=1');
|
||||
});
|
||||
|
||||
$("input[value=AUTO_INCREMENT]").change(function(){
|
||||
if (this.checked) {
|
||||
var col = /\d/.exec($(this).attr('name'));
|
||||
|
||||
@ -299,6 +299,11 @@ class Menu
|
||||
$db_is_system_schema = $GLOBALS['dbi']->isSystemSchema($this->_db);
|
||||
$tbl_is_view = $GLOBALS['dbi']->getTable($this->_db, $this->_table)
|
||||
->isView();
|
||||
$updatable_view = false;
|
||||
if ($tbl_is_view) {
|
||||
$updatable_view = $GLOBALS['dbi']->getTable($this->_db, $this->_table)
|
||||
->isUpdatableView();
|
||||
}
|
||||
$is_superuser = $GLOBALS['dbi']->isSuperuser();
|
||||
$isCreateOrGrantUser = $GLOBALS['dbi']->isUserType('grant')
|
||||
|| $GLOBALS['dbi']->isUserType('create');
|
||||
@ -330,7 +335,7 @@ class Menu
|
||||
array('tbl_select.php', 'tbl_zoom_select.php', 'tbl_find_replace.php')
|
||||
);
|
||||
|
||||
if (! $db_is_system_schema) {
|
||||
if (! $db_is_system_schema && (! $tbl_is_view || $updatable_view)) {
|
||||
$tabs['insert']['icon'] = 'b_insrow.png';
|
||||
$tabs['insert']['link'] = 'tbl_change.php';
|
||||
$tabs['insert']['text'] = __('Insert');
|
||||
|
||||
@ -135,18 +135,24 @@ class StorageEngine
|
||||
* @param string $selected The selected engine
|
||||
* @param boolean $offerUnavailableEngines Should unavailable storage
|
||||
* engines be offered?
|
||||
* @param boolean $addEmpty Whether to provide empty option
|
||||
*
|
||||
* @static
|
||||
* @return string html selectbox
|
||||
*/
|
||||
static public function getHtmlSelect(
|
||||
$name = 'engine', $id = null,
|
||||
$selected = null, $offerUnavailableEngines = false
|
||||
$selected = null, $offerUnavailableEngines = false,
|
||||
$addEmpty = false
|
||||
) {
|
||||
$selected = /*overload*/mb_strtolower($selected);
|
||||
$output = '<select name="' . $name . '"'
|
||||
. (empty($id) ? '' : ' id="' . $id . '"') . '>' . "\n";
|
||||
|
||||
if ($addEmpty) {
|
||||
$output .= '<option value=""></option>';
|
||||
}
|
||||
|
||||
foreach (StorageEngine::getStorageEngines() as $key => $details) {
|
||||
// Don't show PERFORMANCE_SCHEMA engine (MySQL 5.5)
|
||||
if (! $offerUnavailableEngines
|
||||
@ -161,7 +167,7 @@ class StorageEngine
|
||||
. (empty($details['Comment'])
|
||||
? '' : ' title="' . htmlspecialchars($details['Comment']) . '"')
|
||||
. (/*overload*/mb_strtolower($key) == $selected
|
||||
|| (empty($selected) && $details['Support'] == 'DEFAULT')
|
||||
|| (empty($selected) && $details['Support'] == 'DEFAULT' && ! $addEmpty)
|
||||
? ' selected="selected"' : '')
|
||||
. '>' . "\n"
|
||||
. ' ' . htmlspecialchars($details['Engine']) . "\n"
|
||||
|
||||
@ -251,8 +251,14 @@ function PMA_displayInput($path, $name, $type, $value, $description = '',
|
||||
. ' value="' . htmlspecialchars($value) . '" />';
|
||||
break;
|
||||
case 'short_text':
|
||||
$htmlOutput .= '<input type="text" size="25" ' . $name_id . $field_class
|
||||
. ' value="' . htmlspecialchars($value) . '" />';
|
||||
// As seen in the reporting server (#15042) we sometimes receive
|
||||
// an array here. No clue about its origin nor content, so let's avoid
|
||||
// a notice on htmlspecialchars().
|
||||
if (! is_array($value)) {
|
||||
$htmlOutput .= '<input type="text" size="25" ' . $name_id
|
||||
. $field_class . ' value="' . htmlspecialchars($value)
|
||||
. '" />';
|
||||
}
|
||||
break;
|
||||
case 'number_text':
|
||||
$htmlOutput .= '<input type="number" ' . $name_id . $field_class
|
||||
|
||||
@ -294,6 +294,106 @@ function PMA_getColumnCreationStatements($is_create_tbl = true)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the partitioning clause
|
||||
*
|
||||
* @return string partitioning clause
|
||||
*/
|
||||
function PMA_getPartitionsDefinition()
|
||||
{
|
||||
$sql_query = "";
|
||||
if (! empty($_REQUEST['partition_by'])
|
||||
&& ! empty($_REQUEST['partition_expr'])
|
||||
&& ! empty($_REQUEST['partition_count'])
|
||||
&& $_REQUEST['partition_count'] > 1
|
||||
) {
|
||||
$sql_query .= " PARTITION BY " . $_REQUEST['partition_by']
|
||||
. " (" . $_REQUEST['partition_expr'] . ")"
|
||||
. " PARTITIONS " . $_REQUEST['partition_count'];
|
||||
}
|
||||
|
||||
if (! empty($_REQUEST['subpartition_by'])
|
||||
&& ! empty($_REQUEST['subpartition_expr'])
|
||||
&& ! empty($_REQUEST['subpartition_count'])
|
||||
&& $_REQUEST['subpartition_count'] > 1
|
||||
) {
|
||||
$sql_query .= " SUBPARTITION BY " . $_REQUEST['subpartition_by']
|
||||
. " (" . $_REQUEST['subpartition_expr'] . ")"
|
||||
. " SUBPARTITIONS " . $_REQUEST['subpartition_count'];
|
||||
}
|
||||
|
||||
if (! empty($_REQUEST['partitions'])) {
|
||||
$i = 0;
|
||||
$partitions = array();
|
||||
foreach ($_REQUEST['partitions'] as $partition) {
|
||||
$partitions[] = PMA_getPartitionDefinition('p' . $i, $partition);
|
||||
$i++;
|
||||
}
|
||||
$sql_query .= " (" . implode(", ", $partitions) . ")";
|
||||
}
|
||||
|
||||
return $sql_query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the definition of a partition/subpartition
|
||||
*
|
||||
* @param string $name name of the partition/subpartition
|
||||
* @param array $partition array of partition/subpartition detiails
|
||||
* @param boolean $isSubPartition whether a subpartition
|
||||
*
|
||||
* @return string partition/subpartition definition
|
||||
*/
|
||||
function PMA_getPartitionDefinition($name, $partition, $isSubPartition = false)
|
||||
{
|
||||
$sql_query = " " . ($isSubPartition ? "SUB" : "") . "PARTITION " . $name;
|
||||
|
||||
if (! empty($partition['value_type'])) {
|
||||
$sql_query .= " VALUES " . $partition['value_type'];
|
||||
|
||||
if ($partition['value_type'] != 'LESS THAN MAXVALUE') {
|
||||
$sql_query .= " (" . $partition['value'] . ")";
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($partition['engine'])) {
|
||||
$sql_query .= " ENGINE = " . $partition['engine'];
|
||||
}
|
||||
if (! empty($partition['comment'])) {
|
||||
$sql_query .= " COMMENT = '" . $partition['comment'] . "'";
|
||||
}
|
||||
if (! empty($partition['data_directory'])) {
|
||||
$sql_query .= " DATA DIRECTORY = '" . $partition['data_directory'] . "'";
|
||||
}
|
||||
if (! empty($partition['index_directory'])) {
|
||||
$sql_query .= " INDEX_DIRECTORY = '" . $partition['index_directory'] . "'";
|
||||
}
|
||||
if (! empty($partition['max_rows'])) {
|
||||
$sql_query .= " MAX_ROWS = " . $partition['max_rows'];
|
||||
}
|
||||
if (! empty($partition['min_rows'])) {
|
||||
$sql_query .= " MIN_ROWS = " . $partition['min_rows'];
|
||||
}
|
||||
if (! empty($partition['tablespace'])) {
|
||||
$sql_query .= " TABLESPACE = " . $partition['tablespace'];
|
||||
}
|
||||
if (! empty($partition['node_group'])) {
|
||||
$sql_query .= " NODEGROUP = " . $partition['node_group'];
|
||||
}
|
||||
|
||||
if (! empty($partition['subpartitions'])) {
|
||||
$j = 0;
|
||||
$subpartitions = array();
|
||||
foreach ($partition['subpartitions'] as $subpartition) {
|
||||
$subpartitions[] = PMA_getPartitionDefinition($name . 's' . $j, $subpartition, true);
|
||||
$j++;
|
||||
}
|
||||
$sql_query .= " (" . implode(", ", $subpartitions) . ")";
|
||||
}
|
||||
|
||||
return $sql_query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get table creation sql query
|
||||
*
|
||||
@ -331,11 +431,7 @@ function PMA_getTableCreationQuery($db, $table)
|
||||
$sql_query .= ' COMMENT = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['comment']) . '\'';
|
||||
}
|
||||
if (!empty($_REQUEST['partition_definition'])) {
|
||||
$sql_query .= ' ' . PMA\libraries\Util::sqlAddSlashes(
|
||||
$_REQUEST['partition_definition']
|
||||
);
|
||||
}
|
||||
$sql_query .= PMA_getPartitionsDefinition();
|
||||
$sql_query .= ';';
|
||||
|
||||
return $sql_query;
|
||||
@ -348,13 +444,15 @@ function PMA_getTableCreationQuery($db, $table)
|
||||
*/
|
||||
function PMA_getNumberOfFieldsFromRequest()
|
||||
{
|
||||
if (isset($_REQUEST['submit_num_fields'])) {
|
||||
if (isset($_REQUEST['submit_num_fields'])) { // adding new fields
|
||||
$num_fields = $_REQUEST['orig_num_fields'] + $_REQUEST['added_fields'];
|
||||
} elseif (isset($_REQUEST['orig_num_fields'])) { // retaining existing fields
|
||||
$num_fields = $_REQUEST['orig_num_fields'];
|
||||
} elseif (isset($_REQUEST['num_fields'])
|
||||
&& intval($_REQUEST['num_fields']) > 0
|
||||
) {
|
||||
) { // new table with specified number of fields
|
||||
$num_fields = (int) $_REQUEST['num_fields'];
|
||||
} else {
|
||||
} else { // new table with unspecified number of fields
|
||||
$num_fields = 4;
|
||||
}
|
||||
|
||||
|
||||
@ -1766,7 +1766,8 @@ class ExportSql extends ExportPlugin
|
||||
// Removing the `AUTO_INCREMENT` attribute from the `CREATE TABLE`
|
||||
// too.
|
||||
if (!empty($statement->entityOptions)
|
||||
&& empty($GLOBALS['sql_if_not_exists'])
|
||||
&& (empty($GLOBALS['sql_if_not_exists'])
|
||||
|| empty($GLOBALS['sql_auto_increment']))
|
||||
) {
|
||||
$statement->entityOptions->remove('AUTO_INCREMENT');
|
||||
}
|
||||
|
||||
@ -732,7 +732,7 @@ function PMA_getHtmlForRequires($row)
|
||||
$html_output .= '<input type="radio" name="ssl_type" id="ssl_type_NONE"'
|
||||
. ' value="NONE" title="'
|
||||
. __(
|
||||
'Does not requires SSL-encrypted connections.'
|
||||
'Does not require SSL-encrypted connections.'
|
||||
)
|
||||
. '"'
|
||||
. ((isset($row['ssl_type'])
|
||||
|
||||
@ -114,7 +114,7 @@ if (isset($field_fulltext) && is_array($field_fulltext)) {
|
||||
$submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
|
||||
}
|
||||
}
|
||||
if (isset($_REQUEST['submit_num_fields'])) {
|
||||
if (isset($_REQUEST['submit_num_fields']) || isset($_REQUEST['submit_partition_change'])) {
|
||||
//if adding new fields, set regenerate to keep the original values
|
||||
$regenerate = 1;
|
||||
}
|
||||
@ -402,6 +402,7 @@ $html = PMA\libraries\Template::get('columns_definitions/column_definitions_form
|
||||
'action' => $action,
|
||||
'form_params' => $form_params,
|
||||
'content_cells' => $content_cells,
|
||||
'partitionDetails' => isset($partitionDetails) ? $partitionDetails : array()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
2773
po/be@latin.po
2773
po/be@latin.po
File diff suppressed because it is too large
Load Diff
3017
po/en_GB.po
3017
po/en_GB.po
File diff suppressed because it is too large
Load Diff
2707
po/phpmyadmin.pot
2707
po/phpmyadmin.pot
File diff suppressed because it is too large
Load Diff
2831
po/pt_BR.po
2831
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
2782
po/sr@latin.po
2782
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
2773
po/uz@latin.po
2773
po/uz@latin.po
File diff suppressed because it is too large
Load Diff
3012
po/zh_CN.po
3012
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
2903
po/zh_TW.po
2903
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@ -101,6 +101,104 @@ if (isset($_REQUEST['do_save_data'])) {
|
||||
//This global variable needs to be reset for the headerclass to function properly
|
||||
$GLOBAL['table'] = '';
|
||||
|
||||
$partitionDetails = array();
|
||||
|
||||
// Extract some partitioning and subpartitioning parameters from the request
|
||||
$partitionParams = array(
|
||||
'partition_by', 'partition_expr', 'partition_count',
|
||||
'subpartition_by', 'subpartition_expr', 'subpartition_count'
|
||||
);
|
||||
foreach ($partitionParams as $partitionParam) {
|
||||
$partitionDetails[$partitionParam] = isset($_REQUEST[$partitionParam])
|
||||
? $_REQUEST[$partitionParam] : '';
|
||||
}
|
||||
|
||||
// Only LIST and RANGE type parameters allow subpartitioning
|
||||
$partitionDetails['can_have_subpartitions'] = isset($_REQUEST['partition_count'])
|
||||
&& $_REQUEST['partition_count'] > 1
|
||||
&& isset($_REQUEST['partition_by'])
|
||||
&& ($_REQUEST['partition_by'] == 'RANGE' || $_REQUEST['partition_by'] == 'LIST');
|
||||
|
||||
if (PMA_isValid($_REQUEST['partition_count'], 'numeric')
|
||||
&& $_REQUEST['partition_count'] > 1
|
||||
) { // Has partitions
|
||||
$partitions = isset($_REQUEST['partitions']) ? $_REQUEST['partitions'] : array();
|
||||
|
||||
// Remove details of the additional partitions
|
||||
// when number of partitions have been reduced
|
||||
array_splice($partitions, $_REQUEST['partition_count']);
|
||||
|
||||
for ($i = 0; $i < $_REQUEST['partition_count']; $i++) {
|
||||
if (! isset($partitions[$i])) { // Newly added partition
|
||||
$partitions[$i] = array(
|
||||
'value_type' => '',
|
||||
'value' => '',
|
||||
'engine' => '',
|
||||
'comment' => '',
|
||||
'data_directory' => '',
|
||||
'index_directory' => '',
|
||||
'max_rows' => '',
|
||||
'min_rows' => '',
|
||||
'tablespace' => '',
|
||||
'node_group' => '',
|
||||
);
|
||||
}
|
||||
|
||||
$partition =& $partitions[$i];
|
||||
$partition['name'] = 'p' . $i;
|
||||
$partition['prefix'] = 'partitions[' . $i . ']';
|
||||
|
||||
// Values are specified only for LIST and RANGE type partitions
|
||||
$partition['value_enabled'] = isset($_REQUEST['partition_by'])
|
||||
&& ($_REQUEST['partition_by'] == 'RANGE'
|
||||
|| $_REQUEST['partition_by'] == 'LIST');
|
||||
if (! $partition['value_enabled']) {
|
||||
$partition['value_type'] = '';
|
||||
$partition['value'] = '';
|
||||
}
|
||||
|
||||
if (PMA_isValid($_REQUEST['subpartition_count'], 'numeric')
|
||||
&& $_REQUEST['subpartition_count'] > 1
|
||||
&& $partitionDetails['can_have_subpartitions'] == true
|
||||
) { // Has subpartitions
|
||||
$partition['subpartition_count'] = $_REQUEST['subpartition_count'];
|
||||
|
||||
if (! isset($partition['subpartitions'])) {
|
||||
$partition['subpartitions'] = array();
|
||||
}
|
||||
$subpartitions =& $partition['subpartitions'];
|
||||
|
||||
// Remove details of the additional subpartitions
|
||||
// when number of subpartitions have been reduced
|
||||
array_splice($subpartitions, $_REQUEST['subpartition_count']);
|
||||
|
||||
for ($j = 0; $j < $_REQUEST['subpartition_count']; $j++) {
|
||||
if (! isset($subpartitions[$j])) { // Newly added subpartition
|
||||
$subpartitions[$j] = array(
|
||||
'engine' => '',
|
||||
'comment' => '',
|
||||
'data_directory' => '',
|
||||
'index_directory' => '',
|
||||
'max_rows' => '',
|
||||
'min_rows' => '',
|
||||
'tablespace' => '',
|
||||
'node_group' => '',
|
||||
);
|
||||
}
|
||||
|
||||
$subpartition =& $subpartitions[$j];
|
||||
$subpartition['name'] = 'p' . $i . 's' . $j;
|
||||
$subpartition['prefix'] = 'partitions[' . $i . ']'
|
||||
. '[subpartitions][' . $j . ']';
|
||||
}
|
||||
} else { // No subpartitions
|
||||
unset($partition['subpartitions']);
|
||||
unset($partition['subpartition_count']);
|
||||
}
|
||||
}
|
||||
$partitionDetails['partitions'] = $partitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the form used to define the structure of the table
|
||||
*/
|
||||
|
||||
@ -138,23 +138,16 @@ use PMA\libraries\StorageEngine;
|
||||
</tr>
|
||||
<?php if (Partition::havePartitioning()): ?>
|
||||
<tr class="vtop">
|
||||
<th>
|
||||
<th colspan="5">
|
||||
<?php echo __('PARTITION definition:'); ?>
|
||||
|
||||
<?php echo PMA\libraries\Util::showMySQLDocu('Partitioning'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<textarea name="partition_definition"
|
||||
id="partitiondefinition"
|
||||
cols="<?php echo $GLOBALS['cfg']['TextareaCols']; ?>"
|
||||
rows="<?php echo $GLOBALS['cfg']['TextareaRows']; ?>"
|
||||
dir="<?php echo $GLOBALS['text_dir']; ?>">
|
||||
|
||||
<?php echo (isset($_REQUEST['partition_definition']) ? htmlspecialchars($_REQUEST['partition_definition']) : ''); ?>
|
||||
|
||||
</textarea>
|
||||
<td colspan="5">
|
||||
<?php echo PMA\Template::get('columns_definitions/partitions_form')
|
||||
->render(array('partitionDetails' => $partitionDetails)); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
169
templates/columns_definitions/partitions_form.phtml
Normal file
169
templates/columns_definitions/partitions_form.phtml
Normal file
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
$partitionOptions = array('', 'HASH', 'LINEAR HASH', 'KEY', 'LINEAR KEY', 'RANGE', 'LIST');
|
||||
$subPartitionOptions = array('', 'HASH', 'LINEAR HASH', 'KEY', 'LINEAR KEY');
|
||||
$valueTypeOptions = array('', 'LESS THAN', 'LESS THAN MAXVALUE', 'IN');
|
||||
?>
|
||||
|
||||
<table id="partition_table">
|
||||
<tr class="vmiddle">
|
||||
<td><label for="partition_by"><?php echo __('Partition by:'); ?></label></td>
|
||||
<td>
|
||||
<select name="partition_by" id="partition_by">
|
||||
<?php foreach ($partitionOptions as $option): ?>
|
||||
<option value="<?php echo $option?>"
|
||||
<?php if ($partitionDetails['partition_by'] == $option): ?>
|
||||
selected="selected"
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php echo $option; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
<td>(
|
||||
<input name="partition_expr" type="text"
|
||||
placeholder="<?php echo __('Expression or column list'); ?>"
|
||||
value="<?php echo htmlspecialchars($partitionDetails['partition_expr']); ?>"/>
|
||||
)</td>
|
||||
</tr>
|
||||
<tr class="vmiddle">
|
||||
<td><label for="partition_count"><?php echo __('Partitions:'); ?></label></td>
|
||||
<td>
|
||||
<input name="partition_count" type="number" min="2"
|
||||
value="<?php echo htmlspecialchars($partitionDetails['partition_count']); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($partitionDetails['can_have_subpartitions']): ?>
|
||||
<tr class="vmiddle">
|
||||
<td><label for="subpartition_by"><?php echo __('Subpartition by:'); ?></label></td>
|
||||
<td>
|
||||
<select name="subpartition_by" id="subpartition_by">
|
||||
<?php foreach ($subPartitionOptions as $option): ?>
|
||||
<option value="<?php echo $option?>"
|
||||
<?php if ($partitionDetails['subpartition_by'] == $option): ?>
|
||||
selected="selected"
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php echo $option; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
<td>(
|
||||
<input name="subpartition_expr" type="text"
|
||||
placeholder="<?php echo __('Expression or column list'); ?>"
|
||||
value="<?php echo htmlspecialchars($partitionDetails['subpartition_expr']); ?>"/>
|
||||
)</td>
|
||||
</tr>
|
||||
<tr class="vmiddle">
|
||||
<td><label for="subpartition_count"><?php echo __('Subpartitions:'); ?></label></td>
|
||||
<td>
|
||||
<input name="subpartition_count" type="number" min="2"
|
||||
value="<?php echo htmlspecialchars($partitionDetails['subpartition_count']); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
|
||||
<?php if ($partitionDetails['partition_count'] > 1): ?>
|
||||
<table id="partition_definition_table">
|
||||
<tr>
|
||||
<th><?php echo __('Partition'); ?></th>
|
||||
<th><?php echo __('Values'); ?></th>
|
||||
<?php if ($partitionDetails['subpartition_count'] > 1): ?>
|
||||
<th><?php echo __('Subpartition'); ?></th>
|
||||
<?php endif; ?>
|
||||
<th><?php echo __('Engine'); ?></th>
|
||||
<th><?php echo __('Comment'); ?></th>
|
||||
<th><?php echo __('Data directory'); ?></th>
|
||||
<th><?php echo __('Index directory'); ?></th>
|
||||
<th><?php echo __('Max rows'); ?></th>
|
||||
<th><?php echo __('Min rows'); ?></th>
|
||||
<th><?php echo __('Table space'); ?></th>
|
||||
<th><?php echo __('Node group'); ?></th>
|
||||
</tr>
|
||||
<?php $odd = true; ?>
|
||||
<?php foreach ($partitionDetails['partitions'] as $partition): ?>
|
||||
<?php $rowspan = ! empty($partition['subpartition_count']) ? ($partition['subpartition_count'] + 1) : 2; ?>
|
||||
<tr class="<?php echo ($odd ? 'odd' : 'even'); ?>">
|
||||
<th rowspan="<?php echo $rowspan; ?>" class="vmiddle">
|
||||
<?php echo htmlspecialchars($partition['name']); ?>
|
||||
</th>
|
||||
<td rowspan="<?php echo $rowspan; ?>" class="vmiddle">
|
||||
<select class="partition_value"
|
||||
name="<?php echo $partition['prefix']; ?>[value_type]"
|
||||
<?php echo (! $partition['value_enabled'] ? 'disabled' : ''); ?> >
|
||||
<?php foreach ($valueTypeOptions as $option): ?>
|
||||
<option value="<?php echo $option?>"
|
||||
<?php if ($partition['value_type'] == $option): ?>
|
||||
selected="selected"
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php echo $option; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<input type="text" class="partition_value"
|
||||
name="<?php echo $partition['prefix']; ?>[value]"
|
||||
value="<?php echo $partition['value']; ?>"
|
||||
<?php echo (! $partition['value_enabled'] ? 'disabled' : ''); ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if (isset($partition['subpartitions'])):
|
||||
$subpartitions = $partition['subpartitions'];
|
||||
else:
|
||||
$subpartitions = array($partition);
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php foreach ($subpartitions as $subpartition): ?>
|
||||
<tr class="<?php echo ($odd ? 'odd' : 'even'); ?>">
|
||||
<?php if (isset($partition['subpartitions'])): ?>
|
||||
<th class="vmiddle"><?php echo htmlspecialchars($subpartition['name']); ?></th>
|
||||
<?php endif; ?>
|
||||
<td>
|
||||
<?php echo PMA\libraries\StorageEngine::getHtmlSelect(
|
||||
$subpartition['prefix'] . '[engine]',
|
||||
null,
|
||||
$subpartition['engine'],
|
||||
false,
|
||||
true
|
||||
); ?>
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="<?php echo $subpartition['prefix']; ?>[comment]">
|
||||
<?php echo htmlspecialchars($subpartition['comment']); ?>
|
||||
</textarea>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="<?php echo $subpartition['prefix']; ?>[data_directory]"
|
||||
value="<?php echo htmlspecialchars($subpartition['data_directory']); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="<?php echo $subpartition['prefix']; ?>[index_directory]"
|
||||
value="<?php echo htmlspecialchars($subpartition['index_directory']); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="<?php echo $subpartition['prefix']; ?>[max_rows]"
|
||||
value="<?php echo htmlspecialchars($subpartition['max_rows']); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" min="0" name="<?php echo $subpartition['prefix']; ?>[min_rows]"
|
||||
value="<?php echo htmlspecialchars($subpartition['min_rows']); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" min="0" name="<?php echo $subpartition['prefix']; ?>[tablespace]"
|
||||
value="<?php echo htmlspecialchars($subpartition['tablespace']); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="<?php echo $subpartition['prefix']; ?>[node_group]"
|
||||
value="<?php echo htmlspecialchars($subpartition['node_group']); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php $odd = !$odd; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
@ -168,7 +168,7 @@ $rownum = 0; $odd_row = true; ?>
|
||||
<?php
|
||||
$partition_names = Partition::getPartitionNames($db, $table);
|
||||
// detect partitioning
|
||||
if (! is_null($partition_names[0])) {
|
||||
if (! empty($partition_names) && ! is_null($partition_names[0])) {
|
||||
|
||||
$partitions = Partition::getPartitions($db, $table);
|
||||
$firstPartition = $partitions[0];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user