Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed May 23, 2013
2 parents e143ab7 + af177ac commit ba7d44e
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 101 deletions.
2 changes: 1 addition & 1 deletion libraries/gis/pma_gis_geometrycollection.php
Expand Up @@ -59,7 +59,7 @@ public function scaleRow($spatial)

// 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);

Expand Down
2 changes: 1 addition & 1 deletion libraries/navigation/NavigationTree.class.php
Expand Up @@ -928,7 +928,7 @@ private function _renderNode($node, $recursive = -1, $class = '')
$title = $node->getComment();
if ($title) {
$title = ' title="'
. htmlentities($title, ENT_QUOTES, 'UTF-8')
. htmlentities($title, ENT_QUOTES, 'UTF-8')
. '"';
}
} else {
Expand Down
8 changes: 4 additions & 4 deletions libraries/navigation/Nodes/Node.class.php
Expand Up @@ -362,7 +362,7 @@ public function getData($type, $pos, $searchClause = '')
// @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);
Expand Down Expand Up @@ -394,7 +394,7 @@ public function getPresence($type = '', $searchClause = '')
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 ";
Expand All @@ -412,11 +412,11 @@ public function getPresence($type = '', $searchClause = '')

/**
* 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 = '')
{
Expand Down
75 changes: 49 additions & 26 deletions libraries/replication.inc.php
Expand Up @@ -75,7 +75,8 @@
'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()
*/
Expand Down Expand Up @@ -110,29 +111,48 @@
}
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}_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}_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_Ignore_Table"} = explode(
",", $server_slave_replication[0]["Replicate_Wild_Ignore_Table"]
);
$replication_info[$type]['Wild_Ignore_Table']
= ${"server_{$type}_Wild_Ignore_Table"};
}
}
}
Expand All @@ -145,7 +165,7 @@
*
* @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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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(
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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();
Expand All @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions libraries/structure.lib.php
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
26 changes: 13 additions & 13 deletions server_engines.php
Expand Up @@ -35,19 +35,19 @@
*/
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;
}

/**
Expand Down
16 changes: 8 additions & 8 deletions server_replication.php
Expand Up @@ -79,7 +79,7 @@
$_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']
);

Expand All @@ -91,15 +91,15 @@
);
} 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';
$_SESSION['replication']['sr_action_info'] = __('Unable to read master log position. Possible privilege problem on master.');
} 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 {
Expand All @@ -113,11 +113,11 @@
}
} 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']
);
Expand All @@ -129,9 +129,9 @@
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");

}

Expand Down

0 comments on commit ba7d44e

Please sign in to comment.