Use $cfg['Servers'][1] from config.default.php as defaults for settings in config.inc.php (bug #1330847).

This commit is contained in:
Michal Čihař
2005-11-02 19:46:47 +00:00
parent 52a5f8156e
commit 77e68e5a39
4 changed files with 51 additions and 76 deletions

View File

@@ -7,6 +7,9 @@ $Source$
2005-11-02 Michal Čihař <michal@cihar.com> 2005-11-02 Michal Čihař <michal@cihar.com>
* config.default.php: This is not a configuration file. * config.default.php: This is not a configuration file.
* config.default.php, Documentation.html, libraries/common.lib.php: Use
$cfg['Servers'][1] from config.default.php as defaults for settings in
config.inc.php (bug #1330847).
2005-11-02 Sebastian Mendel <cybot_tm@users.sourceforge.net> 2005-11-02 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/dbg/setup.php: * libraries/dbg/setup.php:

View File

@@ -442,8 +442,10 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON &lt;pma_db&gt;.* TO 'pma'@'localhost';
<tt>$cfg['Servers'][$i]['host']</tt> contains the hostname of the first <tt>$cfg['Servers'][$i]['host']</tt> contains the hostname of the first
server, the second <tt>$cfg['Servers'][$i]['host']</tt> the hostname of server, the second <tt>$cfg['Servers'][$i]['host']</tt> the hostname of
the second server, etc. the second server, etc.
If you have only one server to administer, simply leave free the In configuration defaults file, there is just one section for server
hostname of the other $cfg['Server']-entries. definition, howerver you can have as much as you need, just copy that
block or needed parts (you don't have to define all settings, just
those you need to change).
<br /><br /> <br /><br />
</dd> </dd>

View File

@@ -48,8 +48,11 @@ $cfg['blowfish_secret'] = '';
* Server(s) configuration * Server(s) configuration
*/ */
$i = 0; $i = 0;
// The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0]. // The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use
// You can disable a server config entry by setting host to ''. // $cfg['Servers'][0]. You can disable a server config entry by setting host
// to ''. If you want more than one server, just copy following section
// (including $i incrementation) serveral times. There is no need to define
// full server array, just define values you need to change.
$i++; $i++;
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
@@ -108,84 +111,12 @@ $cfg['Servers'][$i]['AllowDeny']['order'] // Host authentication order
$cfg['Servers'][$i]['AllowDeny']['rules'] // Host authentication rules, leave blank for defaults $cfg['Servers'][$i]['AllowDeny']['rules'] // Host authentication rules, leave blank for defaults
= array(); = array();
/**
* If you are configuring for only one server, stop here. You can jump to the next
* section called "Other core phpMyAdmin settings."
* The following section allows you to add a second server to this installation.
*/
$i++;
$cfg['Servers'][$i]['host'] = '';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = '';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['only_db'] = '';
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['pmadb'] = ''; // 'phpmyadmin' - see scripts/create_tables.sql
$cfg['Servers'][$i]['bookmarktable'] = ''; // 'pma_bookmark'
$cfg['Servers'][$i]['relation'] = ''; // 'pma_relation'
$cfg['Servers'][$i]['table_info'] = ''; // 'pma_table_info'
$cfg['Servers'][$i]['table_coords'] = ''; // 'pma_table_coords'
$cfg['Servers'][$i]['pdf_pages'] = ''; // 'pma_pdf_pages'
$cfg['Servers'][$i]['column_info'] = ''; // 'pma_column_info'
$cfg['Servers'][$i]['history'] = ''; // 'pma_history'
$cfg['Servers'][$i]['verbose_check'] = TRUE;
$cfg['Servers'][$i]['AllowRoot'] = TRUE;
$cfg['Servers'][$i]['AllowDeny']['order']
= '';
$cfg['Servers'][$i]['AllowDeny']['rules']
= array();
/**
* This section allows you to configure a third server for this installation.
*/
$i++;
$cfg['Servers'][$i]['host'] = '';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = '';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['only_db'] = '';
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['pmadb'] = ''; // 'phpmyadmin' - see scripts/create_tables.sql
$cfg['Servers'][$i]['bookmarktable'] = ''; // 'pma_bookmark'
$cfg['Servers'][$i]['relation'] = ''; // 'pma_relation'
$cfg['Servers'][$i]['table_info'] = ''; // 'pma_table_info'
$cfg['Servers'][$i]['table_coords'] = ''; // 'pma_table_coords'
$cfg['Servers'][$i]['pdf_pages'] = ''; // 'pma_pdf_pages'
$cfg['Servers'][$i]['column_info'] = ''; // 'pma_column_info'
$cfg['Servers'][$i]['history'] = ''; // 'pma_history'
$cfg['Servers'][$i]['verbose_check'] = TRUE;
$cfg['Servers'][$i]['AllowRoot'] = TRUE;
$cfg['Servers'][$i]['AllowDeny']['order']
= '';
$cfg['Servers'][$i]['AllowDeny']['rules']
= array();
// If you have more than one server configured, you can set $cfg['ServerDefault'] // If you have more than one server configured, you can set $cfg['ServerDefault']
// to any one of them to autoconnect to that server when phpMyAdmin is started, // to any one of them to autoconnect to that server when phpMyAdmin is started,
// or set it to 0 to be given a list of servers without logging in // or set it to 0 to be given a list of servers without logging in
// If you have only one server configured, $cfg['ServerDefault'] *MUST* be // If you have only one server configured, $cfg['ServerDefault'] *MUST* be
// set to that server. // set to that server.
$cfg['ServerDefault'] = 1; // Default server (0 = no default server) $cfg['ServerDefault'] = 1; // Default server (0 = no default server)
$cfg['Server'] = '';
unset($cfg['Servers'][0]);
/** /**
* Other core phpMyAdmin settings * Other core phpMyAdmin settings

View File

@@ -87,6 +87,12 @@ if (file_exists('./lang/added_messages.php')) {
*/ */
include './config.default.php'; include './config.default.php';
// Remember default server config
$default_server = $cfg['Servers'][1];
// Drop all server, as they have to be configured by user
unset($cfg['Servers']);
/** /**
* Parses the configuration file and gets some constants used to define * Parses the configuration file and gets some constants used to define
* versions of phpMyAdmin/php/mysql... * versions of phpMyAdmin/php/mysql...
@@ -127,6 +133,39 @@ if (file_exists('./config.inc.php')) {
*/ */
require_once('./libraries/select_lang.lib.php'); require_once('./libraries/select_lang.lib.php');
/**
* Servers array fixups.
*/
// Do we have some server?
if (!isset($cfg['Servers']) || count($cfg['Servers']) == 0) {
// No server => create one with defaults
$cfg['Servers'] = array(1 => $default_server);
} else {
// We have server(s) => apply default config
$new_servers = array();
foreach($cfg['Servers'] as $key => $val) {
if (!is_int($key) || $key < 1) {
// Show error
header( 'Location: error.php'
. '?lang=' . urlencode( $available_languages[$lang][2] )
. '&char=' . urlencode( $charset )
. '&dir=' . urlencode( $text_dir )
. '&type=' . urlencode( $strError )
. '&error=' . urlencode(
// FIXME: We could translate this message, however it's translations freeze right now:
sprintf( 'Invalid server index: "%s"', $key))
. '&' . SID
);
}
$new_servers[$key] = array_merge($default_server, $val);
}
$cfg['Servers'] = $new_servers;
unset($new_servers);
}
// Cleanup
unset($default_server);
/** /**
* We really need this one! * We really need this one!
*/ */