-
Notifications
You must be signed in to change notification settings - Fork 9
/
vip-config.php
82 lines (74 loc) · 3 KB
/
vip-config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* VIP-Go specific wp-config.php.
*
* Mapped to vip-config/vip-config.php in the root of the WordPress installation on the VIP servers.
*
* Consider using environment variables for sensitive data:
*
* @see https://docs.wpvip.com/how-tos/manage-environment-variables/
*
* WARNING: This file is loaded very early (immediately after `wp-config.php`), which means that most WordPress APIs,
* classes, and functions are not available. The code below should be limited to pure PHP.
*
* @see https://vip.wordpress.com/documentation/vip-go/understanding-your-vip-go-codebase/
*/
// Enable Composer autoloader.
require dirname( __DIR__ ) . '/wp-content/plugins/vendor/autoload.php';
/**
* Enable VIP Search.
*
* @see https://docs.wpvip.com/technical-references/enterprise-search/
*/
define( 'VIP_ENABLE_VIP_SEARCH', true );
define( 'VIP_ENABLE_VIP_SEARCH_QUERY_INTEGRATION', true );
/**
* Set a high default limit to avoid too many revisions from polluting the database.
*
* Posts with extremely high revisions can result in fatal errors or have performance issues.
*
* Feel free to adjust this depending on your use cases.
*/
if ( ! defined( 'WP_POST_REVISIONS' ) ) {
define( 'WP_POST_REVISIONS', 100 );
}
/**
* Disable New Relic Browser instrumentation.
*
* By default, the New Relic extension automatically enables Browser instrumentation.
*
* This injects some New Relic specific javascript onto all pages on the VIP Platform.
*
* This isn't always desireable (e.g. impacts performance) so let's turn it off.
*
* If you would like to enable Browser instrumentation, please remove the lines below.
*
* @see https://docs.newrelic.com/docs/agents/php-agent/features/browser-monitoring-php-agent/#disable
* @see https://docs.wpvip.com/technical-references/tools-for-site-management/new-relic/
*/
if ( function_exists( 'newrelic_disable_autorum' ) ) {
newrelic_disable_autorum();
}
/**
* Set WP_DEBUG to true for all local or non-production VIP environments to ensure
* _doing_it_wrong() notices display in Query Monitor. This also changes the error_reporting level to E_ALL.
*
* @see https://wordpress.org/support/article/debugging-in-wordpress/#wp_debug
*/
if ( defined( 'VIP_GO_APP_ENVIRONMENT' ) && 'production' !== VIP_GO_APP_ENVIRONMENT && ! defined( 'WP_DEBUG' ) ) {
define( 'WP_DEBUG', true );
}
/**
* Set site domain for NewRelic in order to have separate logs for each site.
*
* phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
*/
if ( ! empty( $_SERVER['HTTP_HOST'] ) && function_exists( 'newrelic_set_appname' ) ) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- it is ok, the code is copied from docs: https://docs.wpvip.com/technical-references/new-relic-for-wordpress/#h-separate-apps-out-on-a-per-site-basis-for-multisite
$app_name = $_SERVER['HTTP_HOST'];
// Append the environment name, if present.
if ( defined( 'VIP_GO_APP_ENVIRONMENT' ) ) {
$app_name .= '-' . VIP_GO_APP_ENVIRONMENT;
}
newrelic_set_appname( $app_name );
}