aboutsummaryrefslogtreecommitdiffstats
path: root/includes/DevelopmentSettings.php
diff options
context:
space:
mode:
authorKosta Harlan <kharlan@wikimedia.org>2023-11-29 10:01:22 +0100
committerKosta Harlan <kharlan@wikimedia.org>2023-12-21 08:39:07 +0100
commit3d4294af3bdc7dad78703ca1e13fde0e206acbfe (patch)
treeb73e9ea02473db8c5bbd651bb3f3b996cb32e638 /includes/DevelopmentSettings.php
parent41bb695a68c4f2d875ae1a54f00846a15a57923f (diff)
downloadmediawikicore-3d4294af3bdc7dad78703ca1e13fde0e206acbfe.tar.gz
mediawikicore-3d4294af3bdc7dad78703ca1e13fde0e206acbfe.zip
composer serve: create and set log directory
Why: - New users will appreciate having easy access to MediaWiki logs; in order to make that easier, we need to have a directory to write to and set an environment variable to use that directory What: - Set MW_LOG_DIR for the `serve` command - Add a `logs` directory at the root of MW, and gitignore it - Create the `logs` directory via DevelopmentSettings, if MW_LOG_DIR is defined but does not exist I considered the `cache` directory for the log location as it already exists, but it seemed preferable to not conflate cache and logs. Bug: T347347 Change-Id: Ic3ddb0203df07a0c93df9f431b25a2a5d9ecc407
Diffstat (limited to 'includes/DevelopmentSettings.php')
-rw-r--r--includes/DevelopmentSettings.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/includes/DevelopmentSettings.php b/includes/DevelopmentSettings.php
index d8346b4e499d..fd4e4b94b8f9 100644
--- a/includes/DevelopmentSettings.php
+++ b/includes/DevelopmentSettings.php
@@ -55,6 +55,9 @@ $wgShowHostnames = true;
// Enable log files
$logDir = getenv( 'MW_LOG_DIR' );
if ( $logDir ) {
+ if ( !file_exists( $logDir ) ) {
+ mkdir( $logDir );
+ }
if ( MW_ENTRY_POINT === 'cli' ) {
$wgDebugLogFile = "$logDir/mw-debug-cli.log";
} else {