diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index fab9f5f4d..5655f36b6 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -3,9 +3,15 @@ different releases and which versions of PHP and MediaWiki they support, see the [platform compatibility tables](INSTALL.md#platform-compatibility-and-release-status). +## Maps 7.3.2 + +Released on July 25th, 2019. + +* Removed broken geocode API module + ## Maps 7.3.1 -Released on July 20h, 2019. +Released on July 20th, 2019. * Fixed compatibility issue with SMW 3.1+ (thanks @mwjames!) diff --git a/extension.json b/extension.json index 4a09a9914..a631e18d6 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "Maps", - "version": "7.3.1", + "version": "7.3.2", "author": [ "[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]", diff --git a/src/MapsSetup.php b/src/MapsSetup.php index 7f2324c30..d397e6329 100644 --- a/src/MapsSetup.php +++ b/src/MapsSetup.php @@ -6,12 +6,10 @@ use DataValues\Geo\Parsers\LatLongParser; use Maps\DataAccess\JsonFileParser; -use Maps\MediaWiki\Api\Geocode; use Maps\MediaWiki\Content\GeoJsonContent; use Maps\MediaWiki\Content\GeoJsonContentHandler; use Maps\MediaWiki\ParserHooks\CoordinatesFunction; use Maps\MediaWiki\ParserHooks\DisplayMapFunction; -use Maps\MediaWiki\ParserHooks\DisplayMapRenderer; use Maps\MediaWiki\ParserHooks\DistanceFunction; use Maps\MediaWiki\ParserHooks\FindDestinationFunction; use Maps\MediaWiki\ParserHooks\GeocodeFunction; @@ -51,7 +49,6 @@ public function setup() { private function registerAllTheThings() { $this->registerWebResources(); - $this->registerApiModules(); $this->registerParserHooks(); $this->registerMappingServices(); $this->registerPermissions(); @@ -462,8 +459,4 @@ private function registerHooks() { $this->mwGlobals['wgHooks']['MakeGlobalVariablesScript'][] = 'Maps\MediaWiki\MapsHooks::onMakeGlobalVariablesScript'; } - private function registerApiModules() { - $this->mwGlobals['wgAPIModules']['geocode'] = Geocode::class; - } - } diff --git a/src/MediaWiki/Api/ApiGeocode.php b/src/MediaWiki/Api/ApiGeocode.php deleted file mode 100644 index 10a081b94..000000000 --- a/src/MediaWiki/Api/ApiGeocode.php +++ /dev/null @@ -1,79 +0,0 @@ - - */ -class Geocode extends ApiBase { - - public function execute() { - global $wgUser; - - if ( !$wgUser->isAllowed( 'geocode' ) || $wgUser->isBlocked() ) { - $this->dieUsageMsg( [ 'badaccess-groups' ] ); - } - - $geocoder = MapsFactory::newDefault()->getGeocoder(); - - $params = $this->extractRequestParams(); - - $results = []; - - foreach ( array_unique( $params['locations'] ) as $location ) { - $result = $geocoder->geocode( $location ); - - $results[$location] = [ - 'count' => $result === null ? 0 : 1, - 'locations' => [] - ]; - - if ( $result !== null ) { - // FIXME: this makes the API use private var names in its output! - $results[$location]['locations'][] = $result; - } - - $this->getResult()->setIndexedTagName( $results[$location]['locations'], 'location' ); - } - - $this->getResult()->addValue( - null, - 'results', - $results - ); - } - - public function getAllowedParams() { - return [ - 'locations' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => true, - ApiBase::PARAM_ISMULTI => true, - ], - ]; - } - - public function getParamDescription() { - return [ - 'locations' => 'The locations to geocode', - ]; - } - - public function getDescription() { - return [ - 'API module for geocoding.' - ]; - } - - protected function getExamples() { - return [ - 'api.php?action=geocode&locations=new york', - 'api.php?action=geocode&locations=new york|brussels|london', - ]; - } - -}