/** * 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 = PMA_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_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_Util::getRadioFields('partition_operation', $choices, 'ANALYZE', false, true, 'floatleft'); $this_url_params = array_merge($url_params, array('sql_query' => 'ALTER TABLE ' . PMA_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; }