Index: trunk/extensions/GeoData/GeoData.php |
— | — | @@ -42,3 +42,7 @@ |
43 | 43 | */ |
44 | 44 | $wgDefaultGlobe = 'earth'; |
45 | 45 | |
| 46 | +/** |
| 47 | + * Maximum number of coordinates per page |
| 48 | + */ |
| 49 | +$wgMaxCoordinatesPerPage = 50; |
Index: trunk/extensions/GeoData/GeoDataHooks.php |
— | — | @@ -82,7 +82,13 @@ |
83 | 83 | $parser->getTitle()->getText() |
84 | 84 | ); |
85 | 85 | } |
86 | | - return array( "<span class=\"error\">{$status->getWikiText()}</span>", 'noparse' => false ); |
| 86 | + $errorText = $status->getWikiText(); |
| 87 | + if ( $errorText == '<>' ) { |
| 88 | + // Error condition that doesn't require a message, |
| 89 | + // can't think of a better way to pass this condition |
| 90 | + return ''; |
| 91 | + } |
| 92 | + return array( "<span class=\"error\">{$errorText}</span>", 'noparse' => false ); |
87 | 93 | } |
88 | 94 | |
89 | 95 | /** |
— | — | @@ -95,6 +101,7 @@ |
96 | 102 | 'primary' => false, |
97 | 103 | 'secondary' => array(), |
98 | 104 | 'failures' => false, |
| 105 | + 'limitExceeded' => false, |
99 | 106 | ); |
100 | 107 | } |
101 | 108 | } |
— | — | @@ -107,6 +114,15 @@ |
108 | 115 | * @return Status: whether save went OK |
109 | 116 | */ |
110 | 117 | private static function applyCoord( ParserOutput $output, Coord $coord ) { |
| 118 | + global $wgMaxCoordinatesPerPage; |
| 119 | + $count = count( $output->geoData['secondary'] ) + $output->geoData['primary'] ? 1 : 0; |
| 120 | + if ( $count >= $wgMaxCoordinatesPerPage ) { |
| 121 | + if ( $output->geoData['limitExceeded'] ) { |
| 122 | + return Status::newFatal( '' ); |
| 123 | + } |
| 124 | + $output->geoData['limitExceeded'] = true; |
| 125 | + return Status::newFatal( 'geodata-limit-exceeded' ); |
| 126 | + } |
111 | 127 | if ( $coord->primary ) { |
112 | 128 | if ( $output->geoData['primary'] ) { |
113 | 129 | $output->geoData['secondary'][] = $coord; |