Skip to content

Commit 4b1d2c4

Browse files
committedDec 6, 2017
fixes ProfessionalWiki#401; resource loading broken when maps not located directory named 'extensions'
1 parent 498d237 commit 4b1d2c4

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed
 

‎Maps.resources.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
return call_user_func( function() {
1515

16-
$pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) );
16+
$pathParts = explode( '/', str_replace( DIRECTORY_SEPARATOR, '/', __DIR__ ) );
1717

1818
$moduleTemplate = [
1919
'position' => 'top',

‎includes/services/GoogleMaps3/GoogleMaps3.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
function () {
2222
global $wgResourceModules;
2323

24-
$pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) );
24+
$pathParts = explode( '/', str_replace( DIRECTORY_SEPARATOR, '/', __DIR__ ) );
25+
$remoteExtPath = implode( DIRECTORY_SEPARATOR, array_slice( $pathParts, -4 ) );
2526

2627
$wgResourceModules['ext.maps.googlemaps3'] = [
2728
'dependencies' => [ 'ext.maps.common' ],
2829
'localBasePath' => __DIR__,
29-
'remoteExtPath' => end( $pathParts ),
30+
'remoteExtPath' => $remoteExtPath,
3031
'group' => 'ext.maps',
3132
'targets' => [
3233
'mobile',
@@ -47,7 +48,7 @@ function () {
4748

4849
$wgResourceModules['ext.maps.gm3.markercluster'] = [
4950
'localBasePath' => __DIR__ . '/gm3-util-library',
50-
'remoteExtPath' => end( $pathParts ),
51+
'remoteExtPath' => $remoteExtPath . '/gm3-util-library',
5152
'group' => 'ext.maps',
5253
'targets' => [
5354
'mobile',
@@ -60,7 +61,7 @@ function () {
6061

6162
$wgResourceModules['ext.maps.gm3.markerwithlabel'] = [
6263
'localBasePath' => __DIR__ . '/gm3-util-library',
63-
'remoteExtPath' => end( $pathParts ),
64+
'remoteExtPath' => $remoteExtPath . '/gm3-util-library',
6465
'group' => 'ext.maps',
6566
'targets' => [
6667
'mobile',
@@ -76,8 +77,8 @@ function () {
7677

7778
$wgResourceModules['ext.maps.gm3.geoxml'] = [
7879
'localBasePath' => __DIR__ . '/geoxml3',
79-
'remoteExtPath' => end( $pathParts ),
80-
'group' => 'ext.maps',
80+
'remoteExtPath' => $remoteExtPath,
81+
'group' => 'ext.maps' . '/geoxml3',
8182
'targets' => [
8283
'mobile',
8384
'desktop'
@@ -91,7 +92,7 @@ function () {
9192

9293
$wgResourceModules['ext.maps.gm3.earth'] = [
9394
'localBasePath' => __DIR__ . '/gm3-util-library',
94-
'remoteExtPath' => end( $pathParts ),
95+
'remoteExtPath' => $remoteExtPath . '/gm3-util-library',
9596
'group' => 'ext.maps',
9697
'targets' => [
9798
'mobile',

‎includes/services/Leaflet/Leaflet.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
function () {
2323
global $wgResourceModules;
2424

25-
$pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) );
25+
$pathParts = explode( '/', str_replace( DIRECTORY_SEPARATOR, '/', __DIR__ ) );
26+
$remoteExtPath = implode( DIRECTORY_SEPARATOR, array_slice( $pathParts, -4 ) );
2627

2728
$wgResourceModules['ext.maps.leaflet'] = [
2829
'dependencies' => [ 'ext.maps.common' ],
2930
'localBasePath' => __DIR__,
30-
'remoteExtPath' => end( $pathParts ),
31+
'remoteExtPath' => $remoteExtPath,
3132
'group' => 'ext.maps',
3233
'targets' => [
3334
'mobile',
@@ -47,7 +48,7 @@ function () {
4748
$wgResourceModules['ext.maps.leaflet.fullscreen'] = [
4849
'dependencies' => [ 'ext.maps.leaflet' ],
4950
'localBasePath' => __DIR__ . '/leaflet.fullscreen',
50-
'remoteExtPath' => end( $pathParts ) . '/leaflet.fullscreen',
51+
'remoteExtPath' => $remoteExtPath . '/leaflet.fullscreen',
5152
'group' => 'ext.maps',
5253
'targets' => [
5354
'mobile',
@@ -64,7 +65,7 @@ function () {
6465
$wgResourceModules['ext.maps.leaflet.markercluster'] = [
6566
'dependencies' => [ 'ext.maps.leaflet' ],
6667
'localBasePath' => __DIR__ . '/leaflet.markercluster',
67-
'remoteExtPath' => end( $pathParts ),
68+
'remoteExtPath' => $remoteExtPath . '/leaflet.markercluster',
6869
'group' => 'ext.maps',
6970
'targets' => [
7071
'mobile',
@@ -81,7 +82,7 @@ function () {
8182
$wgResourceModules['ext.maps.leaflet.providers'] = [
8283
'dependencies' => [ 'ext.maps.leaflet' ],
8384
'localBasePath' => __DIR__ . '/leaflet-providers',
84-
'remoteExtPath' => end( $pathParts ) . '/leaflet-providers',
85+
'remoteExtPath' => $remoteExtPath . '/leaflet-providers',
8586
'group' => 'ext.maps',
8687
'targets' => [
8788
'mobile',

‎includes/services/OpenLayers/OpenLayers.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
function () {
2222
global $wgResourceModules;
2323

24-
$pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) );
24+
$pathParts = explode( '/', str_replace( DIRECTORY_SEPARATOR, '/', __DIR__ ) );
25+
$remoteExtPath = implode( DIRECTORY_SEPARATOR, array_slice( $pathParts, -4 ) );
2526

2627
$wgResourceModules['ext.maps.openlayers'] = [
2728
'dependencies' => [ 'ext.maps.common' ],
2829
'localBasePath' => __DIR__,
29-
'remoteExtPath' => end( $pathParts ),
30+
'remoteExtPath' => $remoteExtPath,
3031
'group' => 'ext.maps',
3132
'targets' => [
3233
'mobile',

0 commit comments

Comments
 (0)