From 176122db0b525cbddc2bae73c821b30a6481c036 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Tue, 30 Nov 2021 21:58:25 +0100 Subject: Fix maintenance script generateSchemaChangeSql.php on windows Fix // vs. \ issues in file names outputted in comments on the files Also replace /exte Change-Id: I36a36cce8961fd8373fb995599cb45781f11b35f --- maintenance/generateSchemaChangeSql.php | 8 +++++++- maintenance/generateSchemaSql.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/maintenance/generateSchemaChangeSql.php b/maintenance/generateSchemaChangeSql.php index 870dbe04e87f..31587029c95f 100644 --- a/maintenance/generateSchemaChangeSql.php +++ b/maintenance/generateSchemaChangeSql.php @@ -61,7 +61,13 @@ class GenerateSchemaChangeSql extends Maintenance { public function execute() { global $IP; $jsonPath = $this->getOption( 'json' ); - $relativeJsonPath = str_replace( "$IP/", '', $jsonPath ); + $installPath = $IP; + // For windows + if ( DIRECTORY_SEPARATOR === '\\' ) { + $installPath = strtr( $installPath, '\\', '/' ); + $jsonPath = strtr( $jsonPath, '\\', '/' ); + } + $relativeJsonPath = str_replace( "$installPath/", '', $jsonPath ); $sqlPath = $this->getOption( 'sql' ); $abstractSchemaChange = json_decode( file_get_contents( $jsonPath ), true ); diff --git a/maintenance/generateSchemaSql.php b/maintenance/generateSchemaSql.php index 0108be85e85c..14583828603e 100644 --- a/maintenance/generateSchemaSql.php +++ b/maintenance/generateSchemaSql.php @@ -62,8 +62,14 @@ class GenerateSchemaSql extends Maintenance { global $IP; $platform = $this->getOption( 'type', 'mysql' ); $jsonPath = $this->getOption( 'json', __DIR__ . '/tables.json' ); + $installPath = $IP; + // For windows + if ( DIRECTORY_SEPARATOR === '\\' ) { + $installPath = strtr( $installPath, '\\', '/' ); + $jsonPath = strtr( $jsonPath, '\\', '/' ); + } $relativeJsonPath = str_replace( - [ "$IP/extensions/", "$IP/" ], + [ "$installPath/extensions/", "$installPath/" ], '', $jsonPath ); -- cgit v1.2.3