Index: trunk/phase3/includes/Title.php |
— | — | @@ -1221,8 +1221,43 @@ |
1222 | 1222 | ( !$this->isTalkPage() && !$user->isAllowed( 'createpage' ) ) ) { |
1223 | 1223 | $errors[] = $user->isAnon() ? array ('nocreatetext') : array ('nocreate-loggedin'); |
1224 | 1224 | } |
1225 | | - } elseif( $action == 'move' && !( $this->isMovable() && $user->isAllowed( 'move' ) ) ) { |
1226 | | - $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed'); |
| 1225 | + |
| 1226 | + } elseif ( $action == 'move' ) { |
| 1227 | + if ( !$user->isAllowed( 'move' ) ) { |
| 1228 | + // User can't move anything |
| 1229 | + $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed'); |
| 1230 | + } elseif ( !$user->isAllowed( 'move-rootuserpages' ) |
| 1231 | + && $this->getNamespace() == NS_USER && !$this->isSubpage() ) |
| 1232 | + { |
| 1233 | + // Show user page-specific message only if the user can move other pages |
| 1234 | + $errors[] = array( 'cant-move-user-page' ); |
| 1235 | + } |
| 1236 | + |
| 1237 | + // Check for immobile pages |
| 1238 | + if ( !MWNamespace::isMovable( $this->getNamespace() ) ) { |
| 1239 | + // Specific message for this case |
| 1240 | + $errors[] = array( 'immobile-source-namespace', $this->getNsText() ); |
| 1241 | + } elseif ( !$this->isMovable() ) { |
| 1242 | + // Less specific message for rarer cases |
| 1243 | + $errors[] = array( 'immobile-page' ); |
| 1244 | + } |
| 1245 | + |
| 1246 | + } elseif ( $action == 'move-target' ) { |
| 1247 | + if ( !$user->isAllowed( 'move' ) ) { |
| 1248 | + // User can't move anything |
| 1249 | + $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed'); |
| 1250 | + } elseif ( !$user->isAllowed( 'move-rootuserpages' ) |
| 1251 | + && $this->getNamespace() == NS_USER && !$this->isSubpage() ) |
| 1252 | + { |
| 1253 | + // Show user page-specific message only if the user can move other pages |
| 1254 | + $errors[] = array( 'cant-move-to-user-page' ); |
| 1255 | + } |
| 1256 | + if ( !MWNamespace::isMovable( $this->getNamespace() ) ) { |
| 1257 | + $errors[] = array( 'immobile-target-namespace', $this->getNsText() ); |
| 1258 | + } elseif ( !$this->isMovable() ) { |
| 1259 | + $errors[] = array( 'immobile-target-page' ); |
| 1260 | + } |
| 1261 | + |
1227 | 1262 | } elseif ( !$user->isAllowed( $action ) ) { |
1228 | 1263 | $return = null; |
1229 | 1264 | $groups = array_map( array( 'User', 'makeGroupLinkWiki' ), |
— | — | @@ -2380,6 +2415,8 @@ |
2381 | 2416 | * @return \type{\mixed} True on success, getUserPermissionsErrors()-like array on failure |
2382 | 2417 | */ |
2383 | 2418 | public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) { |
| 2419 | + global $wgUser; |
| 2420 | + |
2384 | 2421 | $errors = array(); |
2385 | 2422 | if( !$nt ) { |
2386 | 2423 | // Normally we'd add this to $errors, but we'll get |
— | — | @@ -2389,9 +2426,12 @@ |
2390 | 2427 | if( $this->equals( $nt ) ) { |
2391 | 2428 | $errors[] = array('selfmove'); |
2392 | 2429 | } |
2393 | | - if( !$this->isMovable() || !$nt->isMovable() ) { |
2394 | | - $errors[] = array('immobile_namespace'); |
| 2430 | + if( !$this->isMovable() ) { |
| 2431 | + $errors[] = array( 'immobile-source-namespace', $this->getNsText() ); |
2395 | 2432 | } |
| 2433 | + if ( !$nt->isMovable() ) { |
| 2434 | + $errors[] = array('immobile-target-namespace', $nt->getNsText() ); |
| 2435 | + } |
2396 | 2436 | |
2397 | 2437 | $oldid = $this->getArticleID(); |
2398 | 2438 | $newid = $nt->getArticleID(); |
— | — | @@ -2422,11 +2462,10 @@ |
2423 | 2463 | } |
2424 | 2464 | |
2425 | 2465 | if ( $auth ) { |
2426 | | - global $wgUser; |
2427 | 2466 | $errors = wfArrayMerge($errors, |
2428 | 2467 | $this->getUserPermissionsErrors('move', $wgUser), |
2429 | 2468 | $this->getUserPermissionsErrors('edit', $wgUser), |
2430 | | - $nt->getUserPermissionsErrors('move', $wgUser), |
| 2469 | + $nt->getUserPermissionsErrors('move-target', $wgUser), |
2431 | 2470 | $nt->getUserPermissionsErrors('edit', $wgUser)); |
2432 | 2471 | } |
2433 | 2472 | |
— | — | @@ -2436,7 +2475,6 @@ |
2437 | 2476 | $errors[] = array('spamprotectiontext'); |
2438 | 2477 | } |
2439 | 2478 | |
2440 | | - global $wgUser; |
2441 | 2479 | $err = null; |
2442 | 2480 | if( !wfRunHooks( 'AbortMove', array( $this, $nt, $wgUser, &$err, $reason ) ) ) { |
2443 | 2481 | $errors[] = array('hookaborted', $err); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1128,6 +1128,7 @@ |
1129 | 1129 | // Implicit group for all logged-in accounts |
1130 | 1130 | $wgGroupPermissions['user' ]['move'] = true; |
1131 | 1131 | $wgGroupPermissions['user' ]['move-subpages'] = true; |
| 1132 | +$wgGroupPermissions['user' ]['move-rootuserpages'] = true; // can move root userpages |
1132 | 1133 | $wgGroupPermissions['user' ]['read'] = true; |
1133 | 1134 | $wgGroupPermissions['user' ]['edit'] = true; |
1134 | 1135 | $wgGroupPermissions['user' ]['createpage'] = true; |
— | — | @@ -1166,6 +1167,7 @@ |
1167 | 1168 | $wgGroupPermissions['sysop']['importupload'] = true; |
1168 | 1169 | $wgGroupPermissions['sysop']['move'] = true; |
1169 | 1170 | $wgGroupPermissions['sysop']['move-subpages'] = true; |
| 1171 | +$wgGroupPermissions['sysop']['move-rootuserpages'] = true; |
1170 | 1172 | $wgGroupPermissions['sysop']['patrol'] = true; |
1171 | 1173 | $wgGroupPermissions['sysop']['autopatrol'] = true; |
1172 | 1174 | $wgGroupPermissions['sysop']['protect'] = true; |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2660,7 +2660,11 @@ |
2661 | 2661 | |
2662 | 2662 | In those cases, you will have to move or merge the page manually if desired.", |
2663 | 2663 | 'movearticle' => 'Move page:', |
| 2664 | +'movenologin' => 'Not logged in', |
| 2665 | +'movenologintext' => 'You must be a registered user and [[Special:Userlogin|logged in]] to move a page.', |
2664 | 2666 | 'movenotallowed' => 'You do not have permission to move pages.', |
| 2667 | +'cant-move-user-page' => 'You do not have permission to move user pages (apart from subpages).', |
| 2668 | +'cant-move-to-user-page' => 'You do not have permission to move a page to a user page (except to a user subpage).', |
2665 | 2669 | 'newtitle' => 'To new title:', |
2666 | 2670 | 'move-watch' => 'Watch this page', |
2667 | 2671 | 'movepagebtn' => 'Move page', |
— | — | @@ -2693,8 +2697,10 @@ |
2694 | 2698 | 'delete_and_move_reason' => 'Deleted to make way for move', |
2695 | 2699 | 'selfmove' => 'Source and destination titles are the same; |
2696 | 2700 | cannot move a page over itself.', |
2697 | | -'immobile_namespace' => 'Source or destination title is of a special type; |
2698 | | -cannot move pages from and into that namespace.', |
| 2701 | +'immobile-source-namespace' => 'Cannot move pages in namespace "$1"', |
| 2702 | +'immobile-target-namespace' => 'Cannot move pages into namespace "$1"', |
| 2703 | +'immobile-source-page' => 'This page is not movable.', |
| 2704 | +'immobile-target-page' => 'Cannot move to that destination title.', |
2699 | 2705 | 'imagenocrossnamespace' => 'Cannot move file to non-file namespace', |
2700 | 2706 | 'imagetypemismatch' => 'The new file extension does not match its type', |
2701 | 2707 | 'imageinvalidfilename' => 'The target file name is invalid', |