wip avec résolution de conflits
This commit is contained in:
parent
63b2d2b256
commit
ef19ba2b72
208 changed files with 178625 additions and 192002 deletions
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use function Env\env;
|
||||
|
||||
use Roots\WPConfig\Config;
|
||||
|
||||
use function Env\env;
|
||||
|
||||
// USE_ENV_ARRAY + CONVERT_* + STRIP_QUOTES
|
||||
Env\Env::$options = 31;
|
||||
|
||||
|
|
@ -30,26 +30,23 @@ $root_dir = dirname(__DIR__);
|
|||
*
|
||||
* @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);
|
||||
$dotenv = Dotenv\Dotenv::createImmutable($root_dir, $env_files, false);
|
||||
|
||||
$dotenv->load();
|
||||
$dotenv->load();
|
||||
|
||||
$dotenv->required(['WP_HOME', 'WP_SITEURL']);
|
||||
if (!env('DATABASE_URL')) {
|
||||
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD']);
|
||||
}
|
||||
$dotenv->required(['WP_HOME', 'WP_SITEURL']);
|
||||
if (!env('DATABASE_URL')) {
|
||||
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD']);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -60,7 +57,7 @@ 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'], true)) {
|
||||
Config::define('WP_ENVIRONMENT_TYPE', WP_ENV);
|
||||
Config::define('WP_ENVIRONMENT_TYPE', WP_ENV);
|
||||
}
|
||||
|
||||
// URLs
|
||||
|
|
@ -69,12 +66,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'));
|
||||
|
|
@ -86,12 +83,12 @@ Config::define('DB_COLLATE', '');
|
|||
$table_prefix = env('DB_PREFIX') ?: 'wp_';
|
||||
|
||||
if (env('DATABASE_URL')) {
|
||||
$dsn = (object) parse_url(env('DATABASE_URL'));
|
||||
$dsn = (object) parse_url(env('DATABASE_URL'));
|
||||
|
||||
Config::define('DB_NAME', mb_substr($dsn->path, 1));
|
||||
Config::define('DB_USER', $dsn->user);
|
||||
Config::define('DB_PASSWORD', $dsn->pass ?? null);
|
||||
Config::define('DB_HOST', isset($dsn->port) ? "{$dsn->host}:{$dsn->port}" : $dsn->host);
|
||||
Config::define('DB_NAME', mb_substr($dsn->path, 1));
|
||||
Config::define('DB_USER', $dsn->user);
|
||||
Config::define('DB_PASSWORD', $dsn->pass ?? null);
|
||||
Config::define('DB_HOST', isset($dsn->port) ? "{$dsn->host}:{$dsn->port}" : $dsn->host);
|
||||
}
|
||||
|
||||
// Authentication Unique Keys and Salts
|
||||
|
|
@ -124,26 +121,26 @@ 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
|
||||
* See https://codex.wordpress.org/Function_Reference/is_ssl#Notes
|
||||
*/
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO']) {
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
$_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;
|
||||
include_once $env_config;
|
||||
}
|
||||
|
||||
Config::apply();
|
||||
|
||||
// Bootstrap WordPress
|
||||
if (!defined('ABSPATH')) {
|
||||
define('ABSPATH', $webroot_dir.'/wp/');
|
||||
define('ABSPATH', $webroot_dir . '/wp/');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue