Implement feature request #1414 - Allow specifying crontrolport

Set the value of controlport based on the value of controlhost
This commit is contained in:
Kasun Chathuranga 2013-05-02 21:36:05 +05:30
parent ace3369138
commit adb2e43f7d
7 changed files with 44 additions and 2 deletions

View File

@ -7,6 +7,7 @@ phpMyAdmin - ChangeLog
+ Break server_status.php functions into smaller functions
+ PMA_DBI functions in database_interface.lib.php renamed to be compliant with PEAR standards
+ [interface] Make warning about existing config directory clearer
+ rfe #1414 Allow specifying crontrolport
4.0.1.0 (not yet released)
- bug #3879 Import broken for CSV using LOAD DATA

View File

@ -41,6 +41,7 @@ $cfg['Servers'][$i]['AllowNoPassword'] = false;
/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

View File

@ -237,6 +237,15 @@ Server connection settings
Permits to use an alternate host to hold the configuration storage
data.
.. _controlport:
.. config:option:: $cfg['Servers'][$i]['controlport']
:type: string
:default: ``''``
Permits to use an alternate port to connect to the host that
holds the configuration storage.
.. _controluser:
.. config:option:: $cfg['Servers'][$i]['controluser']

View File

@ -931,12 +931,31 @@ if (! defined('PMA_MINIMUM_COMMON')) {
// scripts)
$controllink = false;
if ($cfg['Server']['controluser'] != '') {
if (! empty($cfg['Server']['controlhost'])) {
if (! empty($cfg['Server']['controlhost'])
|| ! empty($cfg['Server']['controlport'])
) {
$server_details = array();
if (! empty($cfg['Server']['controlhost'])) {
$server_details['host'] = $cfg['Server']['controlhost'];
} else {
$server_details['host'] = $cfg['Server']['host'];
}
if (! empty($cfg['Server']['controlport'])) {
$server_details['port'] = $cfg['Server']['controlport'];
} elseif ($server_details['host'] == $cfg['Server']['host']) {
// Evaluates to true when controlhost == host
// or controlhost is not defined (hence it defaults to host)
// In such case we can use the value of port.
$server_details['port'] = $cfg['Server']['port'];
}
// otherwise we leave the $server_details['port'] unset,
// allowing it to take default mysql port
$controllink = PMA_DBI_connect(
$cfg['Server']['controluser'],
$cfg['Server']['controlpass'],
true,
array('host' => $cfg['Server']['controlhost'])
$server_details
);
} else {
$controllink = PMA_DBI_connect(

View File

@ -167,6 +167,15 @@ $cfg['Servers'][$i]['compress'] = false;
*/
$cfg['Servers'][$i]['controlhost'] = '';
/**
* MySQL control port. This permits to use a port different than the
* main port, for the phpMyAdmin configuration storage. If left empty,
* $cfg['Servers'][$i]['port'] is used instead.
*
* @global string $cfg['Servers'][$i]['controlport']
*/
$cfg['Servers'][$i]['controlport'] = '';
/**
* MySQL control user settings (this user must have read-only
* access to the "mysql/user" and "mysql/db" tables). The controluser is also

View File

@ -386,6 +386,8 @@ $strConfigServers_controluser_desc = __('A special MySQL user configured with li
$strConfigServers_controluser_name = __('Control user');
$strConfigServers_controlhost_desc = __('An alternate host to hold the configuration storage; leave blank to use the already defined host');
$strConfigServers_controlhost_name = __('Control host');
$strConfigServers_controlport_desc = __('An alternate port to connect to the host that holds the configuration storage; leave blank to use the already defined port');
$strConfigServers_controlport_name = __('Control port');
$strConfigServers_CountTables_desc = __('Count tables when showing database list');
$strConfigServers_CountTables_name = __('Count tables');
$strConfigServers_designer_coords_desc = __('Leave blank for no Designer support, suggested: [kbd]pma__designer_coords[/kbd]');

View File

@ -65,6 +65,7 @@ $forms['Servers']['Server_config'] = array('Servers' => array(1 => array(
$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controlhost',
'controlport',
'controluser',
'controlpass',
'bookmarktable' => 'pma__bookmark',