I18N: Replace hardcoded file name in translatable strings in `wp-admin/setup-config.php` with a placeholder.

Props ramiy, danieltj.
Fixes #42161.

git-svn-id: https://develop.svn.wordpress.org/trunk@41904 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2017-10-18 15:26:10 +00:00
parent e27c43d386
commit facb2fe0ea
1 changed files with 18 additions and 10 deletions

View File

@ -41,27 +41,35 @@ require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
nocache_headers();
// Support wp-config-sample.php one level up, for the develop repo.
if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) {
$config_file = file( ABSPATH . 'wp-config-sample.php' );
elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) )
} elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) ) {
$config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
else
wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file to your WordPress installation.' ) );
} else {
wp_die( sprintf(
/* translators: %s: wp-config-sample.php */
__( 'Sorry, I need a %s file to work from. Please re-upload this file to your WordPress installation.' ),
'<code>wp-config-sample.php</code>'
) );
}
// Check if wp-config.php has been created
if ( file_exists( ABSPATH . 'wp-config.php' ) )
if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
wp_die( '<p>' . sprintf(
/* translators: %s: install.php */
__( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ),
/* translators: 1: wp-config.php 2: install.php */
__( 'The file %1$s already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href="%2$s">installing now</a>.' ),
'<code>wp-config.php</code>',
'install.php'
) . '</p>'
);
}
// Check if wp-config.php exists above the root directory but is not part of another installation
if ( @file_exists( ABSPATH . '../wp-config.php' ) && ! @file_exists( ABSPATH . '../wp-settings.php' ) ) {
wp_die( '<p>' . sprintf(
/* translators: %s: install.php */
__( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ),
/* translators: 1: wp-config.php 2: install.php */
__( 'The file %1$s already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href="%2$s">installing now</a>.' ),
'<code>wp-config.php</code>',
'install.php'
) . '</p>'
);
@ -363,7 +371,7 @@ switch($step) {
?></p>
<p><?php
/* translators: %s: wp-config.php */
printf( __( 'You can create the %s manually and paste the following text into it.' ), '<code>wp-config.php</code>' );
printf( __( 'You can create the %s file manually and paste the following text into it.' ), '<code>wp-config.php</code>' );
?></p>
<textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php
foreach ( $config_file as $line ) {