/** * Return HTML for a given Storage Engine * * @param StorageEngine $engine storage engine * * @return string */ private function _getHtmlForServerEngine($engine) { $pageOutput = !empty($_REQUEST['page']) ? $engine->getPage($_REQUEST['page']) : ''; /** * Displays details about a given Storage Engine */ return Template::get('server/engines/engine')->render(array('title' => $engine->getTitle(), 'helpPage' => $engine->getMysqlHelpPage(), 'comment' => $engine->getComment(), 'infoPages' => $engine->getInfoPages(), 'support' => $engine->getSupportInformationMessage(), 'variables' => $engine->getHtmlVariables(), 'pageOutput' => $pageOutput)); }
/** * Tests for _getHtmlForServerEngine() method * * @return void */ public function testGetHtmlForServerEngine() { $_REQUEST['engine'] = "Pbxt"; $_REQUEST['page'] = "page"; //Mock DBI $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock(); $GLOBALS['dbi'] = $dbi; $class = new ReflectionClass('\\PMA\\libraries\\controllers\\server\\ServerEnginesController'); $method = $class->getMethod('_getHtmlForServerEngine'); $method->setAccessible(true); $engine_plugin = StorageEngine::getEngine("Pbxt"); $ctrl = new ServerEnginesController(); $html = $method->invoke($ctrl, $engine_plugin); //validate 1: Engine title $this->assertContains(htmlspecialchars($engine_plugin->getTitle()), $html); //validate 2: Engine Mysql Help Page $this->assertContains(PMA\libraries\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(URL::getCommon(array('engine' => $_REQUEST['engine'], 'page' => "Documentation")), $html); //validate 5: other items $this->assertContains(URL::getCommon(array('engine' => $_REQUEST['engine'])), $html); $this->assertContains($engine_plugin->getSupportInformationMessage(), $html); $this->assertContains('There is no detailed status information available for this ' . 'storage engine.', $html); }
/** * setup HTML for a given Storage Engine * * @return string */ function PMA_getHtmlForSpecifiedServerEngines() { /** * Displays details about a given Storage Engine */ $html = ''; $engine_plugin = StorageEngine::getEngine($_REQUEST['engine']); $html .= '<h2>' . "\n" . PMA\libraries\Util::getImage('b_engine.png') . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" . ' ' . PMA\libraries\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('ARCHIVE' => array('COMPRESSED' => 'COMPRESSED'), '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 Innodb $innodbEnginePlugin */ $innodbEnginePlugin = 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; }
/** * Test for 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, StorageEngine::getEngine($engineName)); }
/** * Returns true if given engine name is supported/valid, otherwise false * * @param string $engine name of engine * * @static * @return boolean whether $engine is valid or not */ public static function isValid($engine) { if ($engine == "PBMS") { return true; } $storage_engines = StorageEngine::getStorageEngines(); return isset($storage_engines[$engine]); }