Skip to content

Commit

Permalink
Implement feature request #1414 - Allow specifying crontrolport
Browse files Browse the repository at this point in the history
Set the value of controlport based on the value of controlhost
  • Loading branch information
kasunchathuranga committed May 2, 2013
1 parent ace3369 commit adb2e43
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config.sample.inc.php
Expand Up @@ -41,6 +41,7 @@

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

Expand Down
9 changes: 9 additions & 0 deletions doc/config.rst
Expand Up @@ -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']
Expand Down
23 changes: 21 additions & 2 deletions libraries/common.inc.php
Expand Up @@ -931,12 +931,31 @@
// 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(
Expand Down
9 changes: 9 additions & 0 deletions libraries/config.default.php
Expand Up @@ -167,6 +167,15 @@
*/
$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
Expand Down
2 changes: 2 additions & 0 deletions libraries/config/messages.inc.php
Expand Up @@ -386,6 +386,8 @@
$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]');
Expand Down
1 change: 1 addition & 0 deletions libraries/config/setup.forms.php
Expand Up @@ -65,6 +65,7 @@
$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controlhost',
'controlport',
'controluser',
'controlpass',
'bookmarktable' => 'pma__bookmark',
Expand Down

0 comments on commit adb2e43

Please sign in to comment.