}
function doSubmit() {
- global $wgOut, $wgUser, $wgRequest;
+ global $wgOut, $wgUser, $wgRequest, $wgMaximumMovedPages, $wgLang,
+ $wgNamespacesWithSubpages;
if ( $wgUser->pingLimiter( 'move' ) ) {
$wgOut->rateLimited();
if( $ot->isTalkPage() || $nt->isTalkPage() ) {
$this->moveTalk = false;
}
-
+
+ # If the target namespace doesn't allow subpages, moving with subpages
+ # would mean that you couldn't move them back in one operation, which
+ # is bad.
+ #
+ # FIXME: A specific error message should be given in this case.
+ if( empty( $wgNamespacesWithSubpages[$nt->getNamespace()] ) ) {
+ $this->moveSubpages = false;
+ }
+
# Next make a list of id's. This might be marginally less efficient
# than a more direct method, but this is not a highly performance-cri-
# tical code path and readable code is more important here.
} else {
$conds['page_namespace'] = $ot->getNamespace();
}
+ } elseif( $this->moveTalk ) {
+ $conds = array(
+ 'page_namespace' => MWNamespace::getTalk($ot->getNamespace()),
+ 'page_title' => $ot->getDBKey()
+ );
} else {
- if( $this->moveTalk ) {
- $conds = array(
- 'page_namespace' => MWNamespace::getTalk($ot->getNamespace()),
- 'page_title' => $ot->getDBKey()
- );
- } else {
- # Skip the query
- $conds = null;
- }
+ # Skip the query
+ $conds = null;
}
if( !is_null( $conds ) ) {
);
}
- global $wgMaximumMovedPages, $wgLang;
$extraOutput = array();
$skin = $wgUser->getSkin();
$count = 1;
*/
public function getSubpageText() {
global $wgNamespacesWithSubpages;
- if( isset( $wgNamespacesWithSubpages[ $this->mNamespace ] ) && $wgNamespacesWithSubpages[ $this->mNamespace ] ) {
+ if( !empty( $wgNamespacesWithSubpages[ $this->mNamespace ] ) ) {
$parts = explode( '/', $this->mTextform );
return( $parts[ count( $parts ) - 1 ] );
} else {
public function isSubpage() {
global $wgNamespacesWithSubpages;
- if( isset( $wgNamespacesWithSubpages[ $this->mNamespace ] ) ) {
- return ( strpos( $this->getText(), '/' ) !== false && $wgNamespacesWithSubpages[ $this->mNamespace ] == true );
+ if( !empty( $wgNamespacesWithSubpages[ $this->mNamespace ] ) ) {
+ return strpos( $this->getText(), '/' ) !== false;
} else {
return false;
}
public function hasSubpages() {
global $wgNamespacesWithSubpages;
- if( !isset( $wgNamespacesWithSubpages[$this->mNamespace] ) ) {
+ if( empty( $wgNamespacesWithSubpages[$this->mNamespace] ) ) {
# Duh
return false;
}