Merge "Title: Fix subpage move error reporting"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 22 Dec 2016 09:54:07 +0000 (09:54 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 22 Dec 2016 09:54:07 +0000 (09:54 +0000)
includes/Title.php
languages/i18n/en.json
languages/i18n/qqq.json

index 64ff5b4..c4584bd 100644 (file)
@@ -3703,23 +3703,28 @@ class Title implements LinkTarget {
         * @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' ) ) {
-                       return [ 'cant-move-subpages' ];
+                       return [
+                               [ 'cant-move-subpages' ],
+                       ];
                }
                // 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() ) ) {
-                       return [ 'namespace-nosubpages',
-                               MWNamespace::getCanonicalName( $nt->getNamespace() ) ];
+                       return [
+                               [ 'namespace-nosubpages', MWNamespace::getCanonicalName( $nt->getNamespace() ) ],
+                       ];
                }
 
                $subpages = $this->getSubpages( $wgMaximumMovedPages + 1 );
@@ -3728,9 +3733,9 @@ class Title implements LinkTarget {
                foreach ( $subpages as $oldSubpage ) {
                        $count++;
                        if ( $count > $wgMaximumMovedPages ) {
-                               $retval[$oldSubpage->getPrefixedText()] =
-                                               [ 'movepage-max-pages',
-                                                       $wgMaximumMovedPages ];
+                               $retval[$oldSubpage->getPrefixedText()] = [
+                                       [ 'movepage-max-pages', $wgMaximumMovedPages ],
+                               ];
                                break;
                        }
 
index 166140a..e1fdc42 100644 (file)
        "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",
index 3d72f89..e8037c6 100644 (file)
        "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}}",