diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2021-11-30 21:58:25 +0100 |
---|---|---|
committer | Ammarpad <ammarpad@yahoo.com> | 2022-01-24 05:38:22 +0000 |
commit | 176122db0b525cbddc2bae73c821b30a6481c036 (patch) | |
tree | 875e8ba458cf02fb8d393d49f6eb7a92e05a7f97 | |
parent | fbb9e2e809db917e078823faa45840845fd2fb68 (diff) |
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
-rw-r--r-- | maintenance/generateSchemaChangeSql.php | 8 | ||||
-rw-r--r-- | 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 ); |