Skip to content

Instantly share code, notes, and snippets.

@janw-me
Last active November 17, 2020 00:02
Show Gist options
  • Save janw-me/04923e9c3909585310ad4ca582d1535c to your computer and use it in GitHub Desktop.
Save janw-me/04923e9c3909585310ad4ca582d1535c to your computer and use it in GitHub Desktop.

The wp-config.php will get split in seperate files. the wp-config.php and the env-config.php. env-config.php should never be in the Google Drive / git. It's location should be above the public_html not inside it. In wp-config.php the defaults are set, secret data or data that might differ should be in env-config.php

How to

Create the env-config.php above the public_html. Set the constants needed there. Open the wp-config.php and compere it with the template below. Are there constants that are in the original that are not in the template? Are there constants that are different?

The original should be replaced with the template. But with the tweaks needed.

Specific Constants

Auto generated

Constants set by ithemes/wp rocket or other plugins, keep them at the top of the wp-config.php.

// BEGIN iThemes Security - Do not modify or remove this line
// iThemes Security Config Details: 2
define( 'DISALLOW_FILE_EDIT', true ); // Disable File Editor - Security > Settings > WordPress Tweaks > File Editor
define( 'FORCE_SSL_ADMIN', true ); // Redirect All HTTP Page Requests to HTTPS - Security > Settings > Secure Socket Layers (SSL) > SSL for Dashboard
// END iThemes Security - Do not modify or remove this line
define('WP_CACHE', true); // Added by WP Rocket

Keep

The list of ***_KEY constants should be kept in the wp-config.php The table_prefix should also be kept in the wp-config.php

Exceptions

Check extra for the following constants, and set in env-config.php.

// don't keep if not present, it's old and probably can do without. Remove on wp-provider
define('WP_MEMORY_LIMIT', '192M');

// if it's not "utf8mb4" keep it,
define( 'DB_CHARSET', 'utf8' );

Don't touch.

Constant's that should not be touched, let the new wp-config.php take care of it

  • AUTOSAVE_INTERVAL
  • CORE_UPGRADE_SKIP_NEW_BUNDLED
  • DISABLE_WP_CRON
  • DISALLOW_FILE_EDIT
  • DISALLOW_FILE_MODS
  • EMPTY_TRASH_DAYS
  • WP_DEBUG_DISPLAY
  • WP_DEBUG_LOG
  • WP_DEBUG
  • WP_DEFAULT_THEME
  • WP_POST_REVISIONS
  • WP_SITEURL
  • WPLANG
<?php
// Valid values: development, staging and production. To get this value use: wp_get_environment_type()
defined( 'WP_ENVIRONMENT_TYPE' ) or define( 'WP_ENVIRONMENT_TYPE', 'production' );
define('DB_NAME', 'fill in db name');
define('DB_USER', 'fill in username');
define('DB_PASSWORD', 'fill in db password');
define('DB_HOST', 'localhost');
define('WP_HOME', 'http://www.example.nl'); // No trailing slash
<?php
/**********************************************************
* VARIABLES
**********************************************************/
$vars = array(
'DB_NAME' => DB_NAME,
'DB_USER' => DB_USER,
'DB_PASSWORD' => DB_PASSWORD,
'WP_HOME' => trim( WP_HOME, '/' ),
'ABSPATH' => ABSPATH,
'AUTH_KEY' => AUTH_KEY,
'SECURE_AUTH_KEY' => SECURE_AUTH_KEY,
'LOGGED_IN_KEY' => LOGGED_IN_KEY,
'NONCE_KEY' => NONCE_KEY,
'AUTH_SALT' => AUTH_SALT,
'SECURE_AUTH_SALT' => SECURE_AUTH_SALT,
'LOGGED_IN_SALT' => LOGGED_IN_SALT,
'NONCE_SALT' => NONCE_SALT,
'table_prefix' => $GLOBALS['wpdb']->prefix,
// for escaping
'DIR' =>'__DIR__',
'FILE' =>'__FILE__',
);
/**********************************************************
* ENV-CONFIG>PHP / DB & URL
**********************************************************/
$env_config_file = dirname( getcwd() ) . '/env-config.php';
$env_config_content = <<<ENV_CONFIG
<?php
// Valid values: development, staging and production. To get this value use: wp_get_environment_type()
defined( 'WP_ENVIRONMENT_TYPE' ) or define( 'WP_ENVIRONMENT_TYPE', 'production' );
define('DB_NAME', '{$vars['DB_NAME']}');
define('DB_USER', '{$vars['DB_USER']}');
define('DB_PASSWORD', '{$vars['DB_PASSWORD']}');
define('WP_HOME', '{$vars['WP_HOME']}'); // No trailing slash
ENV_CONFIG;
$env_config_content .= PHP_EOL . PHP_EOL;
/**********************************************************
* ENV-CONFIG>PHP / MEMORY
**********************************************************/
if ( in_array( gethostname(), array( 'srv01.webfundament.nl', 'srv01.minddhosting.nl' ) ) ) {
$env_config_content .= "define('WP_MEMORY_LIMIT', '192M'); // WordPress Memory Limit\n\n";
}
/**********************************************************
* ENV-CONFIG>PHP / AWS MAIL
**********************************************************/
if ( defined( 'WPOSES_AWS_ACCESS_KEY_ID' ) ) {
$WPOSES_AWS_ACCESS_KEY_ID = WPOSES_AWS_ACCESS_KEY_ID;
$env_config_content .= "define('WPOSES_AWS_ACCESS_KEY_ID', '{$WPOSES_AWS_ACCESS_KEY_ID}');\n";
}
if ( defined( 'WPOSES_AWS_SECRET_ACCESS_KEY' ) ) {
$WPOSES_AWS_SECRET_ACCESS_KEY = WPOSES_AWS_SECRET_ACCESS_KEY;
$env_config_content .= "define('WPOSES_AWS_SECRET_ACCESS_KEY', '{$WPOSES_AWS_SECRET_ACCESS_KEY}');\n";
}
/**********************************************************
* ENV-CONFIG>PHP / RESULT
**********************************************************/
$env_config_content .= PHP_EOL;
echo "\033[32m$env_config_file \033[92m\n";
echo $env_config_content;
echo "\033[32m$env_config_file \033[0m\n";
file_put_contents( $env_config_file, $env_config_content );
/**********************************************************
* WP-CONFIG.PHP / MAIN
**********************************************************/
$wp_config_file_new = getcwd() . '/wp-config.new.php';
$wp_config_file = getcwd() . '/wp-config.php';
$wp_config_content = <<<WP_CONFIG
<?php
// BEGIN iThemes Security - Do not modify or remove this line
// iThemes Security Config Details: 2
define( 'DISALLOW_FILE_EDIT', true ); // Disable File Editor - Security > Settings > WordPress Tweaks > File Editor
define( 'FORCE_SSL_ADMIN', true ); // Redirect All HTTP Page Requests to HTTPS - Security > Settings > Secure Socket Layers (SSL) > SSL for Dashboard
// END iThemes Security - Do not modify or remove this line
define( 'WP_CACHE', true ); // Added by WP Rocket
// Check if a enviroment file is defined and include it.
if ( is_file( dirname( {$vars['DIR']} ) . '/env-config.php' ) ) include( dirname( {$vars['DIR']} ) . '/env-config.php' );
if ( is_file( dirname( {$vars['FILE']} ) . '/env-config.php' ) ) include( dirname( {$vars['FILE']} ) . '/env-config.php' );
//====================================================================
// Below should only contain the defaults for local development
//====================================================================
// Database
defined( 'DB_NAME' ) or define( 'DB_NAME', 'wp' );
defined( 'DB_USER' ) or define( 'DB_USER', 'wp' );
defined( 'DB_PASSWORD' ) or define( 'DB_PASSWORD', 'wp' );
defined( 'DB_HOST' ) or define( 'DB_HOST', 'localhost' );
// Url
\$http_s = ( isset(\$_SERVER['HTTPS']) && !empty(\$_SERVER['HTTPS']) && \$_SERVER['HTTPS'] != 'off') ? 'https' : 'http';
defined( 'WP_HOME' ) or define( 'WP_HOME', \$http_s . '://example.test' ); // no trailing slash
//====================================================================
// Below should be the same for every environment
//====================================================================
\$table_prefix = '{$vars['table_prefix']}'; // please change with 2-5 random letters/digits
// https://api.wordpress.org/secret-key/1.1/salt
define( 'AUTH_KEY', '{$vars['AUTH_KEY']}');
define( 'SECURE_AUTH_KEY', '{$vars['SECURE_AUTH_KEY']}');
define( 'LOGGED_IN_KEY', '{$vars['LOGGED_IN_KEY']}');
define( 'NONCE_KEY', '{$vars['NONCE_KEY']}');
define( 'AUTH_SALT', '{$vars['AUTH_SALT']}');
define( 'SECURE_AUTH_SALT', '{$vars['SECURE_AUTH_SALT']}');
define( 'LOGGED_IN_SALT', '{$vars['LOGGED_IN_SALT']}');
define( 'NONCE_SALT', '{$vars['NONCE_SALT']}');
// Multisite
defined( 'WP_ALLOW_MULTISITE' ) or define( 'WP_ALLOW_MULTISITE', false );
/* // Unquote for multisites
defined( 'MULTISITE' ) or define( 'MULTISITE', true );
defined( 'SUBDOMAIN_INSTALL' ) or define( 'SUBDOMAIN_INSTALL', false );
defined( 'DOMAIN_CURRENT_SITE' ) or define( 'DOMAIN_CURRENT_SITE', 'example.com' ); // no `http://` see env-config.php
defined( 'PATH_CURRENT_SITE' ) or define( 'PATH_CURRENT_SITE', '/' );
defined( 'SITE_ID_CURRENT_SITE' ) or define( 'SITE_ID_CURRENT_SITE', 1 );
defined( 'BLOG_ID_CURRENT_SITE' ) or define( 'BLOG_ID_CURRENT_SITE', 1 );
/**/
//====================================================================
// That's all, stop editing! Happy blogging.
//====================================================================
// URL and paths
defined( 'WP_SITEURL' ) or define( 'WP_SITEURL', WP_HOME );
defined( 'WP_CONTENT_DIR' ) or define( 'WP_CONTENT_DIR', dirname( {$vars['FILE']} ) . '/wp-content' );
defined( 'WP_CONTENT_URL' ) or define( 'WP_CONTENT_URL', WP_HOME . '/wp-content' );
defined( 'PLUGINDIR' ) or define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
defined( 'MUPLUGINDIR' ) or define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
// DB
defined( 'DB_CHARSET' ) or define( 'DB_CHARSET', 'utf8mb4' );
defined( 'DB_COLLATE' ) or define( 'DB_COLLATE', '' );
// Minor tweaks
defined( 'AUTOSAVE_INTERVAL' ) or define( 'AUTOSAVE_INTERVAL', 300 ); // autosave every 300 seconds
defined( 'WP_POST_REVISIONS' ) or define( 'WP_POST_REVISIONS', 10 ); // 10 post revisions
defined( 'DISALLOW_FILE_EDIT' ) or define( 'DISALLOW_FILE_EDIT', true ); // don't allow to edit files in the wp-admin.
defined( 'DISALLOW_FILE_MODS' ) or define( 'DISALLOW_FILE_MODS', false ); // don't alllow installing/updating of plugins.
defined( 'EMPTY_TRASH_DAYS' ) or define( 'EMPTY_TRASH_DAYS', 30 );
defined( 'DISABLE_WP_CRON' ) or define( 'DISABLE_WP_CRON', true ); // disable the cron executed by visiting webpages
defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) or define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true); // don't install default themes/plugins on update
defined( 'WP_DEFAULT_THEME' ) or define( 'WP_DEFAULT_THEME', 'genesis'); // Set Genesis as default theme
// Debug defaults
if ( ( defined( 'WP_ENVIRONMENT_TYPE' ) && WP_ENVIRONMENT_TYPE === 'development' ) ) {
defined( 'WP_DEBUG_DISPLAY' ) or define( 'WP_DEBUG_DISPLAY', true );
defined( 'WP_DEBUG' ) or define( 'WP_DEBUG', true );
} else {
// log errors when it's not a development server
defined( 'WP_DEBUG_LOG' ) or define( 'WP_DEBUG_LOG', WP_CONTENT_DIR . '/debug_T3p1G.log' );
defined( 'WP_DEBUG_DISPLAY' ) or define( 'WP_DEBUG_DISPLAY', false );
defined( 'WP_DEBUG' ) or define( 'WP_DEBUG', true ); // so it's logging errors.
}
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
defined( 'ABSPATH' ) or define( 'ABSPATH', dirname( {$vars['FILE']} ) . '/' );
}
/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );
WP_CONFIG;
echo "\033[33m$wp_config_file_new \033[93m\n";
echo $wp_config_content;
echo "\033[33m$wp_config_file_new \033[0m\n";
file_put_contents( $wp_config_file_new, $wp_config_content );
echo "\033[38;5;27m$wp_config_file_new \033[38;5;14m\n";
echo file_get_contents($wp_config_file);
echo "\033[38;5;27m$wp_config_file_new \033[0m\n";
/**********************************************************
* CRON
**********************************************************/
$WP_CLI_BIN='/usr/local/bin/wp';
if ( in_array( gethostname(), array( 'srv01.webfundament.nl', 'srv01.minddhosting.nl' ) ) ) {
$WP_CLI_BIN='/usr/bin/wp';
}
$prep_env_file = getcwd() . '/prep-env.php';
echo <<<COMMAND
\033[38;5;202m rm {$prep_env_file} {$wp_config_file}
\033[38;5;209m mv {$wp_config_file_new} {$wp_config_file}
\033[38;5;202m wp option get home
\033[38;5;135m {$WP_CLI_BIN} cron event run --due-now --path={$vars['ABSPATH']}\033[0m
[email protected]
*/5 * * * * \033[38;5;135m{$WP_CLI_BIN} cron event run --due-now --path={$vars['ABSPATH']}\033[0m
COMMAND;
https://gist.githubusercontent.com/janw-me/04923e9c3909585310ad4ca582d1535c/raw/30aa6c4fd873a1a7e3a67b660f44bf1db1173555/prep-env.phphttps://gist.githubusercontent.com/janw-me/04923e9c3909585310ad4ca582d1535c/raw/3f15f851256ba42538e6ae7756f025aca497d88d/prep-env.phppwa.webfundament.dev<?php
/**********************************************************
* VARIABLES
**********************************************************/
$vars = array(
'DB_NAME' => DB_NAME,
'DB_USER' => DB_USER,
'DB_PASSWORD' => DB_PASSWORD,
'WP_HOME' => trim( WP_HOME, '/' ),
'ABSPATH' => ABSPATH,
'AUTH_KEY' => AUTH_KEY,
'SECURE_AUTH_KEY' => SECURE_AUTH_KEY,
'LOGGED_IN_KEY' => LOGGED_IN_KEY,
'NONCE_KEY' => NONCE_KEY,
'AUTH_SALT' => AUTH_SALT,
'SECURE_AUTH_SALT' => SECURE_AUTH_SALT,
'LOGGED_IN_SALT' => LOGGED_IN_SALT,
'NONCE_SALT' => NONCE_SALT,
'table_prefix' => $GLOBALS['wpdb']->prefix,
// for escaping
'DIR' =>'__DIR__',
'FILE' =>'__FILE__',
);
/**********************************************************
* ENV-CONFIG>PHP / DB & URL
**********************************************************/
$env_config_file = dirname( getcwd() ) . '/env-config.php';
$env_config_content = <<<ENV_CONFIG
<?php
// Valid values: development, staging and production. To get this value use: wp_get_environment_type()
defined( 'WP_ENVIRONMENT_TYPE' ) or define( 'WP_ENVIRONMENT_TYPE', 'production' );
define('DB_NAME', '{$vars['DB_NAME']}');
define('DB_USER', '{$vars['DB_USER']}');
define('DB_PASSWORD', '{$vars['DB_PASSWORD']}');
define('WP_HOME', '{$vars['WP_HOME']}'); // No trailing slash
ENV_CONFIG;
$env_config_content .= PHP_EOL . PHP_EOL;
/**********************************************************
* ENV-CONFIG>PHP / MEMORY
**********************************************************/
if ( in_array( gethostname(), array( 'srv01.webfundament.nl', 'srv01.minddhosting.nl' ) ) ) {
$env_config_content .= "define('WP_MEMORY_LIMIT', '192M'); // WordPress Memory Limit\n\n";
}
/**********************************************************
* ENV-CONFIG>PHP / AWS MAIL
**********************************************************/
if ( defined( 'WPOSES_AWS_ACCESS_KEY_ID' ) ) {
$WPOSES_AWS_ACCESS_KEY_ID = WPOSES_AWS_ACCESS_KEY_ID;
$env_config_content .= "define('WPOSES_AWS_ACCESS_KEY_ID', '{$WPOSES_AWS_ACCESS_KEY_ID}');\n";
}
if ( defined( 'WPOSES_AWS_SECRET_ACCESS_KEY' ) ) {
$WPOSES_AWS_SECRET_ACCESS_KEY = WPOSES_AWS_SECRET_ACCESS_KEY;
$env_config_content .= "define('WPOSES_AWS_SECRET_ACCESS_KEY', '{$WPOSES_AWS_SECRET_ACCESS_KEY}');\n";
}
/**********************************************************
* ENV-CONFIG>PHP / RESULT
**********************************************************/
$env_config_content .= PHP_EOL;
echo "\033[32m$env_config_file \033[92m\n";
echo $env_config_content;
echo "\033[32m$env_config_file \033[0m\n";
file_put_contents( $env_config_file, $env_config_content );
/**********************************************************
* WP-CONFIG.PHP / MAIN
**********************************************************/
$wp_config_file_new = getcwd() . '/wp-config.new.php';
$wp_config_file = getcwd() . '/wp-config.php';
$wp_config_content = <<<WP_CONFIG
<?php
// BEGIN iThemes Security - Do not modify or remove this line
// iThemes Security Config Details: 2
define( 'DISALLOW_FILE_EDIT', true ); // Disable File Editor - Security > Settings > WordPress Tweaks > File Editor
define( 'FORCE_SSL_ADMIN', true ); // Redirect All HTTP Page Requests to HTTPS - Security > Settings > Secure Socket Layers (SSL) > SSL for Dashboard
// END iThemes Security - Do not modify or remove this line
define( 'WP_CACHE', true ); // Added by WP Rocket
// Check if a enviroment file is defined and include it.
if ( is_file( dirname( {$vars['DIR']} ) . '/env-config.php' ) ) include( dirname( {$vars['DIR']} ) . '/env-config.php' );
if ( is_file( dirname( {$vars['FILE']} ) . '/env-config.php' ) ) include( dirname( {$vars['FILE']} ) . '/env-config.php' );
//====================================================================
// Below should only contain the defaults for local development
//====================================================================
// Database
defined( 'DB_NAME' ) or define( 'DB_NAME', 'wp' );
defined( 'DB_USER' ) or define( 'DB_USER', 'wp' );
defined( 'DB_PASSWORD' ) or define( 'DB_PASSWORD', 'wp' );
defined( 'DB_HOST' ) or define( 'DB_HOST', 'localhost' );
// Url
\$http_s = ( isset(\$_SERVER['HTTPS']) && !empty(\$_SERVER['HTTPS']) && \$_SERVER['HTTPS'] != 'off') ? 'https' : 'http';
defined( 'WP_HOME' ) or define( 'WP_HOME', \$http_s . '://example.test' ); // no trailing slash
//====================================================================
// Below should be the same for every environment
//====================================================================
\$table_prefix = '{$vars['table_prefix']}'; // please change with 2-5 random letters/digits
// https://api.wordpress.org/secret-key/1.1/salt
define( 'AUTH_KEY', '{$vars['AUTH_KEY']}');
define( 'SECURE_AUTH_KEY', '{$vars['SECURE_AUTH_KEY']}');
define( 'LOGGED_IN_KEY', '{$vars['LOGGED_IN_KEY']}');
define( 'NONCE_KEY', '{$vars['NONCE_KEY']}');
define( 'AUTH_SALT', '{$vars['AUTH_SALT']}');
define( 'SECURE_AUTH_SALT', '{$vars['SECURE_AUTH_SALT']}');
define( 'LOGGED_IN_SALT', '{$vars['LOGGED_IN_SALT']}');
define( 'NONCE_SALT', '{$vars['NONCE_SALT']}');
// Multisite
defined( 'WP_ALLOW_MULTISITE' ) or define( 'WP_ALLOW_MULTISITE', false );
/* // Unquote for multisites
defined( 'MULTISITE' ) or define( 'MULTISITE', true );
defined( 'SUBDOMAIN_INSTALL' ) or define( 'SUBDOMAIN_INSTALL', false );
defined( 'DOMAIN_CURRENT_SITE' ) or define( 'DOMAIN_CURRENT_SITE', 'example.com' ); // no `http://` see env-config.php
defined( 'PATH_CURRENT_SITE' ) or define( 'PATH_CURRENT_SITE', '/' );
defined( 'SITE_ID_CURRENT_SITE' ) or define( 'SITE_ID_CURRENT_SITE', 1 );
defined( 'BLOG_ID_CURRENT_SITE' ) or define( 'BLOG_ID_CURRENT_SITE', 1 );
/**/
//====================================================================
// That's all, stop editing! Happy blogging.
//====================================================================
// URL and paths
defined( 'WP_SITEURL' ) or define( 'WP_SITEURL', WP_HOME );
defined( 'WP_CONTENT_DIR' ) or define( 'WP_CONTENT_DIR', dirname( {$vars['FILE']} ) . '/wp-content' );
defined( 'WP_CONTENT_URL' ) or define( 'WP_CONTENT_URL', WP_HOME . '/wp-content' );
defined( 'PLUGINDIR' ) or define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
defined( 'MUPLUGINDIR' ) or define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
// DB
defined( 'DB_CHARSET' ) or define( 'DB_CHARSET', 'utf8mb4' );
defined( 'DB_COLLATE' ) or define( 'DB_COLLATE', '' );
// Minor tweaks
defined( 'AUTOSAVE_INTERVAL' ) or define( 'AUTOSAVE_INTERVAL', 300 ); // autosave every 300 seconds
defined( 'WP_POST_REVISIONS' ) or define( 'WP_POST_REVISIONS', 10 ); // 10 post revisions
defined( 'DISALLOW_FILE_EDIT' ) or define( 'DISALLOW_FILE_EDIT', true ); // don't allow to edit files in the wp-admin.
defined( 'DISALLOW_FILE_MODS' ) or define( 'DISALLOW_FILE_MODS', false ); // don't alllow installing/updating of plugins.
defined( 'EMPTY_TRASH_DAYS' ) or define( 'EMPTY_TRASH_DAYS', 30 );
defined( 'DISABLE_WP_CRON' ) or define( 'DISABLE_WP_CRON', true ); // disable the cron executed by visiting webpages
defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) or define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true); // don't install default themes/plugins on update
defined( 'WP_DEFAULT_THEME' ) or define( 'WP_DEFAULT_THEME', 'genesis'); // Set Genesis as default theme
// Debug defaults
if ( ( defined( 'WP_ENVIRONMENT_TYPE' ) && WP_ENVIRONMENT_TYPE === 'development' ) ) {
defined( 'WP_DEBUG_DISPLAY' ) or define( 'WP_DEBUG_DISPLAY', true );
defined( 'WP_DEBUG' ) or define( 'WP_DEBUG', true );
} else {
// log errors when it's not a development server
defined( 'WP_DEBUG_LOG' ) or define( 'WP_DEBUG_LOG', WP_CONTENT_DIR . '/debug_T3p1G.log' );
defined( 'WP_DEBUG_DISPLAY' ) or define( 'WP_DEBUG_DISPLAY', false );
defined( 'WP_DEBUG' ) or define( 'WP_DEBUG', true ); // so it's logging errors.
}
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
defined( 'ABSPATH' ) or define( 'ABSPATH', dirname( {$vars['FILE']} ) . '/' );
}
/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );
WP_CONFIG;
echo "\033[33m$wp_config_file_new \033[93m\n";
echo $wp_config_content;
echo "\033[33m$wp_config_file_new \033[0m\n";
file_put_contents( $wp_config_file_new, $wp_config_content );
echo "\033[38;5;27m$wp_config_file_new \033[38;5;14m\n";
echo file_get_contents($wp_config_file);
echo "\033[38;5;27m$wp_config_file_new \033[0m\n";
/**********************************************************
* CRON
**********************************************************/
$WP_CLI_BIN='/usr/local/bin/wp';
if ( in_array( gethostname(), array( 'srv01.webfundament.nl', 'srv01.minddhosting.nl' ) ) ) {
$WP_CLI_BIN='/usr/bin/wp';
}
$prep_env_file = getcwd() . '/prep-env.php';
echo <<<COMMAND
\n
\033[38;5;202m rm {$prep_env_file} {$wp_config_file} &&
\033[38;5;209m mv {$wp_config_file_new} {$wp_config_file} &&
\033[38;5;202m wp option get home\033[0m\n\n &&
\033[38;5;135m {$WP_CLI_BIN} cron event run --due-now --path={$vars['ABSPATH']}
\033[0m
\n\n
[email protected]
*/5 * * * * \033[38;5;135m{$WP_CLI_BIN} cron event run --due-now --path={$vars['ABSPATH']}\033[0m
COMMAND;
rm " . __FILE__ . " /home/schaaktrai/domains/schaaktrainer.nl/public_html/wp-config.php && mv /home/schaaktrai/domains/schaaktrainer.nl/public_html/wp-config.new.php /home/schaaktrai/domains/schaaktrainer.nl/public_html/wp-config.php<?php
// Check if a enviroment file is defined and include it.
if ( is_file( dirname( __DIR__ ) . '/env-config.php' ) ) include( dirname( __DIR__ ) . '/env-config.php' );
if ( is_file( dirname( __FILE__ ) . '/env-config.php' ) ) include( dirname( __FILE__ ) . '/env-config.php' );
//====================================================================
// Below should only contain the defaults for local development
//====================================================================
// Database
defined( 'DB_NAME' ) or define( 'DB_NAME', 'wp' );
defined( 'DB_USER' ) or define( 'DB_USER', 'wp' );
defined( 'DB_PASSWORD' ) or define( 'DB_PASSWORD', 'wp' );
defined( 'DB_HOST' ) or define( 'DB_HOST', 'localhost' );
// Url
$http_s = ( isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https' : 'http';
defined( 'WP_HOME' ) or define( 'WP_HOME', $http_s . '://example.test' ); // no trailing slash
//====================================================================
// Below should be the same for every enviroment
//====================================================================
$table_prefix = 'rndm_'; // please change with 2-5 random letters/digits
// https://api.wordpress.org/secret-key/1.1/salt
define( 'AUTH_KEY', '************************************************');
define( 'SECURE_AUTH_KEY', '************************************************');
define( 'LOGGED_IN_KEY', '************************************************');
define( 'NONCE_KEY', '************************************************');
define( 'AUTH_SALT', '************************************************');
define( 'SECURE_AUTH_SALT', '************************************************');
define( 'LOGGED_IN_SALT', '************************************************');
define( 'NONCE_SALT', '************************************************');
// Multisite
defined( 'WP_ALLOW_MULTISITE' ) or define( 'WP_ALLOW_MULTISITE', false );
/* // Unquote for multisites
defined( 'MULTISITE' ) or define( 'MULTISITE', true );
defined( 'SUBDOMAIN_INSTALL' ) or define( 'SUBDOMAIN_INSTALL', false );
defined( 'DOMAIN_CURRENT_SITE' ) or define( 'DOMAIN_CURRENT_SITE', 'example.com' ); // no `http://` see env-config.php
defined( 'PATH_CURRENT_SITE' ) or define( 'PATH_CURRENT_SITE', '/' );
defined( 'SITE_ID_CURRENT_SITE' ) or define( 'SITE_ID_CURRENT_SITE', 1 );
defined( 'BLOG_ID_CURRENT_SITE' ) or define( 'BLOG_ID_CURRENT_SITE', 1 );
/**/
//====================================================================
// That's all, stop editing! Happy blogging.
//====================================================================
// URL and paths
defined( 'WP_SITEURL' ) or define( 'WP_SITEURL', WP_HOME );
defined( 'WP_CONTENT_DIR' ) or define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' );
defined( 'WP_CONTENT_URL' ) or define( 'WP_CONTENT_URL', WP_HOME . '/wp-content' );
defined( 'PLUGINDIR' ) or define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
defined( 'MUPLUGINDIR' ) or define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
// DB
defined( 'DB_CHARSET' ) or define( 'DB_CHARSET', 'utf8mb4' );
defined( 'DB_COLLATE' ) or define( 'DB_COLLATE', '' );
// Minor tweaks
defined( 'AUTOSAVE_INTERVAL' ) or define( 'AUTOSAVE_INTERVAL', 300 ); // autosave every 300 seconds
defined( 'WP_POST_REVISIONS' ) or define( 'WP_POST_REVISIONS', 10 ); // 10 post revisions
defined( 'DISALLOW_FILE_EDIT' ) or define( 'DISALLOW_FILE_EDIT', true ); // don't allow to edit files in the wp-admin.
defined( 'DISALLOW_FILE_MODS' ) or define( 'DISALLOW_FILE_MODS', false ); // don't alllow installing/updating of plugins.
defined( 'EMPTY_TRASH_DAYS' ) or define( 'EMPTY_TRASH_DAYS', 30 );
defined( 'DISABLE_WP_CRON' ) or define( 'DISABLE_WP_CRON', true ); // disable the cron executed by visiting webpages
defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) or define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true); // don't install default themes/plugins on update
defined( 'WP_DEFAULT_THEME' ) or define( 'WP_DEFAULT_THEME', 'genesis'); // Set Genesis as default theme
// Debug defaults
if ( ( defined( 'WP_ENVIRONMENT_TYPE' ) && WP_ENVIRONMENT_TYPE === 'development' ) ) {
defined( 'WP_DEBUG_DISPLAY' ) or define( 'WP_DEBUG_DISPLAY', true );
defined( 'WP_DEBUG' ) or define( 'WP_DEBUG', true );
} else {
// log errors when it's not a development server
defined( 'WP_DEBUG_LOG' ) or define( 'WP_DEBUG_LOG', WP_CONTENT_DIR . '/debug_T3p1G.log' );
defined( 'WP_DEBUG_DISPLAY' ) or define( 'WP_DEBUG_DISPLAY', false );
defined( 'WP_DEBUG' ) or define( 'WP_DEBUG', true ); // so it's logging errors.
}
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
defined( 'ABSPATH' ) or define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment