r107702 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107701‎ | r107702 | r107703 >
Date:03:58, 31 December 2011
Author:jeroendedauw
Status:resolved (Comments)
Tags:
Comment:
remove old geonames geocoder
Modified paths:
  • /trunk/extensions/Maps/includes/geocoders/Maps_GeonamesOldGeocoder.php (deleted) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/geocoders/Maps_GeonamesOldGeocoder.php
@@ -1,71 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class for geocoding requests with the GeoNames webservice.
6 - * @deprecated
7 - *
8 - * GeoNames Web Services Documentation: http://www.geonames.org/export/geonames-search.html
9 - *
10 - * @file Maps_GeonamesGeocoder.php
11 - * @ingroup Maps
12 - * @ingroup Geocoders
13 - *
14 - * @licence GNU GPL v3
15 - * @author Jeroen De Dauw < jeroendedauw@gmail.com >
16 - *
17 - * Thanks go to Joel Natividad for pointing me to the GeoNames services.
18 - */
19 -final class MapsGeonamesOldGeocoder extends MapsGeocoder {
20 -
21 - /**
22 - * Registeres the geocoder.
23 - *
24 - * No LSB in pre-5.3 PHP *sigh*.
25 - * This is to be refactored as soon as php >=5.3 becomes acceptable.
26 - *
27 - * @since 0.7
28 - */
29 - public static function register() {
30 - global $egMapsGeoNamesUser;
31 -
32 - MapsGeocoders::registerGeocoder( $egMapsGeoNamesUser === '' ? 'geonames' : 'geonamesold', __CLASS__ );
33 -
34 - return true;
35 - }
36 -
37 - /**
38 - * @see MapsGeocoder::getRequestUrl
39 - *
40 - * @since 0.7
41 - *
42 - * @param string $address
43 - *
44 - * @return string
45 - */
46 - protected function getRequestUrl( $address ) {
47 - return 'http://ws.geonames.org/search?q=' . urlencode( $address ) . '&maxRows=1&style=SHORT';
48 - }
49 -
50 - /**
51 - * @see MapsGeocoder::parseResponse
52 - *
53 - * @since 0.7
54 - *
55 - * @param string $address
56 - *
57 - * @return array
58 - */
59 - protected function parseResponse( $response ) {
60 - $lon = self::getXmlElementValue( $response, 'lng' );
61 - $lat = self::getXmlElementValue( $response, 'lat' );
62 -
63 - // In case one of the values is not found, return false.
64 - if ( !$lon || !$lat ) return false;
65 -
66 - return array(
67 - 'lat' => $lat,
68 - 'lon' => $lon
69 - );
70 - }
71 -
72 -}
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r107714FU r107702: Remove deleted class from autoloader too.raymond08:59, 31 December 2011
r107716FU r107702: de-register hook for deleted class tooraymond09:05, 31 December 2011

Comments

#Comment by Raymond (talk | contribs)   08:55, 31 December 2011

PHP Fatal error: require(): Failed opening required '/www/w/extensions/Maps/includes/geocoders/Maps_GeonamesOldGeocoder.php' (include_path='.:/usr/share/php:/usr/share/pear') in /www/w/includes/AutoLoader.php on line 994

#Comment by Raymond (talk | contribs)   09:07, 31 December 2011

Fixed with r107714/r107716

#Comment by Jeroen De Dauw (talk | contribs)   18:21, 31 December 2011

Cool, thnx. I made this change, but apparently I forgot to commit it (or maybe the commit failed).

Status & tagging log