Index: trunk/phase3/includes/SpecialMovepage.php |
— | — | @@ -237,7 +237,8 @@ |
238 | 238 | } |
239 | 239 | |
240 | 240 | function doSubmit() { |
241 | | - global $wgOut, $wgUser, $wgRequest; |
| 241 | + global $wgOut, $wgUser, $wgRequest, $wgMaximumMovedPages, $wgLang, |
| 242 | + $wgNamespacesWithSubpages; |
242 | 243 | |
243 | 244 | if ( $wgUser->pingLimiter( 'move' ) ) { |
244 | 245 | $wgOut->rateLimited(); |
— | — | @@ -302,7 +303,16 @@ |
303 | 304 | if( $ot->isTalkPage() || $nt->isTalkPage() ) { |
304 | 305 | $this->moveTalk = false; |
305 | 306 | } |
306 | | - |
| 307 | + |
| 308 | + # If the target namespace doesn't allow subpages, moving with subpages |
| 309 | + # would mean that you couldn't move them back in one operation, which |
| 310 | + # is bad. |
| 311 | + # |
| 312 | + # FIXME: A specific error message should be given in this case. |
| 313 | + if( empty( $wgNamespacesWithSubpages[$nt->getNamespace()] ) ) { |
| 314 | + $this->moveSubpages = false; |
| 315 | + } |
| 316 | + |
307 | 317 | # Next make a list of id's. This might be marginally less efficient |
308 | 318 | # than a more direct method, but this is not a highly performance-cri- |
309 | 319 | # tical code path and readable code is more important here. |
— | — | @@ -321,16 +331,14 @@ |
322 | 332 | } else { |
323 | 333 | $conds['page_namespace'] = $ot->getNamespace(); |
324 | 334 | } |
| 335 | + } elseif( $this->moveTalk ) { |
| 336 | + $conds = array( |
| 337 | + 'page_namespace' => MWNamespace::getTalk($ot->getNamespace()), |
| 338 | + 'page_title' => $ot->getDBKey() |
| 339 | + ); |
325 | 340 | } else { |
326 | | - if( $this->moveTalk ) { |
327 | | - $conds = array( |
328 | | - 'page_namespace' => MWNamespace::getTalk($ot->getNamespace()), |
329 | | - 'page_title' => $ot->getDBKey() |
330 | | - ); |
331 | | - } else { |
332 | | - # Skip the query |
333 | | - $conds = null; |
334 | | - } |
| 341 | + # Skip the query |
| 342 | + $conds = null; |
335 | 343 | } |
336 | 344 | |
337 | 345 | if( !is_null( $conds ) ) { |
— | — | @@ -342,7 +350,6 @@ |
343 | 351 | ); |
344 | 352 | } |
345 | 353 | |
346 | | - global $wgMaximumMovedPages, $wgLang; |
347 | 354 | $extraOutput = array(); |
348 | 355 | $skin = $wgUser->getSkin(); |
349 | 356 | $count = 1; |
Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | 'id' => $ns |
114 | 114 | ); |
115 | 115 | ApiResult :: setContent($data[$ns], $title); |
116 | | - if(@$wgNamespacesWithSubpages[$ns]) |
| 116 | + if(!empty($wgNamespacesWithSubpages[$ns])) |
117 | 117 | $data[$ns]['subpages'] = ''; |
118 | 118 | } |
119 | 119 | |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -715,7 +715,7 @@ |
716 | 716 | */ |
717 | 717 | public function getSubpageText() { |
718 | 718 | global $wgNamespacesWithSubpages; |
719 | | - if( isset( $wgNamespacesWithSubpages[ $this->mNamespace ] ) && $wgNamespacesWithSubpages[ $this->mNamespace ] ) { |
| 719 | + if( !empty( $wgNamespacesWithSubpages[ $this->mNamespace ] ) ) { |
720 | 720 | $parts = explode( '/', $this->mTextform ); |
721 | 721 | return( $parts[ count( $parts ) - 1 ] ); |
722 | 722 | } else { |
— | — | @@ -1496,8 +1496,8 @@ |
1497 | 1497 | public function isSubpage() { |
1498 | 1498 | global $wgNamespacesWithSubpages; |
1499 | 1499 | |
1500 | | - if( isset( $wgNamespacesWithSubpages[ $this->mNamespace ] ) ) { |
1501 | | - return ( strpos( $this->getText(), '/' ) !== false && $wgNamespacesWithSubpages[ $this->mNamespace ] == true ); |
| 1500 | + if( !empty( $wgNamespacesWithSubpages[ $this->mNamespace ] ) ) { |
| 1501 | + return strpos( $this->getText(), '/' ) !== false; |
1502 | 1502 | } else { |
1503 | 1503 | return false; |
1504 | 1504 | } |
— | — | @@ -1510,7 +1510,7 @@ |
1511 | 1511 | public function hasSubpages() { |
1512 | 1512 | global $wgNamespacesWithSubpages; |
1513 | 1513 | |
1514 | | - if( !isset( $wgNamespacesWithSubpages[$this->mNamespace] ) ) { |
| 1514 | + if( empty( $wgNamespacesWithSubpages[$this->mNamespace] ) ) { |
1515 | 1515 | # Duh |
1516 | 1516 | return false; |
1517 | 1517 | } |