Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-05-23 20:07:59 +02:00
commit ba7d44ea1f
13 changed files with 128 additions and 99 deletions

View File

@ -59,7 +59,7 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
// Trim to remove leading 'GEOMETRYCOLLECTION(' and trailing ')'
$goem_col = substr($spatial, 19, (strlen($spatial) - 20));
// Split the geometry collection object to get its constituents.
$sub_parts = $this->_explodeGeomCol($goem_col);

View File

@ -928,7 +928,7 @@ class PMA_NavigationTree
$title = $node->getComment();
if ($title) {
$title = ' title="'
. htmlentities($title, ENT_QUOTES, 'UTF-8')
. htmlentities($title, ENT_QUOTES, 'UTF-8')
. '"';
}
} else {

View File

@ -362,7 +362,7 @@ class Node
// @todo obey the DisableIS directive
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= $this->_getWhereClause($searchClause);
$query .= $this->_getWhereClause($searchClause);
$query .= "ORDER BY `SCHEMA_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
return PMA_DBI_fetchResult($query);
@ -394,7 +394,7 @@ class Node
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= $this->_getWhereClause($searchClause);
$query .= $this->_getWhereClause($searchClause);
$retval = (int)PMA_DBI_fetchValue($query);
} else {
$query = "SHOW DATABASES ";
@ -412,11 +412,11 @@ class Node
/**
* Returns the WHERE clause depending on the $searchClause parameter
* and the hide_db directive
* and the hide_db directive
*
* @param string $searchClause A string used to filter the results of the query
*
* @return string
* @return string
*/
private function _getWhereClause($searchClause = '')
{

View File

@ -75,7 +75,8 @@ $slave_variables = array(
'Seconds_Behind_Master',
);
/**
* define important variables, which need to be watched for correct running of replication in slave mode
* define important variables, which need to be watched for
* correct running of replication in slave mode
*
* @usedby PMA_replication_print_status_table()
*/
@ -110,29 +111,48 @@ foreach ($replication_types as $type) {
}
if (${"server_{$type}_status"}) {
if ($type == "master") {
${"server_{$type}_Do_DB"} = explode(",", $server_master_replication[0]["Binlog_Do_DB"]);
${"server_{$type}_Do_DB"} = explode(
",", $server_master_replication[0]["Binlog_Do_DB"]
);
$replication_info[$type]['Do_DB'] = ${"server_{$type}_Do_DB"};
${"server_{$type}_Ignore_DB"} = explode(",", $server_master_replication[0]["Binlog_Ignore_DB"]);
${"server_{$type}_Ignore_DB"} = explode(
",", $server_master_replication[0]["Binlog_Ignore_DB"]
);
$replication_info[$type]['Ignore_DB'] = ${"server_{$type}_Ignore_DB"};
} elseif ($type == "slave") {
${"server_{$type}_Do_DB"} = explode(",", $server_slave_replication[0]["Replicate_Do_DB"]);
${"server_{$type}_Do_DB"} = explode(
",", $server_slave_replication[0]["Replicate_Do_DB"]
);
$replication_info[$type]['Do_DB'] = ${"server_{$type}_Do_DB"};
${"server_{$type}_Ignore_DB"} = explode(",", $server_slave_replication[0]["Replicate_Ignore_DB"]);
${"server_{$type}_Ignore_DB"} = explode(
",", $server_slave_replication[0]["Replicate_Ignore_DB"]
);
$replication_info[$type]['Ignore_DB'] = ${"server_{$type}_Ignore_DB"};
${"server_{$type}_Do_Table"} = explode(",", $server_slave_replication[0]["Replicate_Do_Table"]);
${"server_{$type}_Do_Table"} = explode(
",", $server_slave_replication[0]["Replicate_Do_Table"]
);
$replication_info[$type]['Do_Table'] = ${"server_{$type}_Do_Table"};
${"server_{$type}_Ignore_Table"} = explode(",", $server_slave_replication[0]["Replicate_Ignore_Table"]);
$replication_info[$type]['Ignore_Table'] = ${"server_{$type}_Ignore_Table"};
${"server_{$type}_Ignore_Table"} = explode(
",", $server_slave_replication[0]["Replicate_Ignore_Table"]
);
$replication_info[$type]['Ignore_Table']
= ${"server_{$type}_Ignore_Table"};
${"server_{$type}_Wild_Do_Table"} = explode(",", $server_slave_replication[0]["Replicate_Wild_Do_Table"]);
$replication_info[$type]['Wild_Do_Table'] = ${"server_{$type}_Wild_Do_Table"};
${"server_{$type}_Wild_Do_Table"} = explode(
",", $server_slave_replication[0]["Replicate_Wild_Do_Table"]
);
$replication_info[$type]['Wild_Do_Table']
= ${"server_{$type}_Wild_Do_Table"};
${"server_{$type}_Wild_Ignore_Table"} = explode(",", $server_slave_replication[0]["Replicate_Wild_Ignore_Table"]);
$replication_info[$type]['Wild_Ignore_Table'] = ${"server_{$type}_Wild_Ignore_Table"};
${"server_{$type}_Wild_Ignore_Table"} = explode(
",", $server_slave_replication[0]["Replicate_Wild_Ignore_Table"]
);
$replication_info[$type]['Wild_Ignore_Table']
= ${"server_{$type}_Wild_Ignore_Table"};
}
}
}
@ -145,7 +165,7 @@ foreach ($replication_types as $type) {
*
* @return $string the extracted part
*/
function PMA_extract_db_or_table($string, $what = 'db')
function PMA_extractDbOrTable($string, $what = 'db')
{
$list = explode(".", $string);
if ('db' == $what) {
@ -159,13 +179,15 @@ function PMA_extract_db_or_table($string, $what = 'db')
* Configures replication slave
*
* @param string $action possible values: START or STOP
* @param string $control default: null, possible values: SQL_THREAD or IO_THREAD or null.
* If it is set to null, it controls both SQL_THREAD and IO_THREAD
* @param string $control default: null,
* possible values: SQL_THREAD or IO_THREAD or null.
* If it is set to null, it controls both
* SQL_THREAD and IO_THREAD
* @param mixed $link mysql link
*
* @return mixed output of PMA_DBI_tryQuery
*/
function PMA_replication_slave_control($action, $control = null, $link = null)
function PMA_Replication_Slave_control($action, $control = null, $link = null)
{
$action = strtoupper($action);
$control = strtoupper($control);
@ -195,11 +217,11 @@ function PMA_replication_slave_control($action, $control = null, $link = null)
*
* @return output of CHANGE MASTER mysql command
*/
function PMA_replication_slave_change_master($user, $password, $host, $port,
function PMA_Replication_Slave_changeMaster($user, $password, $host, $port,
$pos, $stop = true, $start = true, $link = null
) {
if ($stop) {
PMA_replication_slave_control("STOP", null, $link);
PMA_Replication_Slave_control("STOP", null, $link);
}
$out = PMA_DBI_tryQuery(
@ -213,7 +235,7 @@ function PMA_replication_slave_change_master($user, $password, $host, $port,
);
if ($start) {
PMA_replication_slave_control("START", null, $link);
PMA_Replication_Slave_control("START", null, $link);
}
return $out;
@ -230,8 +252,9 @@ function PMA_replication_slave_change_master($user, $password, $host, $port,
*
* @return mixed $link mysql link on success
*/
function PMA_replication_connect_to_master($user, $password, $host = null, $port = null, $socket = null)
{
function PMA_Replication_connectToMaster(
$user, $password, $host = null, $port = null, $socket = null
) {
$server = array();
$server["host"] = $host;
$server["port"] = $port;
@ -247,9 +270,9 @@ function PMA_replication_connect_to_master($user, $password, $host = null, $port
* @param mixed $link mysql link
*
* @return array an array containing File and Position in MySQL replication
* on master server, useful for PMA_replication_slave_change_master
* on master server, useful for PMA_Replication_Slave_changeMaster
*/
function PMA_replication_slave_bin_log_master($link = null)
function PMA_Replication_Slave_binLogMaster($link = null)
{
$data = PMA_DBI_fetchResult('SHOW MASTER STATUS', null, null, $link);
$output = array();
@ -269,7 +292,7 @@ function PMA_replication_slave_bin_log_master($link = null)
* @return array array of replicated databases
*/
function PMA_replication_master_replicated_dbs($link = null)
function PMA_Replication_Master_getReplicatedDbs($link = null)
{
// let's find out, which databases are replicated
$data = PMA_DBI_fetchResult('SHOW MASTER STATUS', null, null, $link);

View File

@ -961,8 +961,8 @@ function PMA_getServerSlaveStatus($server_slave_status, $truename)
$do = true;
}
foreach ($server_slave_Wild_Do_Table as $db_table) {
$table_part = PMA_extract_db_or_table($db_table, 'table');
if (($GLOBALS['db'] == PMA_extract_db_or_table($db_table, 'db'))
$table_part = PMA_extractDbOrTable($db_table, 'table');
if (($GLOBALS['db'] == PMA_extractDbOrTable($db_table, 'db'))
&& (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))
) {
$do = true;
@ -975,8 +975,8 @@ function PMA_getServerSlaveStatus($server_slave_status, $truename)
$ignored = true;
}
foreach ($server_slave_Wild_Ignore_Table as $db_table) {
$table_part = PMA_extract_db_or_table($db_table, 'table');
if (($db == PMA_extract_db_or_table($db_table))
$table_part = PMA_extractDbOrTable($db_table, 'table');
if (($db == PMA_extractDbOrTable($db_table))
&& (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))
) {
$ignored = true;
@ -2508,14 +2508,14 @@ function PMA_moveColumns($db, $table)
/**
* Get columns with unique index
*
*
* @param string $db database name
* @param string $table tablename
*
*
* @return array $columns_with_unique_index An array of columns with unique index,
* with $column name as the array key
*/
function PMA_getColumnsWithUniqueIndex($db ,$table)
function PMA_getColumnsWithUniqueIndex($db ,$table)
{
$columns_with_unique_index = array();
foreach (PMA_Index::getFromTable($table, $db) as $index) {
@ -2531,22 +2531,22 @@ function PMA_getColumnsWithUniqueIndex($db ,$table)
/**
* Check column names for MySQL reserved words
*
*
* @param string $db database name
* @param string $table tablename
*
*
* @return array $messages array of PMA_Messages
*/
function PMA_getReservedWordColumnNameMessages($db ,$table)
function PMA_getReservedWordColumnNameMessages($db ,$table)
{
$messages = array();
if ($GLOBALS['cfg']['ReservedWordDisableWarning'] === false) {
$pma_table = new PMA_Table($table, $db);
$columns = $pma_table->getReservedColumnNames();
$columns = $pma_table->getReservedColumnNames();
if (!empty($columns)) {
foreach ($columns as $column) {
$msg = PMA_message::notice(
__('The column name \'%s\' is a MySQL reserved keyword.')
__('The column name \'%s\' is a MySQL reserved keyword.')
);
$msg->addParam($column);
$messages[] = $msg;

View File

@ -35,19 +35,19 @@ exit;
*/
function PMA_getServerEnginesHtml()
{
/**
* Did the user request information about a certain storage engine?
*/
$html = '';
if (empty($_REQUEST['engine'])
|| ! PMA_StorageEngine::isValid($_REQUEST['engine'])
) {
$html .= PMA_getAllServerEnginesHtml();
} else {
$html .= PMA_getSpecifiedServerEnginesHtml();
}
return $html;
/**
* Did the user request information about a certain storage engine?
*/
$html = '';
if (empty($_REQUEST['engine'])
|| ! PMA_StorageEngine::isValid($_REQUEST['engine'])
) {
$html .= PMA_getAllServerEnginesHtml();
} else {
$html .= PMA_getSpecifiedServerEnginesHtml();
}
return $html;
}
/**

View File

@ -79,7 +79,7 @@ if (isset($GLOBALS['sr_take_action'])) {
$_SESSION['replication']['sr_action_info'] = __('Unknown error');
// Attempt to connect to the new master server
$link_to_master = PMA_replication_connect_to_master(
$link_to_master = PMA_Replication_connectToMaster(
$sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port']
);
@ -91,7 +91,7 @@ if (isset($GLOBALS['sr_take_action'])) {
);
} else {
// Read the current master position
$position = PMA_replication_slave_bin_log_master($link_to_master);
$position = PMA_Replication_Slave_binLogMaster($link_to_master);
if (empty($position)) {
$_SESSION['replication']['sr_action_status'] = 'error';
@ -99,7 +99,7 @@ if (isset($GLOBALS['sr_take_action'])) {
} else {
$_SESSION['replication']['m_correct'] = true;
if (! PMA_replication_slave_change_master($sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port'], $position, true, false)) {
if (! PMA_Replication_Slave_changeMaster($sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port'], $position, true, false)) {
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info'] = __('Unable to change master');
} else {
@ -113,11 +113,11 @@ if (isset($GLOBALS['sr_take_action'])) {
}
} elseif (isset($GLOBALS['sr_slave_server_control'])) {
if ($GLOBALS['sr_slave_action'] == 'reset') {
PMA_replication_slave_control("STOP");
PMA_Replication_Slave_control("STOP");
PMA_DBI_tryQuery("RESET SLAVE;");
PMA_replication_slave_control("START");
PMA_Replication_Slave_control("START");
} else {
PMA_replication_slave_control(
PMA_Replication_Slave_control(
$GLOBALS['sr_slave_action'],
$GLOBALS['sr_slave_control_parm']
);
@ -129,9 +129,9 @@ if (isset($GLOBALS['sr_take_action'])) {
if (isset($GLOBALS['sr_skip_errors_count'])) {
$count = $GLOBALS['sr_skip_errors_count'] * 1;
}
PMA_replication_slave_control("STOP");
PMA_Replication_Slave_control("STOP");
PMA_DBI_tryQuery("SET GLOBAL SQL_SLAVE_SKIP_COUNTER = ".$count.";");
PMA_replication_slave_control("START");
PMA_Replication_Slave_control("START");
}

View File

@ -765,26 +765,26 @@ function PMA_getPopContentHtml()
*/
function PMA_getClientSideDataAndLinksHtml($ServerStatusData)
{
/**
* Define some data needed on the client side
/**
* Define some data needed on the client side
*/
$input = '<input type="hidden" name="%s" value="%s" />';
$form = '<form id="js_data" class="hide">';
$form .= sprintf($input, 'server_time', microtime(true) * 1000);
$form .= sprintf($input, 'server_os', PHP_OS);
$form .= sprintf($input, 'is_superuser', PMA_isSuperuser());
$form .= sprintf($input, 'server_db_isLocal', $ServerStatusData->db_isLocal);
$form .= '</form>';
/**
* Define some links used on client side
*/
$links = '<div id="profiling_docu" class="hide">';
$links .= PMA_Util::showMySQLDocu('general-thread-states', 'general-thread-states');
$links .= '</div>';
$links .= '<div id="explain_docu" class="hide">';
$links .= PMA_Util::showMySQLDocu('explain-output', 'explain-output');
$links .= '</div>';
return $form . $links;
$input = '<input type="hidden" name="%s" value="%s" />';
$form = '<form id="js_data" class="hide">';
$form .= sprintf($input, 'server_time', microtime(true) * 1000);
$form .= sprintf($input, 'server_os', PHP_OS);
$form .= sprintf($input, 'is_superuser', PMA_isSuperuser());
$form .= sprintf($input, 'server_db_isLocal', $ServerStatusData->db_isLocal);
$form .= '</form>';
/**
* Define some links used on client side
*/
$links = '<div id="profiling_docu" class="hide">';
$links .= PMA_Util::showMySQLDocu('general-thread-states', 'general-thread-states');
$links .= '</div>';
$links .= '<div id="explain_docu" class="hide">';
$links .= PMA_Util::showMySQLDocu('explain-output', 'explain-output');
$links .= '</div>';
return $form . $links;
}
?>

18
sql.php
View File

@ -127,7 +127,9 @@ if (isset($_REQUEST['get_relational_values'])
} else {
$curr_value = $_REQUEST['curr_value'];
}
$dropdown = PMA_getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_value);
$dropdown = PMA_getHtmlForRelationalColumnDropdown(
$db, $table, $column, $curr_value
);
$response = PMA_Response::getInstance();
$response->addJSON('dropdown', $dropdown);
exit;
@ -543,7 +545,7 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
} while (PMA_DBI_nextResult());
$is_procedure = false;
// Since multiple query execution is anyway handled,
// ignore the WHERE clause of the first sql statement
// which might contain a phrase like 'call '
@ -870,8 +872,8 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
$query__type = PMA_DisplayResults::QUERY_TYPE_SELECT;
if ($analyzed_sql[0]['querytype'] == $query__type) {
$createViewHTML = $displayResultsObject->getCreateViewQueryResultOp(
$analyzed_sql
);
$analyzed_sql
);
$response->addHTML($createViewHTML.'<br />');
}
@ -1130,7 +1132,9 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
$printview, $url_query, $editable
);
$html_output .= $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql);
$html_output .= $displayResultsObject->getTable(
$result, $disp_mode, $analyzed_sql
);
PMA_DBI_freeResult($result);
}
@ -1143,7 +1147,9 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
foreach ($selected as $idx => $tbl_name) {
$check = PMA_Index::findDuplicates($tbl_name, $db);
if (! empty($check)) {
$html_output .= sprintf(__('Problems with indexes of table `%s`'), $tbl_name);
$html_output .= sprintf(
__('Problems with indexes of table `%s`'), $tbl_name
);
$html_output .= $check;
}
}

View File

@ -50,8 +50,8 @@ if (isset($_REQUEST['do_save_data'])) {
//avoid an incorrect calling of PMA_updateColumns() via
//tbl_structure.php below
unset($_REQUEST['do_save_data']);
require_once 'libraries/create_addfield.lib.php';
include_once 'libraries/create_addfield.lib.php';
// get column addition statements
$sql_statement = PMA_getColumnCreationStatements(false);

View File

@ -67,11 +67,11 @@ if (!PMA_DBI_selectDb($db)) {
*/
if (isset($_REQUEST['do_save_data'])) {
$sql_query = '';
require_once 'libraries/create_addfield.lib.php';
include_once 'libraries/create_addfield.lib.php';
// get column addition statements
$sql_statement = PMA_getColumnCreationStatements(true);
// Builds the 'create table' statement
$sql_query = 'CREATE TABLE ' . PMA_Util::backquote($db) . '.'
. PMA_Util::backquote($table) . ' (' . $sql_statement . ')';

View File

@ -30,14 +30,14 @@ $scripts->addFile('indexes.js');
*/
if (isset($_REQUEST['move_columns'])
&& is_array($_REQUEST['move_columns'])
&& $response->isAjax()
&& $response->isAjax()
) {
PMA_moveColumns($db, $table);
exit;
}
/**
* A click on Change has been made for one column
* A click on Change has been made for one column
*/
if (isset($_REQUEST['change_column'])) {
PMA_displayHtmlForColumnChange($db, $table, null, 'tbl_structure.php');
@ -140,7 +140,7 @@ $url_params['goto'] = 'tbl_structure.php';
$url_params['back'] = 'tbl_structure.php';
// Check column names for MySQL reserved words
$reserved_word_column_messages = PMA_getReservedWordColumnNameMessages($db ,$table);
$reserved_word_column_messages = PMA_getReservedWordColumnNameMessages($db, $table);
$response->addHTML($reserved_word_column_messages);
/**
@ -159,7 +159,7 @@ require_once 'libraries/Index.class.php';
// @todo should be: $server->db($db)->table($table)->primary()
$primary = PMA_Index::getPrimary($table, $db);
$columns_with_unique_index = PMA_getColumnsWithUniqueIndex($db ,$table);
$columns_with_unique_index = PMA_getColumnsWithUniqueIndex($db, $table);
// 3. Get fields
$fields = (array) PMA_DBI_getColumns($db, $table, null, true);

View File

@ -94,7 +94,7 @@ class PMA_Util_Test extends PHPUnit_Framework_TestCase
{
$this->assertContains(
'<select class="pageselector ajax" name="pma" >',
PMA_Util::pageselector("pma",3)
PMA_Util::pageselector("pma", 3)
);
}
}