-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* require a new application.pantheon.php file * use application.pantheon.php to define WP_HOME and make it available for future application.php modifications * ignore internal errors in phpcs rulesets * linting * ignore application.pantheon.php filename pattern * bump actions/cache to v4 * patch set-output with environment var see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * add the WP_HOME and WP_SITEURL values to the environment after we define them if they're already defined, we don't run this code path * look for the LANDO environment variable to check for Lando * use the lando environment variable in application.php, too * fix spacing * ignore the putenv that we added
- Loading branch information
1 parent
988a03f
commit f5ccfd5
Showing
4 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Pantheon platform application settings. | ||
* | ||
* IMPORTANT NOTE: | ||
* Do not modify this file. This file is maintained by Pantheon. | ||
* | ||
* Site-specific modifications belong in config/application.php, not this file. | ||
* This file may change in future releases and modifications would cause | ||
* conflicts when attempting to apply upstream updates. | ||
*/ | ||
|
||
use Roots\WPConfig\Config; | ||
use function Env\env; | ||
|
||
if ( isset( $_ENV['PANTHEON_ENVIRONMENT'] ) && ! isset( $_ENV['LANDO'] ) ) { | ||
// We can use PANTHEON_SITE_NAME here because it's safe to assume we're on a Pantheon environment if PANTHEON_ENVIRONMENT is set. | ||
$sitename = $_ENV['PANTHEON_SITE_NAME']; | ||
$baseurl = $_ENV['PANTHEON_ENVIRONMENT'] . '-' . $sitename . '.pantheonsite.io'; | ||
|
||
$scheme = 'http'; | ||
if ( isset( $_SERVER['HTTPS'] ) && 'on' === $_SERVER['HTTPS'] ) { | ||
$scheme = 'https'; | ||
} | ||
|
||
// Define the WP_HOME and WP_SITEURL constants if they aren't already defined. | ||
if ( ! env( 'WP_HOME' ) ) { | ||
// If HTTP_HOST is set, use that as the base URL. It's probably more accurate. | ||
if ( isset( $_SERVER['HTTP_HOST'] ) ) { | ||
$baseurl = $_SERVER['HTTP_HOST']; | ||
} | ||
|
||
$homeurl = $scheme . '://' . $baseurl; | ||
Config::define( 'WP_HOME', $homeurl ); | ||
putenv( 'WP_HOME=' . $homeurl ); | ||
|
||
if ( ! env( 'WP_SITEURL' ) ) { | ||
Config::define( 'WP_SITEURL', $homeurl . '/wp' ); | ||
putenv( 'WP_SITEURL=' . $homeurl . '/wp' ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters