Fix for blank lines missing in wp-config.php
-
The plugin seems to work fine, except that it strips all the blank lines from wp-config.php when writing to it. The replacement for function
public static function dbprefix_updateWpConfigTablePrefix($dbprefix_wpConfigFile, $oldPrefix, $newPrefix)
in brozzme_db_prefix_core.php will correct this issue. See below:
public static function dbprefix_updateWpConfigTablePrefix($dbprefix_wpConfigFile, $oldPrefix, $newPrefix)
{
// Check file's status' permissions
if (!is_writable($dbprefix_wpConfigFile))
{
return -1;
}
if (!function_exists('file')) {
return -1;
}
// Try to update the wp-config file
$lines = file($dbprefix_wpConfigFile);
$fcontent = '';
$result = -1;
foreach($lines as $line)
{
if (strpos($line, '$table_prefix') !== false){
$line = preg_replace("/=(.*)\;/", "= '".$newPrefix."';", $line);
}
$fcontent .= $line;
}
if (!empty($fcontent)){
// Save wp-config file
$result = file_put_contents($dbprefix_wpConfigFile, $fcontent);
}
return $result;
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Fix for blank lines missing in wp-config.php’ is closed to new replies.