Title::moveSubpages() sometimes returns a single message-specifier array
and sometimes returns an array of such arrays. This is extremely
difficult for a caller to deal with. Since nothing in Gerrit other than
ApiMove calls this, let's just fix it.
Also, it seems that messages were never created for the errors returned
by this method. So let's create them.
Change-Id: I4e55483c4476a1bb96c87266a4661871776fbf9b
* @param bool $createRedirect Whether to create redirects from the old subpages to
* the new ones Ignored if the user doesn't have the 'suppressredirect' right
* @return array Array with old page titles as keys, and strings (new page titles) or
* @param bool $createRedirect Whether to create redirects from the old subpages to
* the new ones Ignored if the user doesn't have the 'suppressredirect' right
* @return array Array with old page titles as keys, and strings (new page titles) or
- * arrays (errors) as values, or an error array with numeric indices if no pages
- * were moved
+ * getUserPermissionsErrors()-like arrays (errors) as values, or a
+ * getUserPermissionsErrors()-like error array with numeric indices if
+ * no pages were moved
*/
public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true ) {
global $wgMaximumMovedPages;
// Check permissions
if ( !$this->userCan( 'move-subpages' ) ) {
*/
public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true ) {
global $wgMaximumMovedPages;
// Check permissions
if ( !$this->userCan( 'move-subpages' ) ) {
- return [ 'cant-move-subpages' ];
+ return [
+ [ 'cant-move-subpages' ],
+ ];
}
// Do the source and target namespaces support subpages?
if ( !MWNamespace::hasSubpages( $this->getNamespace() ) ) {
}
// Do the source and target namespaces support subpages?
if ( !MWNamespace::hasSubpages( $this->getNamespace() ) ) {
- return [ 'namespace-nosubpages',
- MWNamespace::getCanonicalName( $this->getNamespace() ) ];
+ return [
+ [ 'namespace-nosubpages', MWNamespace::getCanonicalName( $this->getNamespace() ) ],
+ ];
}
if ( !MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
}
if ( !MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
- return [ 'namespace-nosubpages',
- MWNamespace::getCanonicalName( $nt->getNamespace() ) ];
+ return [
+ [ 'namespace-nosubpages', MWNamespace::getCanonicalName( $nt->getNamespace() ) ],
+ ];
}
$subpages = $this->getSubpages( $wgMaximumMovedPages + 1 );
}
$subpages = $this->getSubpages( $wgMaximumMovedPages + 1 );
foreach ( $subpages as $oldSubpage ) {
$count++;
if ( $count > $wgMaximumMovedPages ) {
foreach ( $subpages as $oldSubpage ) {
$count++;
if ( $count > $wgMaximumMovedPages ) {
- $retval[$oldSubpage->getPrefixedText()] =
- [ 'movepage-max-pages',
- $wgMaximumMovedPages ];
+ $retval[$oldSubpage->getPrefixedText()] = [
+ [ 'movepage-max-pages', $wgMaximumMovedPages ],
+ ];
"cant-move-to-user-page": "You do not have permission to move a page to a user page (except to a user subpage).",
"cant-move-category-page": "You do not have permission to move category pages.",
"cant-move-to-category-page": "You do not have permission to move a page to a category page.",
"cant-move-to-user-page": "You do not have permission to move a page to a user page (except to a user subpage).",
"cant-move-category-page": "You do not have permission to move category pages.",
"cant-move-to-category-page": "You do not have permission to move a page to a category page.",
+ "cant-move-subpages": "You do not have permission to move subpages.",
+ "namespace-nosubpages": "Namespace \"$1\" does not allow subpages.",
+ "movepage-max-pages": "The source page has more than the maximum $1 {{PLURAL:$1|subpage|subpages}}.",
"newtitle": "New title:",
"move-watch": "Watch source page and target page",
"movepagebtn": "Move page",
"newtitle": "New title:",
"move-watch": "Watch source page and target page",
"movepagebtn": "Move page",
"cant-move-to-user-page": "Used as error message.\n\nSee also:\n* {{msg-mw|cant-move-user-page}}\n* {{msg-mw|cant-move-category-page}}\n* {{msg-mw|cant-move-to-category-page}}\n* {{msg-mw|movenotallowedfile}}\n* {{msg-mw|movenotallowed}}\n* {{msg-mw|movenologintext}}",
"cant-move-category-page": "Used as error message.\n\nSee also:\n* {{msg-mw|cant-move-user-page}}\n* {{msg-mw|cant-move-to-user-page}}\n* {{msg-mw|cant-move-to-category-page}}\n* {{msg-mw|movenotallowedfile}}\n* {{msg-mw|movenotallowed}}\n* {{msg-mw|movenologintext}}",
"cant-move-to-category-page": "Used as error message.\n\nSee also:\n* {{msg-mw|cant-move-user-page}}\n* {{msg-mw|cant-move-to-user-page}}\n* {{msg-mw|cant-move-category-page}}\n* {{msg-mw|movenotallowedfile}}\n* {{msg-mw|movenotallowed}}\n* {{msg-mw|movenologintext}}",
"cant-move-to-user-page": "Used as error message.\n\nSee also:\n* {{msg-mw|cant-move-user-page}}\n* {{msg-mw|cant-move-category-page}}\n* {{msg-mw|cant-move-to-category-page}}\n* {{msg-mw|movenotallowedfile}}\n* {{msg-mw|movenotallowed}}\n* {{msg-mw|movenologintext}}",
"cant-move-category-page": "Used as error message.\n\nSee also:\n* {{msg-mw|cant-move-user-page}}\n* {{msg-mw|cant-move-to-user-page}}\n* {{msg-mw|cant-move-to-category-page}}\n* {{msg-mw|movenotallowedfile}}\n* {{msg-mw|movenotallowed}}\n* {{msg-mw|movenologintext}}",
"cant-move-to-category-page": "Used as error message.\n\nSee also:\n* {{msg-mw|cant-move-user-page}}\n* {{msg-mw|cant-move-to-user-page}}\n* {{msg-mw|cant-move-category-page}}\n* {{msg-mw|movenotallowedfile}}\n* {{msg-mw|movenotallowed}}\n* {{msg-mw|movenologintext}}",
+ "cant-move-subpages": "Used as an error message.",
+ "namespace-nosubpages": "Used as an error message. Parameters:\n* $1 - Namespace name.",
+ "movepage-max-pages": "Used as an error message. Parameters:\n* $1 - Maximum number of subpages allowed.",
"newtitle": "Used in the special page \"[[Special:MovePage]]\". The text for the inputbox to give the new page title.\n\nSee also:\n* {{msg-mw|Move-page-legend|legend for the form}}\n* {{msg-mw|Movereason|label for textarea}}\n* {{msg-mw|Movetalk|label for checkbox}}\n* {{msg-mw|Move-leave-redirect|label for checkbox}}\n* {{msg-mw|Fix-double-redirects|label for checkbox}}\n* {{msg-mw|Move-subpages|label for checkbox}}\n* {{msg-mw|Move-talk-subpages|label for checkbox}}\n* {{msg-mw|Move-watch|label for checkbox}}",
"move-watch": "The text of the checkbox to watch the pages you are moving from and to. If checked, both the destination page and the original page will be added to the watchlist, even if you decide not to leave a redirect behind.\n\nSee also:\n* {{msg-mw|Move-page-legend|legend for the form}}\n* {{msg-mw|newtitle|label for new title}}\n* {{msg-mw|Movereason|label for textarea}}\n* {{msg-mw|Movetalk|label for checkbox}}\n* {{msg-mw|Move-leave-redirect|label for checkbox}}\n* {{msg-mw|Fix-double-redirects|label for checkbox}}\n* {{msg-mw|Move-subpages|label for checkbox}}\n* {{msg-mw|Move-talk-subpages|label for checkbox}}",
"movepagebtn": "Button label on the special 'Move page'.\n\n{{Identical|Move page}}",
"newtitle": "Used in the special page \"[[Special:MovePage]]\". The text for the inputbox to give the new page title.\n\nSee also:\n* {{msg-mw|Move-page-legend|legend for the form}}\n* {{msg-mw|Movereason|label for textarea}}\n* {{msg-mw|Movetalk|label for checkbox}}\n* {{msg-mw|Move-leave-redirect|label for checkbox}}\n* {{msg-mw|Fix-double-redirects|label for checkbox}}\n* {{msg-mw|Move-subpages|label for checkbox}}\n* {{msg-mw|Move-talk-subpages|label for checkbox}}\n* {{msg-mw|Move-watch|label for checkbox}}",
"move-watch": "The text of the checkbox to watch the pages you are moving from and to. If checked, both the destination page and the original page will be added to the watchlist, even if you decide not to leave a redirect behind.\n\nSee also:\n* {{msg-mw|Move-page-legend|legend for the form}}\n* {{msg-mw|newtitle|label for new title}}\n* {{msg-mw|Movereason|label for textarea}}\n* {{msg-mw|Movetalk|label for checkbox}}\n* {{msg-mw|Move-leave-redirect|label for checkbox}}\n* {{msg-mw|Fix-double-redirects|label for checkbox}}\n* {{msg-mw|Move-subpages|label for checkbox}}\n* {{msg-mw|Move-talk-subpages|label for checkbox}}",
"movepagebtn": "Button label on the special 'Move page'.\n\n{{Identical|Move page}}",