상속: extends PMA\libraries\SubPartition
/**
 * Get HTML snippet for partition maintenance
 *
 * @param array $partition_names array of partition names for a specific db/table
 * @param array $url_params      url parameters
 *
 * @return string $html_output
 */
function PMA_getHtmlForPartitionMaintenance($partition_names, $url_params)
{
    $choices = array('ANALYZE' => __('Analyze'), 'CHECK' => __('Check'), 'OPTIMIZE' => __('Optimize'), 'REBUILD' => __('Rebuild'), 'REPAIR' => __('Repair'), 'TRUNCATE' => __('Truncate'));
    $partition_method = Partition::getPartitionMethod($GLOBALS['db'], $GLOBALS['table']);
    // add COALESCE or DROP option to choices array depeding on Partition method
    if ($partition_method == 'RANGE' || $partition_method == 'LIST') {
        $choices['DROP'] = __('Drop');
    } else {
        $choices['COALESCE'] = __('Coalesce');
    }
    $html_output = '<div class="operations_half_width">' . '<form id="partitionsForm" class="ajax" ' . 'method="post" action="tbl_operations.php" >' . PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<fieldset>' . '<legend>' . __('Partition maintenance') . PMA\libraries\Util::showMySQLDocu('partitioning_maintenance') . '</legend>';
    $html_select = '<select id="partition_name" name="partition_name[]"' . ' multiple="multiple" required="required">' . "\n";
    $first = true;
    foreach ($partition_names as $one_partition) {
        $one_partition = htmlspecialchars($one_partition);
        $html_select .= '<option value="' . $one_partition . '"';
        if ($first) {
            $html_select .= ' selected="selected"';
            $first = false;
        }
        $html_select .= '>' . $one_partition . '</option>' . "\n";
    }
    $html_select .= '</select>' . "\n";
    $html_output .= sprintf(__('Partition %s'), $html_select);
    $html_output .= '<div class="clearfloat" />';
    $html_output .= PMA\libraries\Util::getRadioFields('partition_operation', $choices, 'ANALYZE', false, true, 'floatleft');
    $this_url_params = array_merge($url_params, array('sql_query' => 'ALTER TABLE ' . PMA\libraries\Util::backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;'));
    $html_output .= '<div class="clearfloat" /><br />';
    $html_output .= '<a href="sql.php' . PMA_URL_getCommon($this_url_params) . '">' . __('Remove partitioning') . '</a>';
    $html_output .= '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="hidden" name="submit_partition" value="1">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>';
    return $html_output;
}
예제 #2
0
$response->addHTML(PMA_getHtmlForTableMaintenance($is_myisam_or_aria, $is_innodb, $is_berkeleydb, $url_params));
if (!(isset($db_is_system_schema) && $db_is_system_schema)) {
    $truncate_table_url_params = array();
    $drop_table_url_params = array();
    if (!$tbl_is_view && !(isset($db_is_system_schema) && $db_is_system_schema)) {
        $this_sql_query = 'TRUNCATE TABLE ' . PMA\libraries\Util::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_system_schema) && $db_is_system_schema)) {
        $this_sql_query = 'DROP TABLE ' . PMA\libraries\Util::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' => $GLOBALS['table']));
    }
    $response->addHTML(PMA_getHtmlForDeleteDataOrTable($truncate_table_url_params, $drop_table_url_params));
}
if (Partition::havePartitioning()) {
    $partition_names = Partition::getPartitionNames($db, $table);
    // show the Partition maintenance section only if we detect a partition
    if (!is_null($partition_names[0])) {
        $response->addHTML(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
// tables for which the relations are defined in pmadb
// so I assume that if the current table is InnoDB, I don't display
// this choice (InnoDB maintains integrity by itself)
if ($cfgRelation['relwork'] && !$is_innodb) {
    $GLOBALS['dbi']->selectDb($GLOBALS['db']);