|
1 | 1 | <?php |
2 | | - |
3 | 2 | /** |
4 | 3 | * Your base production configuration goes in this file. Environment-specific |
5 | 4 | * overrides go in their respective config/environments/{{WP_ENV}}.php file. |
|
9 | 8 | * can. |
10 | 9 | */ |
11 | 10 |
|
12 | | -use \DeliciousBrains\SpinupWPComposerSite\App; |
| 11 | +use DeliciousBrains\SpinupWPComposerSite\App; |
13 | 12 |
|
14 | 13 | $root_dir = dirname( __DIR__ ); |
15 | 14 | $webroot_dir = $root_dir . '/public'; |
|
23 | 22 | * Use Dotenv to set required environment variables and load .env file in root |
24 | 23 | */ |
25 | 24 | $env_files = file_exists( $root_dir . '/.env.local' ) ? [ '.env', '.env.local' ] : [ '.env' ]; |
26 | | -$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir, $env_files, false); |
| 25 | +$dotenv = Dotenv\Dotenv::createUnsafeImmutable( $root_dir, $env_files, false ); |
27 | 26 | if ( file_exists( $root_dir . '/.env' ) ) { |
28 | 27 | $dotenv->load(); |
29 | 28 | $dotenv->required( [ 'DB_NAME', 'DB_USER', 'DB_PASSWORD', 'WP_HOME', 'WP_SITEURL' ] ); |
|
40 | 39 | App::define( 'WP_CONTENT_DIR', $webroot_dir . CONTENT_DIR ); |
41 | 40 | App::define( 'WP_CONTENT_URL', WP_HOME . CONTENT_DIR ); |
42 | 41 |
|
43 | | -App::define('DB_NAME', env('DB_NAME')); |
44 | | -App::define('DB_USER', env('DB_USER')); |
45 | | -App::define('DB_PASSWORD', env('DB_PASSWORD')); |
46 | | -App::define('DB_HOST', env('DB_HOST') ?: 'localhost'); |
47 | | -App::define('DB_CHARSET', 'utf8mb4'); |
48 | | -App::define('DB_COLLATE', ''); |
49 | | -$table_prefix = env('DB_PREFIX') ?: 'wp_'; |
| 42 | +App::define( 'DB_NAME', env( 'DB_NAME' ) ); |
| 43 | +App::define( 'DB_USER', env( 'DB_USER' ) ); |
| 44 | +App::define( 'DB_PASSWORD', env( 'DB_PASSWORD' ) ); |
| 45 | +App::define( 'DB_HOST', env( 'DB_HOST' ) ?: 'localhost' ); |
| 46 | +App::define( 'DB_CHARSET', 'utf8mb4' ); |
| 47 | +App::define( 'DB_COLLATE', '' ); |
| 48 | +$table_prefix = env( 'DB_PREFIX' ) ?: 'wp_'; |
50 | 49 |
|
51 | 50 | // Set other constants from env file. |
52 | | -foreach( array_keys($dotenv->load()) as $key ) { |
53 | | - App::define($key, env( $key )); |
| 51 | +foreach ( array_keys( $dotenv->load() ) as $key ) { |
| 52 | + App::define( $key, env( $key ) ); |
54 | 53 | } |
55 | 54 |
|
56 | | -// Environment config |
| 55 | +// Environment config. |
57 | 56 | $env_config = __DIR__ . '/environments/' . WP_ENV . '.php'; |
58 | 57 | if ( file_exists( $env_config ) ) { |
59 | 58 | require_once $env_config; |
60 | 59 | } |
61 | 60 |
|
62 | | -App::define('AUTOMATIC_UPDATER_DISABLED', true); |
63 | | -App::define('DISABLE_WP_CRON', env('DISABLE_WP_CRON') ?: false); |
64 | | -// Disable the plugin and theme file editor in the admin |
65 | | -App::define('DISALLOW_FILE_EDIT', true); |
66 | | -// Disable plugin and theme updates and installation from the admin |
67 | | -App::define('DISALLOW_FILE_MODS', true); |
| 61 | +App::define( 'AUTOMATIC_UPDATER_DISABLED', true ); |
| 62 | +App::define( 'DISABLE_WP_CRON', env( 'DISABLE_WP_CRON' ) ?: false ); |
| 63 | +// Disable the plugin and theme file editor in the admin. |
| 64 | +App::define( 'DISALLOW_FILE_EDIT', true ); |
| 65 | +// Disable plugin and theme updates and installation from the admin. |
| 66 | +App::define( 'DISALLOW_FILE_MODS', true ); |
68 | 67 |
|
69 | | -// Secret keys |
| 68 | +// Secret keys. |
70 | 69 | if ( ! file_exists( __DIR__ . '/keys.php' ) ) { |
71 | 70 | $keys = file_get_contents( 'https://api.wordpress.org/secret-key/1.1/salt/' ); |
72 | | - file_put_contents( __DIR__ . '/keys.php', '<?php use ' . App::class . '; ' . str_replace( 'define(', 'App::define(', $keys ) ); |
| 71 | + file_put_contents( __DIR__ . '/keys.php', '<?php use ' . App::class . ";\n" . str_replace( 'define(', 'App::define(', $keys ) ); |
73 | 72 | } |
74 | 73 | include __DIR__ . '/keys.php'; |
75 | 74 |
|
|
0 commit comments