Provide way for vendors to easily change paths to config files.

This commit is contained in:
Michal Čihař
2010-03-31 12:29:21 +02:00
parent a6371c10d5
commit 7b754395e9
8 changed files with 40 additions and 16 deletions

View File

@@ -56,6 +56,7 @@ $Id$
Martynas Mickevičius
+ patch #2967320 [designer] Colored relations based on the primary key,
thanks to GreenRover - greenrover
- [core] Provide way for vendors to easily change paths to config files.
3.3.2.0 (not yet released)
- patch #2969449 [core] Name for MERGE engine varies depending on the

View File

@@ -199,8 +199,8 @@ if (top != self) {
<body class="loginform">
<?php
if (file_exists('./config.header.inc.php')) {
require './config.header.inc.php';
if (file_exists(CUSTOM_HEADER_FILE)) {
require CUSTOM_HEADER_FILE;
}
?>
@@ -343,8 +343,8 @@ window.setTimeout('PMA_focusInput()', 500);
// ]]>
</script>
<?php
if (file_exists('./config.footer.inc.php')) {
require './config.footer.inc.php';
if (file_exists(CUSTOM_FOOTER_FILE)) {
require CUSTOM_FOOTER_FILE;
}
?>
</body>
@@ -682,7 +682,7 @@ function PMA_auth_fails()
}
}
} elseif (PMA_DBI_getError()) {
$conn_error = '#' . $GLOBALS['errno'] . ' ' . $GLOBALS['strCannotLogin'];
$conn_error = '#' . $GLOBALS['errno'] . ' ' . $GLOBALS['strCannotLogin'];
} else {
$conn_error = $GLOBALS['strCannotLogin'];
}

View File

@@ -55,8 +55,8 @@ function PMA_auth()
</head>
<body>
<?php
if (file_exists('./config.header.inc.php')) {
require './config.header.inc.php';
if (file_exists(CUSTOM_HEADER_FILE)) {
require CUSTOM_HEADER_FILE;
}
?>
@@ -69,8 +69,8 @@ function PMA_auth()
<?php
PMA_Message::error('strWrongUser')->display();
if (file_exists('./config.footer.inc.php')) {
require './config.footer.inc.php';
if (file_exists(CUSTOM_FOOTER_FILE)) {
require CUSTOM_FOOTER_FILE;
}
?>

View File

@@ -288,7 +288,7 @@ if (! function_exists('preg_replace')) {
* force reading of config file, because we removed sensitive values
* in the previous iteration
*/
$GLOBALS['PMA_Config'] = new PMA_Config('./config.inc.php');
$GLOBALS['PMA_Config'] = new PMA_Config(CONFIG_FILE);
if (!defined('PMA_MINIMUM_COMMON')) {
$GLOBALS['PMA_Config']->checkPmaAbsoluteUri();
@@ -589,7 +589,7 @@ require_once './libraries/select_lang.lib.php';
if ($GLOBALS['PMA_Config']->error_config_file) {
$error = $strConfigFileError
. '<br /><br />'
. ($GLOBALS['PMA_Config']->getSource() == './config.inc.php' ?
. ($GLOBALS['PMA_Config']->getSource() == CONFIG_FILE ?
'<a href="show_config_errors.php"'
.' target="_blank">' . $GLOBALS['PMA_Config']->getSource() . '</a>'
:

View File

@@ -200,8 +200,8 @@ setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
}
// Include possible custom footers
if (file_exists('./config.footer.inc.php')) {
require './config.footer.inc.php';
if (file_exists(CUSTOM_FOOTER_FILE)) {
require CUSTOM_FOOTER_FILE;
}

View File

@@ -47,8 +47,8 @@ if (empty($GLOBALS['is_header_sent'])) {
<?php
// Include possible custom headers
if (file_exists('./config.header.inc.php')) {
require './config.header.inc.php';
if (file_exists(CUSTOM_HEADER_FILE)) {
require CUSTOM_HEADER_FILE;
}

View File

@@ -34,4 +34,25 @@ define('SETUP_CONFIG_FILE', './config/config.inc.php');
*/
define('SETUP_DIR_WRITABLE', true);
/**
* Directory where configuration files are stored.
* It is not used directly in code, just a convenient
* define used further in this file.
*/
define('CONFIG_DIR', './');
/**
* Filename of a configuration file.
*/
define('CONFIG_FILE', CONFIG_DIR . 'config.inc.php');
/**
* Filename of custom header file.
*/
define('CUSTOM_HEADER_FILE', CONFIG_DIR . 'config.header.inc.php');
/**
* Filename of custom footer file.
*/
define('CUSTOM_FOOTER_FILE', CONFIG_DIR . 'config.footer.inc.php');
?>

View File

@@ -7,12 +7,14 @@
* @package phpMyAdmin
*/
require './libraries/vendor_config.php';
echo "Starting to parse config file...\n";
error_reporting(E_ALL);
/**
* Read config file.
*/
require './config.inc.php';
require CONFIG_FILE;
?>