/** * setup HTML for a given Storage Engine * * @return string */ function PMA_getHtmlForSpecifiedServerEngines() { /** * Displays details about a given Storage Engine */ $html = ''; $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']); $html .= '<h2>' . "\n" . PMA_Util::getImage('b_engine.png') . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" . ' ' . PMA_Util::showMySQLDocu($engine_plugin->getMysqlHelpPage()) . "\n" . '</h2>' . "\n\n"; $html .= '<p>' . "\n" . ' <em>' . "\n" . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n" . ' </em>' . "\n" . '</p>' . "\n\n"; $infoPages = $engine_plugin->getInfoPages(); if (!empty($infoPages) && is_array($infoPages)) { $html .= '<p>' . "\n" . ' <strong>[</strong>' . "\n"; if (empty($_REQUEST['page'])) { $html .= ' <strong>' . __('Variables') . '</strong>' . "\n"; } else { $html .= ' <a href="server_engines.php' . PMA_URL_getCommon(array('engine' => $_REQUEST['engine'])) . '">' . __('Variables') . '</a>' . "\n"; } foreach ($infoPages as $current => $label) { $html .= ' <strong>|</strong>' . "\n"; if (isset($_REQUEST['page']) && $_REQUEST['page'] == $current) { $html .= ' <strong>' . $label . '</strong>' . "\n"; } else { $html .= ' <a href="server_engines.php' . PMA_URL_getCommon(array('engine' => $_REQUEST['engine'], 'page' => $current)) . '">' . htmlspecialchars($label) . '</a>' . "\n"; } } unset($current, $label); $html .= ' <strong>]</strong>' . "\n" . '</p>' . "\n\n"; } unset($infoPages, $page_output); if (!empty($_REQUEST['page'])) { $page_output = $engine_plugin->getPage($_REQUEST['page']); } if (!empty($page_output)) { $html .= $page_output; } else { $html .= '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n" . '</p>' . "\n" . $engine_plugin->getHtmlVariables(); } return $html; }
/** * Get array of possible row formats * * @return array $possible_row_formats */ function PMA_getPossibleRowFormat() { // 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')); /** @var PMA_StorageEngine_Innodb $innodbEnginePlugin */ $innodbEnginePlugin = PMA_StorageEngine::getEngine('innodb'); $innodbPluginVersion = $innodbEnginePlugin->getInnodbPluginVersion(); if (!empty($innodbPluginVersion)) { $innodb_file_format = $innodbEnginePlugin->getInnodbFileFormat(); } else { $innodb_file_format = ''; } if ('Barracuda' == $innodb_file_format && $innodbEnginePlugin->supportsFilePerTable()) { $possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC'; $possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED'; } return $possible_row_formats; }
. ' </a></td>' . "\n" . ' <td>' . htmlspecialchars($details['Comment']) . '</td>' . "\n" . '</tr>' . "\n"; $odd_row = !$odd_row; } unset($odd_row, $engine, $details); echo '</tbody>' . "\n" . '</table>' . "\n"; } else { /** * Displays details about a given Storage Engine */ $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']); echo '<h2>' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"' .' width="16" height="16" alt="" />' : '') . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" . ' ' . PMA_showMySQLDocu('', $engine_plugin->getMysqlHelpPage()) . "\n" . '</h2>' . "\n\n"; echo '<p>' . "\n" . ' <em>' . "\n" . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n" . ' </em>' . "\n" . '</p>' . "\n\n"; $infoPages = $engine_plugin->getInfoPages(); if (!empty($infoPages) && is_array($infoPages)) { echo '<p>' . "\n"
if (isset($auto_increment) && strlen($auto_increment) > 0 && ($is_myisam_or_maria || $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('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')); $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); // 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
/** * Test for PMA_StorageEngine::getEngine * * @param string $expectedClass Class that should be selected * @param string $engineName Engine name * * @return void * * @dataProvider providerGetEngine */ public function testGetEngine($expectedClass, $engineName) { $this->assertInstanceOf($expectedClass, PMA_StorageEngine::getEngine($engineName)); }
/** * Test for PMA_getHtmlForSpecifiedServerEngines * * @return void */ public function testPMAGetHtmlForSpecifiedServerEngines() { $_REQUEST['engine'] = "pbxt"; $_REQUEST['page'] = "page"; //Mock DBI $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock(); $GLOBALS['dbi'] = $dbi; //test PMA_getHtmlForSpecifiedServerEngines $html = PMA_getHtmlForSpecifiedServerEngines(); $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']); //validate 1: Engine title $this->assertContains(htmlspecialchars($engine_plugin->getTitle()), $html); //validate 2: Engine Mysql Help Page $this->assertContains(PMA_Util::showMySQLDocu($engine_plugin->getMysqlHelpPage()), $html); //validate 3: Engine Comment $this->assertContains(htmlspecialchars($engine_plugin->getComment()), $html); //validate 4: Engine Info Pages $this->assertContains(__('Variables'), $html); $this->assertContains(PMA_URL_getCommon(array('engine' => $_REQUEST['engine'], 'page' => "Documentation")), $html); //validate 5: other items $this->assertContains(PMA_URL_getCommon(array('engine' => $_REQUEST['engine'])), $html); $this->assertContains($engine_plugin->getSupportInformationMessage(), $html); $this->assertContains($engine_plugin->getHtmlVariables(), $html); }
$common_url = './server_engines.php?' . PMA_generate_common_url() . '&engine='; foreach ($mysql_storage_engines as $engine => $details) { echo ' <tr' . ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED' ? ' class="disabled"' : '') . '>' . "\n" . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" . ' <a href="' . $common_url . $engine . '">' . "\n" . ' ' . htmlspecialchars($details['Engine']) . "\n" . ' </a>' . "\n" . ' </td>' . "\n"; if (PMA_MYSQL_INT_VERSION >= 40102) { echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" . ' ' . htmlspecialchars($details['Comment']) . "\n" . ' </td>' . "\n"; } echo ' </tr>' . "\n"; $useBgcolorOne = !$useBgcolorOne; } unset($useBgcolorOne, $common_url, $engine, $details); echo ' </tbody>' . "\n" . '</table>' . "\n"; } else { /** * Displays details about a given Storage Engine */ $engine_plugin = PMA_StorageEngine::getEngine($engine); echo '<h2>' . "\n" . ($cfg['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 'b_engine.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '') . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" . '</h2>' . "\n\n"; if (PMA_MYSQL_INT_VERSION >= 40102) { echo '<p>' . "\n" . ' <i>' . "\n" . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n" . ' </i>' . "\n" . '</p>' . "\n\n"; } $infoPages = $engine_plugin->getInfoPages(); if (!empty($infoPages) && is_array($infoPages)) { $common_url = './server_engines.php?' . PMA_generate_common_url() . '&engine=' . urlencode($engine); echo '<p>' . "\n" . ' <b>[</b>' . "\n"; if (empty($page)) { echo ' <b>' . $strServerTabVariables . '</b>' . "\n"; } else { echo ' <a href="' . $common_url . '">' . $strServerTabVariables . '</a>' . "\n"; } foreach ($infoPages as $current => $label) { echo ' <b>|</b>' . "\n";