corvée(fmt) formate
This commit is contained in:
parent
4720c46ff8
commit
fdb6aaa7e9
23 changed files with 139 additions and 156 deletions
|
|
@ -11,21 +11,21 @@
|
|||
|
||||
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__);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Document Root.
|
||||
*
|
||||
* @var string
|
||||
|
|
@ -59,7 +59,7 @@ if (file_exists($root_dir.'/.env')) {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ 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 +88,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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue