HELP
This commit is contained in:
parent
c6664a7597
commit
e05e9553f5
1250 changed files with 23379 additions and 147730 deletions
|
|
@ -11,36 +11,34 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Roots\WPConfig\Config;
|
||||
|
||||
use function Env\env;
|
||||
use Roots\WPConfig\Config;
|
||||
|
||||
// USE_ENV_ARRAY + CONVERT_* + STRIP_QUOTES
|
||||
Env\Env::$options = 31;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Directory containing all of the site's files.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$root_dir = dirname(__DIR__);
|
||||
$root_dir = \dirname(__DIR__);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Document Root.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$webroot_dir = $root_dir.'/web';
|
||||
$webroot_dir = $root_dir . '/web';
|
||||
|
||||
/*
|
||||
* Use Dotenv to set required environment variables and load .env file in root
|
||||
* .env.local will override .env if it exists
|
||||
*/
|
||||
if (file_exists($root_dir.'/.env')) {
|
||||
$env_files = file_exists($root_dir.'/.env.local') ? [
|
||||
'.env',
|
||||
'.env.local',
|
||||
] : ['.env'];
|
||||
if (file_exists($root_dir . '/.env')) {
|
||||
$env_files = file_exists($root_dir . '/.env.local')
|
||||
? ['.env', '.env.local']
|
||||
: ['.env'];
|
||||
|
||||
$dotenv = Dotenv\Dotenv::createImmutable($root_dir, $env_files, false);
|
||||
|
||||
|
|
@ -56,10 +54,10 @@ if (file_exists($root_dir.'/.env')) {
|
|||
* Set up our global environment constant and load its config first
|
||||
* Default: production
|
||||
*/
|
||||
define('WP_ENV', env('WP_ENV') ?: 'production');
|
||||
\define('WP_ENV', env('WP_ENV') ?: 'production');
|
||||
|
||||
// Infer WP_ENVIRONMENT_TYPE based on WP_ENV
|
||||
if (!env('WP_ENVIRONMENT_TYPE') && in_array(WP_ENV, ['production', 'staging', 'development', 'local'])) {
|
||||
if (!env('WP_ENVIRONMENT_TYPE') && \in_array(WP_ENV, ['production', 'staging', 'development', 'local'], true)) {
|
||||
Config::define('WP_ENVIRONMENT_TYPE', WP_ENV);
|
||||
}
|
||||
|
||||
|
|
@ -69,12 +67,12 @@ Config::define('WP_SITEURL', env('WP_SITEURL'));
|
|||
|
||||
// Custom Content Directory
|
||||
Config::define('CONTENT_DIR', '/app');
|
||||
Config::define('WP_CONTENT_DIR', $webroot_dir.Config::get('CONTENT_DIR'));
|
||||
Config::define('WP_CONTENT_URL', Config::get('WP_HOME').Config::get('CONTENT_DIR'));
|
||||
Config::define('WP_CONTENT_DIR', $webroot_dir . Config::get('CONTENT_DIR'));
|
||||
Config::define('WP_CONTENT_URL', Config::get('WP_HOME') . Config::get('CONTENT_DIR'));
|
||||
|
||||
// DB settings
|
||||
if (env('DB_SSL')) {
|
||||
Config::define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL);
|
||||
Config::define('MYSQL_CLIENT_FLAGS', \MYSQLI_CLIENT_SSL);
|
||||
}
|
||||
|
||||
Config::define('DB_NAME', env('DB_NAME'));
|
||||
|
|
@ -88,9 +86,9 @@ $table_prefix = env('DB_PREFIX') ?: 'wp_';
|
|||
if (env('DATABASE_URL')) {
|
||||
$dsn = (object) parse_url(env('DATABASE_URL'));
|
||||
|
||||
Config::define('DB_NAME', substr($dsn->path, 1));
|
||||
Config::define('DB_NAME', mb_substr($dsn->path, 1));
|
||||
Config::define('DB_USER', $dsn->user);
|
||||
Config::define('DB_PASSWORD', isset($dsn->pass) ? $dsn->pass : null);
|
||||
Config::define('DB_PASSWORD', $dsn->pass ?? null);
|
||||
Config::define('DB_HOST', isset($dsn->port) ? "{$dsn->host}:{$dsn->port}" : $dsn->host);
|
||||
}
|
||||
|
||||
|
|
@ -124,8 +122,8 @@ Config::define('SCRIPT_DEBUG', false);
|
|||
ini_set('display_errors', '0');
|
||||
|
||||
// Plugins
|
||||
Config::define('WPMU_PLUGIN_DIR', Config::get('WP_CONTENT_DIR').'/mu-plugins');
|
||||
Config::define('WP_PLUGIN_DIR', Config::get('WP_CONTENT_DIR').'/plugins');
|
||||
Config::define('WPMU_PLUGIN_DIR', Config::get('WP_CONTENT_DIR') . '/mu-plugins');
|
||||
Config::define('WP_PLUGIN_DIR', Config::get('WP_CONTENT_DIR') . '/plugins');
|
||||
|
||||
/*
|
||||
* Allow WordPress to detect HTTPS when used behind a reverse proxy or a load balancer
|
||||
|
|
@ -135,7 +133,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FO
|
|||
$_SERVER['HTTPS'] = 'on';
|
||||
}
|
||||
|
||||
$env_config = __DIR__.'/environments/'.WP_ENV.'.php';
|
||||
$env_config = __DIR__ . '/environments/' . WP_ENV . '.php';
|
||||
|
||||
if (file_exists($env_config)) {
|
||||
include_once $env_config;
|
||||
|
|
@ -144,6 +142,6 @@ if (file_exists($env_config)) {
|
|||
Config::apply();
|
||||
|
||||
// Bootstrap WordPress
|
||||
if (!defined('ABSPATH')) {
|
||||
define('ABSPATH', $webroot_dir.'/wp/');
|
||||
if (!\defined('ABSPATH')) {
|
||||
\define('ABSPATH', $webroot_dir . '/wp/');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue