Skip to content

Commit

Permalink
More server level Drizzle functions removed
Browse files Browse the repository at this point in the history
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
  • Loading branch information
madhuracj committed Sep 9, 2015
1 parent d16bc93 commit 8dcb93c
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 100 deletions.
10 changes: 3 additions & 7 deletions index.php
Expand Up @@ -180,7 +180,7 @@
/**
* Displays the mysql server related links
*/
if ($server > 0 && ! PMA_DRIZZLE) {
if ($server > 0) {
include_once 'libraries/check_user_privileges.lib.php';

// Logout for advanced authentication
Expand Down Expand Up @@ -220,7 +220,7 @@
)
. ' </form>' . "\n"
. ' </li>' . "\n";
} // end of if ($server > 0 && !PMA_DRIZZLE)
} // end of if ($server > 0)
echo '</ul>';
echo '</div>';
}
Expand Down Expand Up @@ -305,10 +305,7 @@
echo ' <li id="li_select_mysql_charset">';
echo ' ' . __('Server charset:') . ' '
. ' <span lang="en" dir="ltr">';
if (! PMA_DRIZZLE) {
echo ' '
. $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
}
echo ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
echo ' (' . $mysql_charset_map['utf-8'] . ')'
. ' </span>'
. ' </li>'
Expand Down Expand Up @@ -600,7 +597,6 @@
* numbering.
*/
if (isset($GLOBALS['dbi'])
&& !PMA_DRIZZLE
&& $cfg['ServerLibraryDifference_DisableWarning'] == false
) {
/** @var PMA_String $pmaString */
Expand Down
10 changes: 1 addition & 9 deletions libraries/Advisor.class.php
Expand Up @@ -35,15 +35,7 @@ public function run()
$GLOBALS['dbi']->fetchResult('SHOW GLOBAL STATUS', 0, 1),
$GLOBALS['dbi']->fetchResult('SHOW GLOBAL VARIABLES', 0, 1)
);
if (PMA_DRIZZLE) {
$this->variables = array_merge(
$this->variables,
$GLOBALS['dbi']->fetchResult(
"SELECT concat('Com_', variable_name), variable_value "
. "FROM data_dictionary.GLOBAL_STATEMENTS", 0, 1
)
);
}

// Add total memory to variables as well
include_once 'libraries/sysinfo.lib.php';
$sysinfo = PMA_getSysInfo();
Expand Down
52 changes: 25 additions & 27 deletions libraries/Config.class.php
Expand Up @@ -927,35 +927,33 @@ public function load($source = null)
*/
private function _saveConnectionCollation($config_data)
{
if (!PMA_DRIZZLE) {
// just to shorten the lines
$collation = 'collation_connection';
if (isset($GLOBALS[$collation])
&& (isset($_COOKIE['pma_collation_connection'])
|| isset($_POST[$collation]))
// just to shorten the lines
$collation = 'collation_connection';
if (isset($GLOBALS[$collation])
&& (isset($_COOKIE['pma_collation_connection'])
|| isset($_POST[$collation]))
) {
if ((! isset($config_data[$collation])
&& $GLOBALS[$collation] != 'utf8_general_ci')
|| isset($config_data[$collation])
&& $GLOBALS[$collation] != $config_data[$collation]
) {
if ((! isset($config_data[$collation])
&& $GLOBALS[$collation] != 'utf8_general_ci')
|| isset($config_data[$collation])
&& $GLOBALS[$collation] != $config_data[$collation]
) {
$this->setUserValue(
null,
$collation,
$GLOBALS[$collation],
'utf8_general_ci'
);
}
} else {
// read collation from settings
if (isset($config_data[$collation])) {
$this->setUserValue(
null,
$collation,
$GLOBALS[$collation],
'utf8_general_ci'
);
}
} else {
// read collation from settings
if (isset($config_data[$collation])) {
$GLOBALS[$collation]
= $config_data[$collation];
$this->setCookie(
'pma_collation_connection',
$GLOBALS[$collation]
= $config_data[$collation];
$this->setCookie(
'pma_collation_connection',
$GLOBALS[$collation]
);
}
);
}
}
}
Expand Down
43 changes: 14 additions & 29 deletions libraries/StorageEngine.class.php
Expand Up @@ -94,35 +94,20 @@ static public function getStorageEngines()
static $storage_engines = null;

if (null == $storage_engines) {
if (PMA_DRIZZLE) {
$sql = "SELECT
p.plugin_name AS Engine,
(CASE
WHEN p.plugin_name = @@storage_engine THEN 'DEFAULT'
WHEN p.is_active THEN 'YES'
ELSE 'DISABLED' END) AS Support,
m.module_description AS Comment
FROM data_dictionary.plugins p
JOIN data_dictionary.modules m USING (module_name)
WHERE p.plugin_type = 'StorageEngine'
AND p.plugin_name NOT IN ('FunctionEngine', 'schema')";
$storage_engines = $GLOBALS['dbi']->fetchResult($sql, 'Engine');
} else {
$storage_engines
= $GLOBALS['dbi']->fetchResult('SHOW STORAGE ENGINES', 'Engine');
if (PMA_MYSQL_INT_VERSION >= 50708) {
$disabled = PMA_Util::cacheGet(
'disabled_storage_engines',
function() {
return $GLOBALS['dbi']->fetchValue(
'SELECT @@disabled_storage_engines'
);
}
);
foreach (explode(",", $disabled) as $engine) {
if (isset($storage_engines[$engine])) {
$storage_engines[$engine]['Support'] = 'DISABLED';
}
$storage_engines
= $GLOBALS['dbi']->fetchResult('SHOW STORAGE ENGINES', 'Engine');
if (PMA_MYSQL_INT_VERSION >= 50708) {
$disabled = PMA_Util::cacheGet(
'disabled_storage_engines',
function() {
return $GLOBALS['dbi']->fetchValue(
'SELECT @@disabled_storage_engines'
);
}
);
foreach (explode(",", $disabled) as $engine) {
if (isset($storage_engines[$engine])) {
$storage_engines[$engine]['Support'] = 'DISABLED';
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/build_html_for_db.lib.php
Expand Up @@ -163,7 +163,7 @@ function PMA_buildHtmlForDb(
}
}

if ($is_superuser && !PMA_DRIZZLE) {
if ($is_superuser) {
$out .= '<td class="tool">'
. '<a onclick="'
. 'PMA_commonActions.setDb(\''
Expand Down
34 changes: 11 additions & 23 deletions libraries/check_user_privileges.lib.php
Expand Up @@ -376,31 +376,19 @@ function PMA_analyseShowGrant()
PMA_Util::cacheSet('dbs_to_test', $GLOBALS['dbs_to_test']);
} // end function

if (!PMA_DRIZZLE) {
$user = $GLOBALS['dbi']->fetchValue("SELECT CURRENT_USER();");
if ($user == '@') { // MySQL is started with --skip-grant-tables
$GLOBALS['is_create_db_priv'] = true;
$GLOBALS['is_reload_priv'] = true;
$GLOBALS['db_to_create'] = '';
$GLOBALS['dbs_where_create_table_allowed'] = array('*');
$GLOBALS['dbs_to_test'] = false;
} else {
PMA_analyseShowGrant();
}

// Check if privileges to 'mysql'.col_privs, 'mysql'.db,
// 'mysql'.table_privs, 'mysql'.proc_privs and privileges for
// flushing the privileges are available
PMA_checkRequiredPrivilegesForFlushing();
PMA_checkRequiredPrivilgesForAdjust();

} else {
// todo: for simple_user_policy only database with user's login can be created
// (unless logged in as root)
$GLOBALS['is_create_db_priv'] = $GLOBALS['is_superuser'];
$GLOBALS['is_reload_priv'] = false;
$user = $GLOBALS['dbi']->fetchValue("SELECT CURRENT_USER();");
if ($user == '@') { // MySQL is started with --skip-grant-tables
$GLOBALS['is_create_db_priv'] = true;
$GLOBALS['is_reload_priv'] = true;
$GLOBALS['db_to_create'] = '';
$GLOBALS['dbs_where_create_table_allowed'] = array('*');
$GLOBALS['dbs_to_test'] = false;
} else {
PMA_analyseShowGrant();
}

// Check if privileges to 'mysql'.col_privs, 'mysql'.db,
// 'mysql'.table_privs, 'mysql'.proc_privs and privileges for
// flushing the privileges are available
PMA_checkRequiredPrivilegesForFlushing();
PMA_checkRequiredPrivilgesForAdjust();
6 changes: 2 additions & 4 deletions libraries/server_status_monitor.lib.php
Expand Up @@ -254,10 +254,8 @@ function PMA_getHtmlForTabLinks()
$retval .= '<a href="#settingsPopup" class="popupLink">';
$retval .= PMA_Util::getImage('s_cog.png') . __('Settings');
$retval .= '</a>';
if (! PMA_DRIZZLE) {
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
}
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
$retval .= '<a href="#endChartEditMode" style="display:none;">';
$retval .= PMA_Util::getImage('s_okay.png');
$retval .= __('Done dragging (rearranging) charts');
Expand Down

0 comments on commit 8dcb93c

Please sign in to comment.