Merge "Disallow empty paths in LockManager"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 27 Jul 2018 10:04:02 +0000 (10:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 27 Jul 2018 10:04:02 +0000 (10:04 +0000)
52 files changed:
.phpcs.xml
INSTALL
RELEASE-NOTES-1.32
composer.json
docs/hooks.txt
img_auth.php
includes/DefaultSettings.php
includes/EditPage.php
includes/MWGrants.php
includes/Revision.php
includes/Status.php
includes/Storage/DerivedPageDataUpdater.php
includes/Storage/RevisionSlots.php
includes/Storage/RevisionStore.php
includes/Title.php
includes/actions/HistoryAction.php
includes/deferred/LinksUpdate.php
includes/diff/DifferenceEngine.php
includes/htmlform/fields/HTMLSelectAndOtherField.php
includes/htmlform/fields/HTMLSelectOrOtherField.php
includes/installer/Installer.php
includes/installer/MssqlUpdater.php
includes/installer/WebInstallerName.php
includes/libs/http/HttpAcceptParser.php
includes/libs/lockmanager/DBLockManager.php
includes/libs/objectcache/BagOStuff.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/IDatabase.php
includes/linkeddata/PageDataRequestHandler.php
includes/logging/LogEventsList.php
includes/parser/ParserOptions.php
includes/site/DBSiteStore.php
includes/user/User.php
includes/utils/UIDGenerator.php
includes/widget/SelectWithInputWidget.php
languages/i18n/en.json
languages/i18n/qqq.json
maintenance/createAndPromote.php
maintenance/mssql/archives/patch-actor-table.sql
maintenance/mssql/archives/patch-comment-table.sql
maintenance/mssql/archives/patch-content.sql
maintenance/mssql/archives/patch-slots.sql
maintenance/mssql/tables.sql
maintenance/oracle/archives/patch-actor-table.sql
maintenance/oracle/archives/patch-comment-table.sql
maintenance/oracle/tables.sql
tests/parser/ParserTestRunner.php
tests/phpunit/includes/GlobalFunctions/WfExpandUrlTest.php [new file with mode: 0644]
tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php [deleted file]
tests/phpunit/includes/user/UserTest.php
tests/phpunit/structure/AvailableRightsTest.php
tests/phpunit/suites/ParserTestTopLevelSuite.php

index 8d33f69..2a34154 100644 (file)
@@ -2,6 +2,7 @@
 <ruleset name="MediaWiki">
        <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
                <exclude name="Generic.ControlStructures.InlineControlStructure" />
+               <exclude name="MediaWiki.Commenting.FunctionAnnotations.UnrecognizedAnnotation" />
                <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
                <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
                <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
                <exclude name="MediaWiki.Commenting.IllegalSingleLineComment.IllegalSingleLineCommentStart" />
                <exclude name="MediaWiki.Commenting.IllegalSingleLineComment.IllegalSingleLineCommentEnd" />
                <exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
+               <exclude name="MediaWiki.Commenting.MissingCovers.MissingCovers" />
                <exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
-               <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
-               <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.SingleSpaceBeforeSingleLineComment" />
                <exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
                <exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
+               <exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
                <exclude name="MediaWiki.VariableAnalysis.ForbiddenGlobalVariables.ForbiddenGlobal$wgTitle" />
+               <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
+               <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.SingleSpaceBeforeSingleLineComment" />
                <exclude name="Squiz.Scope.MethodScope.Missing" />
                <exclude name="Squiz.Scope.MemberVarScope.Missing" />
-               <exclude name="MediaWiki.Commenting.MissingCovers.MissingCovers" />
        </rule>
        <rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
                <properties>
                        <property name="ignoreList" type="array" value="$IP,$messageMemc" />
                </properties>
        </rule>
+       <rule ref="MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix">
+               <exclude-pattern>profileinfo\.php</exclude-pattern>
+               <exclude-pattern>maintenance/language/checkLanguage\.inc</exclude-pattern>
+               <exclude-pattern>maintenance/doMaintenance\.php</exclude-pattern>
+               <exclude-pattern>maintenance/mergeMessageFileList\.php</exclude-pattern>
+               <exclude-pattern>maintenance/commandLine\.inc</exclude-pattern>
+       </rule>
        <rule ref="Generic.Files.LineLength">
                <exclude-pattern>*/languages/messages/Messages*\.php</exclude-pattern>
        </rule>
diff --git a/INSTALL b/INSTALL
index 91dcbea..d68342c 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -17,9 +17,6 @@ Required software:
 MediaWiki is developed and tested mainly on Unix/Linux platforms, but should
 work on Windows as well.
 
-If your PHP is configured as a CGI plug-in rather than an Apache module you may
-experience problems, as this configuration is not well tested.
-
 Support for rendering mathematical formulas requires installing the Math extension,
 see https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Math
 
index c91ae7d..0ffbdea 100644 (file)
@@ -29,6 +29,14 @@ production.
 * The archive table's ar_rev_id field is now unique.
 * Special:BotPasswords now requires reauthentication.
 * (T194414) The default watchlist view time has been increased from 3 to 7 days.
+* The right to edit sitewide Javascript (e.g. MediaWiki:Common.js), CSS or JSON
+  was separated from 'editinterface' and is available under
+  'editsitejs'/'editsitecss'/'editsitejson'. Having 'editinterface' is still
+  necessary to edit such pages.
+* A new user group, 'interface-admin', is added for controlling access to
+  sitewide CSS/JS (and editing other users' CSS/JS). No other group has
+  'editsitecss', 'editusercss', 'editsitejs' or 'edituserjs' by default.
+* A new grant group, 'editsiteconfig', is added for granting the above rights.
 
 === New features in 1.32 ===
 * (T112474) Generalized the ResourceLoader mechanism for overriding modules
@@ -56,6 +64,8 @@ production.
 * Added new 'OutputPageAfterGetHeadLinksArray' hook, allowing extensions to
   modify the return value of OutputPage#getHeadLinksArray in order to add,
   remove or otherwise alter the elements to be output in the page <head>.
+* (T28934) The 'HistoryPageToolLinks' hook allows extensions to append
+  additional links to the subtitle of a history page.
 
 === External library changes in 1.32 ===
 * …
@@ -65,6 +75,8 @@ production.
 * Updated wikimedia/scoped-callback from 1.0.0 to 2.0.0.
 ** ScopedCallback objects can no longer be serialized.
 * Updated wikimedia/wrappedstring from 2.3.0 to 3.0.1.
+* Updated mediawiki/mediawiki-codesniffer from v20.0.0 to v21.0.0.
+* Updated composer/spdx-licenses from 1.3.0 to 1.4.0.
 
 ==== New external libraries ====
 * Added wikimedia/xmp-reader 0.5.1
@@ -287,6 +299,8 @@ because of Phabricator reports.
   mNewPage, mOldContent, mNewContent, mRevisionsLoaded, mTextLoaded and
   mCacheHit is deprecated. Use getOldid() / getNewid() for the first two,
   do your own lookup for page/content. mNewRev / mOldRev remains public.
+* The $wgExternalDiffEngine value 'wikidiff2' is deprecated. To use wikidiff2
+  just enable the PHP extension, and it will be autodetected.
 
 === Other changes in 1.32 ===
 * (T198811) The following tables have had their UNIQUE indexes turned into
index b16983f..dbc59a2 100644 (file)
        },
        "require-dev": {
                "cache/integration-tests": "0.16.0",
-               "composer/spdx-licenses": "1.3.0",
+               "composer/spdx-licenses": "1.4.0",
                "hamcrest/hamcrest-php": "^2.0",
                "jakub-onderka/php-parallel-lint": "0.9.2",
-               "jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
+               "jetbrains/phpstorm-stubs": "dev-master#38ff1a581b297f7901e961b8c923862ea80c3b96",
                "justinrainbow/json-schema": "~5.2",
-               "mediawiki/mediawiki-codesniffer": "20.0.0",
+               "mediawiki/mediawiki-codesniffer": "21.0.0",
                "monolog/monolog": "~1.22.1",
                "nikic/php-parser": "3.1.3",
                "seld/jsonlint": "1.7.1",
index 40777da..251bea6 100644 (file)
@@ -1823,6 +1823,11 @@ $rev: Revision object
 $prevRev: Revision object, next in line in page history, or null
 $user: Current user object
 
+'HistoryPageToolLinks': Add one or more links to revision history page subtitle.
+$context: IContextSource (object)
+$linkRenderer: LinkRenderer instance
+&$links: Array of HTML strings
+
 'HTMLFileCache::useFileCache': Override whether a page should be cached in file
 cache.
 $context: An IContextSource object with information about the request being
index 2052809..ca69d31 100644 (file)
@@ -17,7 +17,8 @@
  *  just that it was. If you want to change this, you can set $wgImgAuthDetails to 'true'
  *  in localsettings.php and it will give the user the reason why access was denied.
  *
- * Your server needs to support PATH_INFO; CGI-based configurations usually don't.
+ * Your server needs to support REQUEST_URI or PATH_INFO; CGI-based
+ * configurations sometimes don't.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 13d5368..a3fdcfc 100644 (file)
@@ -4548,6 +4548,12 @@ $wgPasswordPolicy = [
                        'PasswordCannotMatchUsername' => true,
                        'PasswordCannotBePopular' => 25,
                ],
+               'interface-admin' => [
+                       'MinimalPasswordLength' => 8,
+                       'MinimumPasswordLengthToLogin' => 1,
+                       'PasswordCannotMatchUsername' => true,
+                       'PasswordCannotBePopular' => 25,
+               ],
                'bot' => [
                        'MinimalPasswordLength' => 8,
                        'MinimumPasswordLengthToLogin' => 1,
@@ -5217,9 +5223,8 @@ $wgGroupPermissions['sysop']['deletedhistory'] = true;
 $wgGroupPermissions['sysop']['deletedtext'] = true;
 $wgGroupPermissions['sysop']['undelete'] = true;
 $wgGroupPermissions['sysop']['editinterface'] = true;
-$wgGroupPermissions['sysop']['editusercss'] = true;
+$wgGroupPermissions['sysop']['editsitejson'] = true;
 $wgGroupPermissions['sysop']['edituserjson'] = true;
-$wgGroupPermissions['sysop']['edituserjs'] = true;
 $wgGroupPermissions['sysop']['import'] = true;
 $wgGroupPermissions['sysop']['importupload'] = true;
 $wgGroupPermissions['sysop']['move'] = true;
@@ -5252,6 +5257,14 @@ $wgGroupPermissions['sysop']['mergehistory'] = true;
 $wgGroupPermissions['sysop']['managechangetags'] = true;
 $wgGroupPermissions['sysop']['deletechangetags'] = true;
 
+$wgGroupPermissions['interface-admin']['editinterface'] = true;
+$wgGroupPermissions['interface-admin']['editsitecss'] = true;
+$wgGroupPermissions['interface-admin']['editsitejson'] = true;
+$wgGroupPermissions['interface-admin']['editsitejs'] = true;
+$wgGroupPermissions['interface-admin']['editusercss'] = true;
+$wgGroupPermissions['interface-admin']['edituserjson'] = true;
+$wgGroupPermissions['interface-admin']['edituserjs'] = true;
+
 // Permission to change users' group assignments
 $wgGroupPermissions['bureaucrat']['userrights'] = true;
 $wgGroupPermissions['bureaucrat']['noratelimit'] = true;
@@ -5858,9 +5871,14 @@ $wgGrantPermissions['editmyoptions']['editmyoptions'] = true;
 
 $wgGrantPermissions['editinterface'] = $wgGrantPermissions['editpage'];
 $wgGrantPermissions['editinterface']['editinterface'] = true;
-$wgGrantPermissions['editinterface']['editusercss'] = true;
 $wgGrantPermissions['editinterface']['edituserjson'] = true;
-$wgGrantPermissions['editinterface']['edituserjs'] = true;
+$wgGrantPermissions['editinterface']['editsitejson'] = true;
+
+$wgGrantPermissions['editsiteconfig'] = $wgGrantPermissions['editinterface'];
+$wgGrantPermissions['editsiteconfig']['editusercss'] = true;
+$wgGrantPermissions['editsiteconfig']['edituserjs'] = true;
+$wgGrantPermissions['editsiteconfig']['editsitecss'] = true;
+$wgGrantPermissions['editsiteconfig']['editsitejs'] = true;
 
 $wgGrantPermissions['createeditmovepage'] = $wgGrantPermissions['editpage'];
 $wgGrantPermissions['createeditmovepage']['createpage'] = true;
@@ -5939,6 +5957,7 @@ $wgGrantPermissionGroups = [
        'editmyoptions'       => 'customization',
 
        'editinterface'       => 'administration',
+       'editsiteconfig'      => 'administration',
        'rollback'            => 'administration',
        'blockusers'          => 'administration',
        'delete'              => 'administration',
index a1cf3e2..16f1c5a 100644 (file)
@@ -2361,7 +2361,7 @@ ERROR;
         * Returns the revision that was current at the time editing was initiated on the client,
         * even if the edit was based on an old revision.
         *
-        * @warning: this method is very poorly named. If the user opened the form with ?oldid=X,
+        * @warning this method is very poorly named. If the user opened the form with ?oldid=X,
         *        one might think of X as the "base revision", which is NOT what this returns,
         *        see oldid for that. One might further assume that this corresponds to the $baseRevId
         *        parameter of WikiPage::doEditContent, which is not the case either.
index ba22590..769e5b4 100644 (file)
@@ -58,11 +58,11 @@ class MWGrants {
                // Give grep a chance to find the usages:
                // grant-blockusers, grant-createeditmovepage, grant-delete,
                // grant-editinterface, grant-editmycssjs, grant-editmywatchlist,
-               // grant-editpage, grant-editprotected, grant-highvolume,
-               // grant-oversight, grant-patrol, grant-protect, grant-rollback,
-               // grant-sendemail, grant-uploadeditmovefile, grant-uploadfile,
-               // grant-basic, grant-viewdeleted, grant-viewmywatchlist,
-               // grant-createaccount
+               // grant-editsiteconfig, grant-editpage, grant-editprotected,
+               // grant-highvolume, grant-oversight, grant-patrol, grant-protect,
+               // grant-rollback, grant-sendemail, grant-uploadeditmovefile,
+               // grant-uploadfile, grant-basic, grant-viewdeleted,
+               // grant-viewmywatchlist, grant-createaccount
                $msg = wfMessage( "grant-$grant" );
                if ( $lang !== null ) {
                        if ( is_string( $lang ) ) {
index d6ff384..7ff73dd 100644 (file)
@@ -739,7 +739,7 @@ class Revision implements IDBAccessObject {
        /**
         * Set the title of the revision
         *
-        * @deprecated: since 1.31, this is now a noop. Pass the Title to the constructor instead.
+        * @deprecated since 1.31, this is now a noop. Pass the Title to the constructor instead.
         *
         * @param Title $title
         */
@@ -927,7 +927,7 @@ class Revision implements IDBAccessObject {
         * used to determine the content model to use. If no title is know, CONTENT_MODEL_WIKITEXT
         * is used as a last resort.
         *
-        * @todo: drop this, with MCR, there no longer is a single model associated with a revision.
+        * @todo drop this, with MCR, there no longer is a single model associated with a revision.
         *
         * @return string The content model id associated with this revision,
         *     see the CONTENT_MODEL_XXX constants.
@@ -942,7 +942,7 @@ class Revision implements IDBAccessObject {
         * If no content format was stored in the database, the default format for this
         * revision's content model is returned.
         *
-        * @todo: drop this, the format is irrelevant to the revision!
+        * @todo drop this, the format is irrelevant to the revision!
         *
         * @return string The content format id associated with this revision,
         *     see the CONTENT_FORMAT_XXX constants.
index 8cd72a5..877d221 100644 (file)
@@ -359,7 +359,7 @@ class Status extends StatusValue {
        /**
         * Returns a list of status messages of the given type (or all if false)
         *
-        * @note: this handles RawMessage poorly
+        * @note this handles RawMessage poorly
         *
         * @param string|bool $type
         * @return array
index 73463b5..6f241ba 100644 (file)
@@ -679,11 +679,11 @@ class DerivedPageDataUpdater implements IDBAccessObject {
         *
         * @see docs/pageupdater.txt for more information on when thie method can and should be called.
         *
-        * @note: Calling this method more than once with the same $slotsUpdate
+        * @note Calling this method more than once with the same $slotsUpdate
         * has no effect. Calling this method multiple times with different content will cause
         * an exception.
         *
-        * @note: Calling this method after prepareUpdate() has been called will cause an exception.
+        * @note Calling this method after prepareUpdate() has been called will cause an exception.
         *
         * @param User $user The user to act as context for pre-save transformation (PST).
         *        Type hint should be reduced to UserIdentity at some point.
@@ -826,7 +826,7 @@ class DerivedPageDataUpdater implements IDBAccessObject {
        /**
         * Whether the edit created, or should create, a new revision (that is, it's not a null-edit).
         *
-        * @warning: at present, "null-revisions" that do not change content but do have a revision
+        * @warning at present, "null-revisions" that do not change content but do have a revision
         * record would return false after prepareContent(), but true after prepareUpdate()!
         * This should probably be fixed.
         *
@@ -931,11 +931,11 @@ class DerivedPageDataUpdater implements IDBAccessObject {
         *
         * @see docs/pageupdater.txt for more information on when thie method can and should be called.
         *
-        * @note: Calling this method more than once with the same revision has no effect.
+        * @note Calling this method more than once with the same revision has no effect.
         * $options are only used for the first call. Calling this method multiple times with
         * different revisions will cause an exception.
         *
-        * @note: If grabCurrentRevision() (or prepareContent()) has been called before
+        * @note If grabCurrentRevision() (or prepareContent()) has been called before
         * calling this method, $revision->getParentRevision() has to refer to the revision that
         * was the current revision at the time grabCurrentRevision() was called.
         *
index ba9780f..91969fc 100644 (file)
@@ -139,7 +139,7 @@ class RevisionSlots {
        /**
         * Computes the total nominal size of the revision's slots, in bogo-bytes.
         *
-        * @warn This is potentially expensive! It may cause all slot's content to be loaded
+        * @warning This is potentially expensive! It may cause all slot's content to be loaded
         * and deserialized.
         *
         * @return int
@@ -181,7 +181,7 @@ class RevisionSlots {
         * is that slot's hash. For consistency, the combined hash of an empty set of slots
         * is the hash of the empty string.
         *
-        * @warn This is potentially expensive! It may cause all slot's content to be loaded
+        * @warning This is potentially expensive! It may cause all slot's content to be loaded
         * and deserialized, then re-serialized and hashed.
         *
         * @return string
index 602364c..d090d8b 100644 (file)
@@ -917,7 +917,7 @@ class RevisionStore
         * Such revisions can for instance identify page rename
         * operations and other such meta-modifications.
         *
-        * @note: This method grabs a FOR UPDATE lock on the relevant row of the page table,
+        * @note This method grabs a FOR UPDATE lock on the relevant row of the page table,
         * to prevent a new revision from being inserted before the null revision has been written
         * to the database.
         *
index b583554..d3e0622 100644 (file)
@@ -306,6 +306,10 @@ class Title implements LinkTarget {
        public static function newFromTextThrow( $text, $defaultNamespace = NS_MAIN ) {
                if ( is_object( $text ) ) {
                        throw new MWException( '$text must be a string, given an object' );
+               } elseif ( $text === null ) {
+                       // Legacy code relies on MalformedTitleException being thrown in this case
+                       // (happens when URL with no title in it is parsed). TODO fix
+                       throw new MalformedTitleException( 'title-invalid-empty' );
                }
 
                $titleCache = self::getTitleCache();
@@ -1289,12 +1293,9 @@ class Title implements LinkTarget {
         */
        public function isSiteConfigPage() {
                return (
-                       NS_MEDIAWIKI == $this->mNamespace
-                       && (
-                               $this->hasContentModel( CONTENT_MODEL_CSS )
-                               || $this->hasContentModel( CONTENT_MODEL_JSON )
-                               || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
-                       )
+                       $this->isSiteCssConfigPage()
+                       || $this->isSiteJsonConfigPage()
+                       || $this->isSiteJsConfigPage()
                );
        }
 
@@ -1317,13 +1318,9 @@ class Title implements LinkTarget {
         */
        public function isUserConfigPage() {
                return (
-                       NS_USER == $this->mNamespace
-                       && $this->isSubpage()
-                       && (
-                               $this->hasContentModel( CONTENT_MODEL_CSS )
-                               || $this->hasContentModel( CONTENT_MODEL_JSON )
-                               || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
-                       )
+                       $this->isUserCssConfigPage()
+                       || $this->isUserJsonConfigPage()
+                       || $this->isUserJsConfigPage()
                );
        }
 
@@ -1423,6 +1420,60 @@ class Title implements LinkTarget {
                return $this->isUserJsConfigPage();
        }
 
+       /**
+        * Is this a sitewide CSS "config" page?
+        *
+        * @return bool
+        * @since 1.32
+        */
+       public function isSiteCssConfigPage() {
+               return (
+                       NS_MEDIAWIKI == $this->mNamespace
+                       && (
+                               $this->hasContentModel( CONTENT_MODEL_CSS )
+                               // paranoia - a MediaWiki: namespace page with mismatching extension and content
+                               // model is probably by mistake and might get handled incorrectly (see e.g. T112937)
+                               || substr( $this->getDBkey(), -4 ) === '.css'
+                       )
+               );
+       }
+
+       /**
+        * Is this a sitewide JSON "config" page?
+        *
+        * @return bool
+        * @since 1.32
+        */
+       public function isSiteJsonConfigPage() {
+               return (
+                       NS_MEDIAWIKI == $this->mNamespace
+                       && (
+                               $this->hasContentModel( CONTENT_MODEL_JSON )
+                               // paranoia - a MediaWiki: namespace page with mismatching extension and content
+                               // model is probably by mistake and might get handled incorrectly (see e.g. T112937)
+                               || substr( $this->getDBkey(), -5 ) === '.json'
+                       )
+               );
+       }
+
+       /**
+        * Is this a sitewide JS "config" page?
+        *
+        * @return bool
+        * @since 1.31
+        */
+       public function isSiteJsConfigPage() {
+               return (
+                       NS_MEDIAWIKI == $this->mNamespace
+                       && (
+                               $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
+                               // paranoia - a MediaWiki: namespace page with mismatching extension and content
+                               // model is probably by mistake and might get handled incorrectly (see e.g. T112937)
+                               || substr( $this->getDBkey(), -3 ) === '.js'
+                       )
+               );
+       }
+
        /**
         * Is this a talk page of some sort?
         *
@@ -2313,6 +2364,33 @@ class Title implements LinkTarget {
                return $errors;
        }
 
+       /**
+        * Check sitewide CSS/JSON/JS permissions
+        *
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param string $rigor Same format as Title::getUserPermissionsErrors()
+        * @param bool $short Short circuit on first error
+        *
+        * @return array List of errors
+        */
+       private function checkSiteConfigPermissions( $action, $user, $errors, $rigor, $short ) {
+               if ( $action != 'patrol' ) {
+                       // Sitewide CSS/JSON/JS changes, like all NS_MEDIAWIKI changes, also require the
+                       // editinterface right. That's implemented as a restriction so no check needed here.
+                       if ( $this->isSiteCssConfigPage() && !$user->isAllowed( 'editsitecss' ) ) {
+                               $errors[] = [ 'sitecssprotected', $action ];
+                       } elseif ( $this->isSiteJsonConfigPage() && !$user->isAllowed( 'editsitejson' ) ) {
+                               $errors[] = [ 'sitejsonprotected', $action ];
+                       } elseif ( $this->isSiteJsConfigPage() && !$user->isAllowed( 'editsitejs' ) ) {
+                               $errors[] = [ 'sitejsprotected', $action ];
+                       }
+               }
+
+               return $errors;
+       }
+
        /**
         * Check CSS/JSON/JS sub-page permissions
         *
@@ -2701,10 +2779,10 @@ class Title implements LinkTarget {
                                'checkReadPermissions',
                                'checkUserBlock', // for wgBlockDisablesLogin
                        ];
-               # Don't call checkSpecialsAndNSPermissions or checkUserConfigPermissions
-               # here as it will lead to duplicate error messages. This is okay to do
-               # since anywhere that checks for create will also check for edit, and
-               # those checks are called for edit.
+               # Don't call checkSpecialsAndNSPermissions, checkSiteConfigPermissions
+               # or checkUserConfigPermissions here as it will lead to duplicate
+               # error messages. This is okay to do since anywhere that checks for
+               # create will also check for edit, and those checks are called for edit.
                } elseif ( $action == 'create' ) {
                        $checks = [
                                'checkQuickPermissions',
@@ -2719,6 +2797,7 @@ class Title implements LinkTarget {
                                'checkQuickPermissions',
                                'checkPermissionHooks',
                                'checkSpecialsAndNSPermissions',
+                               'checkSiteConfigPermissions',
                                'checkUserConfigPermissions',
                                'checkPageRestrictions',
                                'checkCascadingSourcesRestrictions',
index 20637fc..1a15fc0 100644 (file)
@@ -62,12 +62,25 @@ class HistoryAction extends FormlessAction {
 
        protected function getDescription() {
                // Creation of a subtitle link pointing to [[Special:Log]]
-               return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+               $subtitle = $linkRenderer->makeKnownLink(
                        SpecialPage::getTitleFor( 'Log' ),
                        $this->msg( 'viewpagelogs' )->text(),
                        [],
                        [ 'page' => $this->getTitle()->getPrefixedText() ]
                );
+
+               $links = [];
+               // Allow extensions to add more links
+               Hooks::run( 'HistoryPageToolLinks', [ $this->getContext(), $linkRenderer, &$links ] );
+               if ( $links ) {
+                       $subtitle .= ''
+                               . $this->msg( 'word-separator' )->escaped()
+                               . $this->msg( 'parentheses' )
+                                       ->rawParams( $this->getLanguage()->pipeList( $links ) )
+                                       ->escaped();
+               }
+               return $subtitle;
        }
 
        /**
index 5c82f09..39e8bd9 100644 (file)
@@ -161,7 +161,7 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
        /**
         * Update link tables with outgoing links from an updated article
         *
-        * @note: this is managed by DeferredUpdates::execute(). Do not run this in a transaction.
+        * @note this is managed by DeferredUpdates::execute(). Do not run this in a transaction.
         */
        public function doUpdate() {
                if ( $this->ticket ) {
index e6a15ce..aa0a1f7 100644 (file)
@@ -966,7 +966,7 @@ class DifferenceEngine extends ContextSource {
                        wfDeprecated( "\$wgExternalDiffEngine = '{$wgExternalDiffEngine}'", '1.27' );
                        $wgExternalDiffEngine = false;
                } elseif ( $wgExternalDiffEngine == 'wikidiff2' ) {
-                       // Same as above, but with no deprecation warnings
+                       wfDeprecated( "\$wgExternalDiffEngine = '{$wgExternalDiffEngine}'", '1.32' );
                        $wgExternalDiffEngine = false;
                } elseif ( !is_string( $wgExternalDiffEngine ) && $wgExternalDiffEngine !== false ) {
                        // And prevent people from shooting themselves in the foot...
index a4d9bca..4e64e9d 100644 (file)
@@ -119,8 +119,14 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
                        $dropdownInputAttribs['classes'] = [ $this->mClass ];
                }
 
+               $disabled = false;
+               if ( isset( $this->mParams[ 'disabled' ] ) && $this->mParams[ 'disabled' ] ) {
+                       $disabled = true;
+               }
+
                return $this->getInputWidget( [
                        'id' => $this->mID,
+                       'disabled' => $disabled,
                        'textinput' => $textAttribs,
                        'dropdowninput' => $dropdownInputAttribs,
                        'or' => false,
index 91050a0..47c1f18 100644 (file)
@@ -125,8 +125,14 @@ class HTMLSelectOrOtherField extends HTMLTextField {
                        $textAttribs['placeholder'] = $this->mPlaceholder;
                }
 
+               $disabled = false;
+               if ( isset( $this->mParams[ 'disabled' ] ) && $this->mParams[ 'disabled' ] ) {
+                       $disabled = true;
+               }
+
                return $this->getInputWidget( [
                        'id' => $this->mID,
+                       'disabled' => $disabled,
                        'textinput' => $textAttribs,
                        'dropdowninput' => $dropdownAttribs,
                        'or' => true,
index e7ee95c..367149d 100644 (file)
@@ -1606,7 +1606,7 @@ abstract class Installer {
        }
 
        /**
-        * Create the first user account, grant it sysop and bureaucrat rights
+        * Create the first user account, grant it sysop, bureaucrat and interface-admin rights
         *
         * @return Status
         */
@@ -1630,6 +1630,7 @@ abstract class Installer {
 
                        $user->addGroup( 'sysop' );
                        $user->addGroup( 'bureaucrat' );
+                       $user->addGroup( 'interface-admin' );
                        if ( $this->getVar( '_AdminEmail' ) ) {
                                $user->setEmail( $this->getVar( '_AdminEmail' ) );
                        }
index 0a66b9a..50c4517 100644 (file)
@@ -114,11 +114,11 @@ class MssqlUpdater extends DatabaseUpdater {
                        [ 'migrateComments' ],
 
                        // 1.31
-                       [ 'addTable', 'slots', 'patch-slots.sql' ],
-                       [ 'addField', 'slots', 'slot_origin', 'patch-slot-origin.sql' ],
-                       [ 'addTable', 'content', 'patch-content.sql' ],
                        [ 'addTable', 'slot_roles', 'patch-slot_roles.sql' ],
                        [ 'addTable', 'content_models', 'patch-content_models.sql' ],
+                       [ 'addTable', 'content', 'patch-content.sql' ],
+                       [ 'addTable', 'slots', 'patch-slots.sql' ],
+                       [ 'addField', 'slots', 'slot_origin', 'patch-slot-origin.sql' ],
                        [ 'migrateArchiveText' ],
                        [ 'addTable', 'actor', 'patch-actor-table.sql' ],
                        [ 'migrateActors' ],
index 50c88ae..09fc0f3 100644 (file)
@@ -223,7 +223,7 @@ class WebInstallerName extends WebInstallerPage {
                        $status = $upp->checkUserPasswordForGroups(
                                $user,
                                $pwd,
-                               [ 'bureaucrat', 'sysop' ]  // per Installer::createSysop()
+                               [ 'bureaucrat', 'sysop', 'interface-admin' ]  // per Installer::createSysop()
                        );
                        $valid = $status->isGood() ? true : $status->getMessage();
                } else {
index df22b41..93f5b0b 100644 (file)
@@ -23,7 +23,7 @@ class HttpAcceptParser {
         * Note that type parameters and accept extension like the "level" parameter
         * are not supported, weights are derived from "q" values only.
         *
-        * @todo: If additional type parameters are present, ignore them cleanly.
+        * @todo If additional type parameters are present, ignore them cleanly.
         *        At present, they often confuse the result.
         *
         * See HTTP/1.1 section 14 for details.
index aec9f25..5e8c22b 100644 (file)
@@ -94,7 +94,7 @@ abstract class DBLockManager extends QuorumLockManager {
        }
 
        /**
-        * @TODO change this code to work in one batch
+        * @todo change this code to work in one batch
         * @param string $lockSrv
         * @param array $pathsByType
         * @return StatusValue
index e03645f..82ae5ae 100644 (file)
@@ -238,7 +238,7 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
        abstract protected function doGet( $key, $flags = 0 );
 
        /**
-        * @note: This method is only needed if merge() uses mergeViaCas()
+        * @note This method is only needed if merge() uses mergeViaCas()
         *
         * @param string $key
         * @param mixed &$casToken
index dc3260d..4070a02 100644 (file)
@@ -287,7 +287,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        const STATUS_TRX_NONE = 3;
 
        /**
-        * @note: exceptions for missing libraries/drivers should be thrown in initConnection()
+        * @note exceptions for missing libraries/drivers should be thrown in initConnection()
         * @param array $params Parameters passed from Database::factory()
         */
        protected function __construct( array $params ) {
index 1ac7d09..61788e1 100644 (file)
@@ -32,7 +32,7 @@ use stdClass;
 /**
  * Basic database interface for live and lazy-loaded relation database handles
  *
- * @note: IDatabase and DBConnRef should be updated to reflect any changes
+ * @note IDatabase and DBConnRef should be updated to reflect any changes
  * @ingroup Database
  */
 interface IDatabase {
@@ -1500,7 +1500,7 @@ interface IDatabase {
         *
         * This is useful for combining cooperative locks and DB transactions.
         *
-        * @note: do not assume that *other* IDatabase instances will be AUTOCOMMIT mode
+        * @note do not assume that *other* IDatabase instances will be AUTOCOMMIT mode
         *
         * The callback takes the following arguments:
         *   - How the transaction ended (IDatabase::TRIGGER_COMMIT or IDatabase::TRIGGER_ROLLBACK)
@@ -1535,7 +1535,7 @@ interface IDatabase {
         *
         * Updates will execute in the order they were enqueued.
         *
-        * @note: do not assume that *other* IDatabase instances will be AUTOCOMMIT mode
+        * @note do not assume that *other* IDatabase instances will be AUTOCOMMIT mode
         *
         * The callback takes the following arguments:
         *   - How the transaction ended (IDatabase::TRIGGER_COMMIT or IDatabase::TRIGGER_IDLE)
@@ -1623,7 +1623,7 @@ interface IDatabase {
         *   - The failures are from contention solvable via onTransactionPreCommitOrIdle()
         *   - The failures are deadlocks; the RDBMs usually discard the whole transaction
         *
-        * @note: callers must use additional measures for situations involving two or more
+        * @note callers must use additional measures for situations involving two or more
         *   (peer) transactions (e.g. updating two database servers at once). The transaction
         *   and savepoint logic of this method only applies to this specific IDatabase instance.
         *
@@ -1702,7 +1702,7 @@ interface IDatabase {
         * corresponding startAtomic() implicitly started a transaction, that
         * transaction is rolled back.
         *
-        * @note: callers must use additional measures for situations involving two or more
+        * @note callers must use additional measures for situations involving two or more
         *   (peer) transactions (e.g. updating two database servers at once). The transaction
         *   and savepoint logic of startAtomic() are bound to specific IDatabase instances.
         *
index c8d111d..d70688f 100644 (file)
@@ -72,7 +72,7 @@ class PageDataRequestHandler {
         *        - oldid|revision: the revision ID
         * @param OutputPage $output
         *
-        * @note: Instead of an output page, a WebResponse could be sufficient, but
+        * @note Instead of an output page, a WebResponse could be sufficient, but
         *        redirect logic is currently implemented in OutputPage.
         *
         * @throws HttpError
index db97364..559ac87 100644 (file)
@@ -273,6 +273,7 @@ class LogEventsList extends ContextSource {
                        'class' => 'HTMLUserTextField',
                        'label-message' => 'specialloguserlabel',
                        'name' => 'user',
+                       'default' => $user,
                ];
        }
 
index c8e68b2..e4b064e 100644 (file)
@@ -666,7 +666,7 @@ class ParserOptions {
        /**
         * Get the user language used by the parser for this page and split the parser cache.
         *
-        * @warning: Calling this causes the parser cache to be fragmented by user language!
+        * @warning Calling this causes the parser cache to be fragmented by user language!
         * To avoid cache fragmentation, output should not depend on the user language.
         * Use Parser::getFunctionLang() or Parser::getTargetLanguage() instead!
         *
@@ -687,7 +687,7 @@ class ParserOptions {
        /**
         * Same as getUserLangObj() but returns a string instead.
         *
-        * @warning: Calling this causes the parser cache to be fragmented by user language!
+        * @warning Calling this causes the parser cache to be fragmented by user language!
         * To avoid cache fragmentation, output should not depend on the user language.
         * Use Parser::getFunctionLang() or Parser::getTargetLanguage() instead!
         *
index 54d9e9c..b2403ce 100644 (file)
@@ -45,7 +45,7 @@ class DBSiteStore implements SiteStore {
        /**
         * @since 1.27
         *
-        * @todo: inject some kind of connection manager that is aware of the target wiki,
+        * @todo inject some kind of connection manager that is aware of the target wiki,
         * instead of injecting a LoadBalancer.
         *
         * @param LoadBalancer $dbLoadBalancer
index 2ba01ff..8ebd2d2 100644 (file)
@@ -147,6 +147,9 @@ class User implements IDBAccessObject, UserIdentity {
                'editmyuserjs',
                'editmywatchlist',
                'editsemiprotected',
+               'editsitecss',
+               'editsitejson',
+               'editsitejs',
                'editusercss',
                'edituserjson',
                'edituserjs',
index c23d999..d184e92 100644 (file)
@@ -84,7 +84,7 @@ class UIDGenerator {
        }
 
        /**
-        * @todo: move to MW-specific factory class and inject temp dir
+        * @todo move to MW-specific factory class and inject temp dir
         * @return UIDGenerator
         */
        protected static function singleton() {
index 5ceed4c..262903d 100644 (file)
@@ -36,6 +36,11 @@ class SelectWithInputWidget extends \OOUI\Widget {
                        $config
                );
 
+               if ( isset( $config['disabled'] ) && $config['disabled'] == true ) {
+                       $config['textinput']['disabled'] = true;
+                       $config['dropdowninput']['disabled'] = true;
+               }
+
                parent::__construct( $config );
 
                // Properties
index 4e9681a..a9bd1f5 100644 (file)
        "customcssprotected": "You do not have permission to edit this CSS page because it contains another user's personal settings.",
        "customjsonprotected": "You do not have permission to edit this JSON page because it contains another user's personal settings.",
        "customjsprotected": "You do not have permission to edit this JavaScript page because it contains another user's personal settings.",
+       "sitecssprotected": "You do not have permission to edit this CSS page because it may affect all visitors",
+       "sitejsonprotected": "You do not have permission to edit this JSON page because it may affect all visitors",
+       "sitejsprotected": "You do not have permission to edit this JavaScript page because it may affect all visitors",
        "mycustomcssprotected": "You do not have permission to edit this CSS page.",
        "mycustomjsonprotected": "You do not have permission to edit this JSON page.",
        "mycustomjsprotected": "You do not have permission to edit this JavaScript page.",
        "group-autoconfirmed": "Autoconfirmed users",
        "group-bot": "Bots",
        "group-sysop": "Administrators",
+       "group-interface-admin": "Interface administrators",
        "group-bureaucrat": "Bureaucrats",
        "group-suppress": "Suppressors",
        "group-all": "(all)",
        "group-autoconfirmed-member": "{{GENDER:$1|autoconfirmed user}}",
        "group-bot-member": "{{GENDER:$1|bot}}",
        "group-sysop-member": "{{GENDER:$1|administrator}}",
+       "group-interface-admin-member": "{{GENDER:$1|interface administrator}}",
        "group-bureaucrat-member": "{{GENDER:$1|bureaucrat}}",
        "group-suppress-member": "{{GENDER:$1|suppressor}}",
        "grouppage-user": "{{ns:project}}:Users",
        "grouppage-autoconfirmed": "{{ns:project}}:Autoconfirmed users",
        "grouppage-bot": "{{ns:project}}:Bots",
        "grouppage-sysop": "{{ns:project}}:Administrators",
+       "grouppage-interface-admin": "{{ns:project}}:Interface administrators",
        "grouppage-bureaucrat": "{{ns:project}}:Bureaucrats",
        "grouppage-suppress": "{{ns:project}}:Suppress",
        "right-read": "Read pages",
        "right-editusercss": "Edit other users' CSS files",
        "right-edituserjson": "Edit other users' JSON files",
        "right-edituserjs": "Edit other users' JavaScript files",
+       "right-editsitecss": "Edit sitewide CSS",
+       "right-editsitejson": "Edit sitewide JSON",
+       "right-editsitejs": "Edit sitewide JavaScript",
        "right-editmyusercss": "Edit your own user CSS files",
        "right-editmyuserjson": "Edit your own user JSON files",
        "right-editmyuserjs": "Edit your own user JavaScript files",
        "grant-createaccount": "Create accounts",
        "grant-createeditmovepage": "Create, edit, and move pages",
        "grant-delete": "Delete pages, revisions, and log entries",
-       "grant-editinterface": "Edit the MediaWiki namespace and user CSS/JSON/JavaScript",
+       "grant-editinterface": "Edit the MediaWiki namespace and sitewide/user JSON",
        "grant-editmycssjs": "Edit your user CSS/JSON/JavaScript",
        "grant-editmyoptions": "Edit your user preferences",
        "grant-editmywatchlist": "Edit your watchlist",
+       "grant-editsiteconfig": "Edit sitewide and user CSS/JS",
        "grant-editpage": "Edit existing pages",
        "grant-editprotected": "Edit protected pages",
        "grant-highvolume": "High-volume editing",
        "uploadstash-zero-length": "File is zero length.",
        "invalid-chunk-offset": "Invalid chunk offset",
        "img-auth-accessdenied": "Access denied",
-       "img-auth-nopathinfo": "Missing PATH_INFO.\nYour server is not set up to pass this information.\nIt may be CGI-based and cannot support img_auth.\nSee https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization.",
+       "img-auth-nopathinfo": "Missing path information.\nYour server must be set up to pass the REQUEST_URI and/or PATH_INFO variables.\nIf it is, try enabling $wgUsePathInfo.\nSee https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization.",
        "img-auth-notindir": "Requested path is not in the configured upload directory.",
        "img-auth-badtitle": "Unable to construct a valid title from \"$1\".",
        "img-auth-nologinnWL": "You are not logged in and \"$1\" is not in the whitelist.",
index f7a91d1..2ba449a 100644 (file)
        "customcssprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
        "customjsonprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
        "customjsprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
+       "sitecssprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
+       "sitejsonprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
+       "sitejsprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
        "mycustomcssprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
        "mycustomjsonprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
        "mycustomjsprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
        "group-autoconfirmed": "{{doc-group|autoconfirmed}}\nOn Wikimedia sites autoconfirmed users are users which are older than 4 days. After those 4 days, they have more rights.",
        "group-bot": "{{doc-group|bot}}\n{{Identical|Bot}}",
        "group-sysop": "{{doc-group|sysop}}\n{{Identical|Administrator}}",
+       "group-interface-admin": "{{doc-group|interface-admin}}",
        "group-bureaucrat": "{{doc-group|bureaucrat}}",
        "group-suppress": "{{doc-group|suppress}}\nThis is an optional (disabled by default) user group, meant for the suppression feature in [[mw:Flow|Flow]]. It is not to be confused with the Oversighters group, which also has access to the [[mw:RevisionDelete|RevisionDelete]] feature, to change the visibility of revisions through [[Special:RevisionDelete]].\n\n{{Identical|Suppress}}",
        "group-all": "The name of the user group that contains all users, including anonymous users\n\n{{Identical|All}}",
        "group-autoconfirmed-member": "{{doc-group|autoconfirmed|member}}",
        "group-bot-member": "{{doc-group|bot|member}}",
        "group-sysop-member": "{{doc-group|sysop|member}}\n{{Identical|Administrator}}",
+       "group-interface-admin-member": "{{doc-group|interface-admin|member}}",
        "group-bureaucrat-member": "{{doc-group|bureaucrat|member}}",
        "group-suppress-member": "{{doc-group|suppress|member}}\nThis is a member of the optional (disabled by default) user group, meant for the [[mw:RevisionDelete|RevisionDelete]] feature, to change the visibility of revisions through [[Special:RevisionDelete]].\n\n{{Identical|Suppress}}",
        "grouppage-user": "{{doc-group|user|page}}\n{{Identical|User}}",
        "grouppage-autoconfirmed": "{{doc-group|autoconfirmed|page}}",
        "grouppage-bot": "{{doc-group|bot|page}}\n{{Identical|Bot}}",
        "grouppage-sysop": "{{doc-group|sysop|page}}",
+       "grouppage-interface-admin": "{{doc-group|interface-admin|page}}",
        "grouppage-bureaucrat": "{{doc-group|bureaucrat|page}}",
        "grouppage-suppress": "{{doc-group|suppress|page}}\n{{Identical|Suppress}}",
        "right-read": "{{doc-right|read}}\nBasic right to read any page.",
        "right-editusercss": "{{doc-right|editusercss}}\nSee also:\n* {{msg-mw|Right-editmyusercss}}",
        "right-edituserjson": "{{doc-right|edituserjson}}\nSee also:\n* {{msg-mw|Right-editmyuserjson}}",
        "right-edituserjs": "{{doc-right|edituserjs}}\nSee also:\n* {{msg-mw|Right-editmyuserjs}}",
+       "right-editsitecss": "{{doc-right|editsitecss}}",
+       "right-editsitejson": "{{doc-right|editsitejson}}",
+       "right-editsitejs": "{{doc-right|editsitejs}}",
        "right-editmyusercss": "{{doc-right|editmyusercss}}\nSee also:\n* {{msg-mw|Right-editusercss}}",
        "right-editmyuserjson": "{{doc-right|editmyuserjson}}\nSee also:\n* {{msg-mw|Right-edituserjson}}",
        "right-editmyuserjs": "{{doc-right|editmyuserjs}}\nSee also:\n* {{msg-mw|Right-edituserjs}}",
        "right-applychangetags": "{{doc-right|applychangetags}}",
        "right-changetags": "{{doc-right|changetags}}",
        "right-deletechangetags": "{{doc-right|deletechangetags}}",
-       "grant-generic": "Used if the grant name is not defined. Parameters:\n* $1 - grant name\n\nDefined grants (grant name refers: blockusers, createeditmovepage, ...):\n* {{msg-mw|grant-checkuser}}\n* {{msg-mw|grant-blockusers}}\n* {{msg-mw|grant-createaccount}}\n* {{msg-mw|grant-createeditmovepage}}\n* {{msg-mw|grant-delete}}\n* {{msg-mw|grant-editinterface}}\n* {{msg-mw|grant-editmycssjs}}\n* {{msg-mw|grant-editmyoptions}}\n* {{msg-mw|grant-editmywatchlist}}\n* {{msg-mw|grant-editpage}}\n* {{msg-mw|grant-editprotected}}\n* {{msg-mw|grant-highvolume}}\n* {{msg-mw|grant-oversight}}\n* {{msg-mw|grant-patrol}}\n* {{msg-mw|grant-privateinfo}}\n* {{msg-mw|grant-protect}}\n* {{msg-mw|grant-rollback}}\n* {{msg-mw|grant-sendemail}}\n* {{msg-mw|grant-uploadeditmovefile}}\n* {{msg-mw|grant-uploadfile}}\n* {{msg-mw|grant-basic}}\n* {{msg-mw|grant-viewdeleted}}\n* {{msg-mw|grant-viewmywatchlist}}",
+       "grant-generic": "Used if the grant name is not defined. Parameters:\n* $1 - grant name\n\nDefined grants (grant name refers: blockusers, createeditmovepage, ...):\n* {{msg-mw|grant-checkuser}}\n* {{msg-mw|grant-blockusers}}\n* {{msg-mw|grant-createaccount}}\n* {{msg-mw|grant-createeditmovepage}}\n* {{msg-mw|grant-delete}}\n* {{msg-mw|grant-editinterface}}\n* {{msg-mw|grant-editmycssjs}}\n* {{msg-mw|grant-editmyoptions}}\n* {{msg-mw|grant-editmywatchlist}}\n* {{msg-mw|grant-editsiteconfig}}\n* {{msg-mw|grant-editpage}}\n* {{msg-mw|grant-editprotected}}\n* {{msg-mw|grant-highvolume}}\n* {{msg-mw|grant-oversight}}\n* {{msg-mw|grant-patrol}}\n* {{msg-mw|grant-privateinfo}}\n* {{msg-mw|grant-protect}}\n* {{msg-mw|grant-rollback}}\n* {{msg-mw|grant-sendemail}}\n* {{msg-mw|grant-uploadeditmovefile}}\n* {{msg-mw|grant-uploadfile}}\n* {{msg-mw|grant-basic}}\n* {{msg-mw|grant-viewdeleted}}\n* {{msg-mw|grant-viewmywatchlist}}",
        "grant-group-page-interaction": "{{Related|Grant-group}}",
        "grant-group-file-interaction": "{{Related|Grant-group}}",
        "grant-group-watchlist-interaction": "{{Related|Grant-group}}",
        "grant-createaccount": "Name for grant \"createaccount\".\n{{Related|Grant}}\n{{Identical|Create account}}",
        "grant-createeditmovepage": "Name for grant \"createeditmovepage\".\n{{Related|Grant}}",
        "grant-delete": "Name for grant \"delete\".\n{{Related|Grant}}",
-       "grant-editinterface": "Name for grant \"editinterface\".\n\n\"JS\" stands for \"JavaScript\".\n{{Related|Grant}}",
+       "grant-editinterface": "Name for grant \"editinterface\".\n{{Related|Grant}}",
        "grant-editmycssjs": "Name for grant \"editmycssjs\".\n\n\"JS\" stands for \"JavaScript\".\n{{Related|Grant}}",
        "grant-editmyoptions": "Name for grant \"editmyoptions\".\n{{Related|Grant}}",
        "grant-editmywatchlist": "Name for grant \"editmywatchlist\".\n{{Related|Grant}}\n{{Identical|Edit your watchlist}}",
+       "grant-editsiteconfig": "Name for grant \"editsiteconfig\".\n{{Related|Grant}}",
        "grant-editpage": "Name for grant \"editpage\".\n{{Related|Grant}}",
        "grant-editprotected": "Name for grant \"editprotected\".\n{{Related|Grant}}",
        "grant-highvolume": "Name for grant \"highvolume\".\n{{Related|Grant}}",
index d3efca6..2072d7b 100644 (file)
@@ -31,7 +31,7 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class CreateAndPromote extends Maintenance {
-       private static $permitRoles = [ 'sysop', 'bureaucrat', 'bot' ];
+       private static $permitRoles = [ 'sysop', 'bureaucrat', 'interface-admin', 'bot' ];
 
        public function __construct() {
                parent::__construct();
index b26ad44..ad524a7 100644 (file)
@@ -4,8 +4,8 @@
 -- T167246. Add an `actor` table and various columns (and temporary tables) to reference it.
 
 CREATE TABLE /*_*/actor (
-  actor_id bigint unsigned NOT NULL CONSTRAINT PK_actor PRIMARY KEY IDENTITY(0,1),
-  actor_user int unsigned,
+  actor_id bigint NOT NULL CONSTRAINT PK_actor PRIMARY KEY IDENTITY(0,1),
+  actor_user int,
   actor_name nvarchar(255) NOT NULL
 );
 CREATE UNIQUE INDEX /*i*/actor_user ON /*_*/actor (actor_user);
@@ -15,10 +15,10 @@ CREATE UNIQUE INDEX /*i*/actor_name ON /*_*/actor (actor_name);
 INSERT INTO /*_*/actor (actor_name) VALUES ('##Anonymous##');
 
 CREATE TABLE /*_*/revision_actor_temp (
-  revactor_rev int unsigned NOT NULL CONSTRAINT FK_revactor_rev FOREIGN KEY REFERENCES /*_*/revision(rev_id) ON DELETE CASCADE,
-  revactor_actor bigint unsigned NOT NULL,
+  revactor_rev int NOT NULL CONSTRAINT FK_revactor_rev FOREIGN KEY REFERENCES /*_*/revision(rev_id) ON DELETE CASCADE,
+  revactor_actor bigint NOT NULL,
   revactor_timestamp varchar(14) NOT NULL CONSTRAINT DF_revactor_timestamp DEFAULT '',
-  revactor_page int unsigned NOT NULL,
+  revactor_page int NOT NULL,
   CONSTRAINT PK_revision_actor_temp PRIMARY KEY (revactor_rev, revactor_actor)
 );
 CREATE UNIQUE INDEX /*i*/revactor_rev ON /*_*/revision_actor_temp (revactor_rev);
@@ -26,28 +26,28 @@ CREATE INDEX /*i*/actor_timestamp ON /*_*/revision_actor_temp (revactor_actor,re
 CREATE INDEX /*i*/page_actor_timestamp ON /*_*/revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp);
 
 ALTER TABLE /*_*/archive ADD CONSTRAINT DF_ar_user_text DEFAULT '' FOR ar_user_text;
-ALTER TABLE /*_*/archive ADD ar_actor bigint unsigned NOT NULL CONSTRAINT DF_ar_actor DEFAULT 0;
+ALTER TABLE /*_*/archive ADD ar_actor bigint NOT NULL CONSTRAINT DF_ar_actor DEFAULT 0;
 CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp);
 
-ALTER TABLE /*_*/ipblocks ADD ipb_by_actor bigint unsigned NOT NULL CONSTRAINT DF_ipb_by_actor DEFAULT 0;
+ALTER TABLE /*_*/ipblocks ADD ipb_by_actor bigint NOT NULL CONSTRAINT DF_ipb_by_actor DEFAULT 0;
 
 ALTER TABLE /*_*/image ADD CONSTRAINT DF_img_user_text DEFAULT '' FOR img_user_text;
-ALTER TABLE /*_*/image ADD img_actor bigint unsigned NOT NULL CONSTRAINT DF_img_actor DEFAULT 0;
+ALTER TABLE /*_*/image ADD img_actor bigint NOT NULL CONSTRAINT DF_img_actor DEFAULT 0;
 CREATE INDEX /*i*/img_actor_timestamp ON /*_*/image (img_actor, img_timestamp);
 
 ALTER TABLE /*_*/oldimage ADD CONSTRAINT DF_oi_user_text DEFAULT '' FOR oi_user_text;
-ALTER TABLE /*_*/oldimage ADD oi_actor bigint unsigned NOT NULL CONSTRAINT DF_oi_actor DEFAULT 0;
+ALTER TABLE /*_*/oldimage ADD oi_actor bigint NOT NULL CONSTRAINT DF_oi_actor DEFAULT 0;
 CREATE INDEX /*i*/oi_actor_timestamp ON /*_*/oldimage (oi_actor,oi_timestamp);
 
 ALTER TABLE /*_*/filearchive ADD CONSTRAINT DF_fa_user_text DEFAULT '' FOR fa_user_text;
-ALTER TABLE /*_*/filearchive ADD fa_actor bigint unsigned NOT NULL CONSTRAINT DF_fa_actor DEFAULT 0;
+ALTER TABLE /*_*/filearchive ADD fa_actor bigint NOT NULL CONSTRAINT DF_fa_actor DEFAULT 0;
 CREATE INDEX /*i*/fa_actor_timestamp ON /*_*/filearchive (fa_actor,fa_timestamp);
 
 ALTER TABLE /*_*/recentchanges ADD CONSTRAINT DF_rc_user_text DEFAULT '' FOR rc_user_text;
-ALTER TABLE /*_*/recentchanges ADD rc_actor bigint unsigned NOT NULL CONSTRAINT DF_rc_actor DEFAULT 0;
+ALTER TABLE /*_*/recentchanges ADD rc_actor bigint NOT NULL CONSTRAINT DF_rc_actor DEFAULT 0;
 CREATE INDEX /*i*/rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
 CREATE INDEX /*i*/rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
 
-ALTER TABLE /*_*/logging ADD log_actor bigint unsigned NOT NULL CONSTRAINT DF_log_actor DEFAULT 0;
+ALTER TABLE /*_*/logging ADD log_actor bigint NOT NULL CONSTRAINT DF_log_actor DEFAULT 0;
 CREATE INDEX /*i*/actor_time ON /*_*/logging (log_actor, log_timestamp);
 CREATE INDEX /*i*/log_actor_type_time ON /*_*/logging (log_actor, log_type, log_timestamp);
index f4c2a90..c532082 100644 (file)
@@ -4,7 +4,7 @@
 -- T166732. Add a `comment` table and various columns (and temporary tables) to reference it.
 
 CREATE TABLE /*_*/comment (
-  comment_id bigint unsigned NOT NULL PRIMARY KEY IDENTITY(0,1),
+  comment_id bigint NOT NULL PRIMARY KEY IDENTITY(0,1),
   comment_hash INT NOT NULL,
   comment_text nvarchar(max) NOT NULL,
   comment_data nvarchar(max)
@@ -17,15 +17,15 @@ INSERT INTO /*_*/comment (comment_hash, comment_text) VALUES (-1, '** dummy **')
 
 CREATE TABLE /*_*/revision_comment_temp (
   revcomment_rev INT NOT NULL CONSTRAINT FK_revcomment_rev FOREIGN KEY REFERENCES /*_*/revision(rev_id) ON DELETE CASCADE,
-  revcomment_comment_id bigint unsigned NOT NULL CONSTRAINT FK_revcomment_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  revcomment_comment_id bigint NOT NULL CONSTRAINT FK_revcomment_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   CONSTRAINT PK_revision_comment_temp PRIMARY KEY (revcomment_rev, revcomment_comment_id)
 );
 CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
 
 
 CREATE TABLE /*_*/image_comment_temp (
-  imgcomment_name nvarchar(255) NOT NULL CONSTRAINT FK_imgcomment_name FOREIGN KEY REFERENCES /*_*/image(imgcomment_name) ON DELETE CASCADE,
-  imgcomment_description_id bigint unsigned NOT NULL CONSTRAINT FK_imgcomment_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  imgcomment_name nvarchar(255) NOT NULL CONSTRAINT FK_imgcomment_name FOREIGN KEY REFERENCES /*_*/image(img_name) ON DELETE CASCADE,
+  imgcomment_description_id bigint NOT NULL CONSTRAINT FK_imgcomment_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   CONSTRAINT PK_image_comment_temp PRIMARY KEY (imgcomment_name, imgcomment_description_id)
 );
 CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name);
@@ -34,24 +34,24 @@ CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_
 ALTER TABLE /*_*/revision ADD CONSTRAINT DF_rev_comment DEFAULT '' FOR rev_comment;
 
 ALTER TABLE /*_*/archive ADD CONSTRAINT DF_ar_comment DEFAULT '' FOR ar_comment;
-ALTER TABLE /*_*/archive ADD ar_comment_id bigint unsigned NOT NULL CONSTRAINT DF_ar_comment_id DEFAULT 0 CONSTRAINT FK_ar_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/archive ADD ar_comment_id bigint NOT NULL CONSTRAINT DF_ar_comment_id DEFAULT 0 CONSTRAINT FK_ar_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
 
 ALTER TABLE /*_*/ipblocks ADD CONSTRAINT DF_ipb_reason DEFAULT '' FOR ipb_reason;
-ALTER TABLE /*_*/ipblocks ADD ipb_reason_id bigint unsigned NOT NULL CONSTRAINT DF_ipb_reason_id DEFAULT 0 CONSTRAINT FK_ipb_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/ipblocks ADD ipb_reason_id bigint NOT NULL CONSTRAINT DF_ipb_reason_id DEFAULT 0 CONSTRAINT FK_ipb_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
 
 ALTER TABLE /*_*/image ADD CONSTRAINT DF_img_description DEFAULT '' FOR img_description;
 
 ALTER TABLE /*_*/oldimage ADD CONSTRAINT DF_oi_description DEFAULT '' FOR oi_description;
-ALTER TABLE /*_*/oldimage ADD oi_description_id bigint unsigned NOT NULL CONSTRAINT DF_oi_description_id DEFAULT 0 CONSTRAINT FK_oi_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/oldimage ADD oi_description_id bigint NOT NULL CONSTRAINT DF_oi_description_id DEFAULT 0 CONSTRAINT FK_oi_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
 
 ALTER TABLE /*_*/filearchive ADD CONSTRAINT DF_fa_deleted_reason DEFAULT '' FOR fa_deleted_reason;
-ALTER TABLE /*_*/filearchive ADD fa_deleted_reason_id bigint unsigned NOT NULL CONSTRAINT DF_fa_deleted_reason_id DEFAULT 0 CONSTRAINT FK_fa_deleted_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/filearchive ADD fa_deleted_reason_id bigint NOT NULL CONSTRAINT DF_fa_deleted_reason_id DEFAULT 0 CONSTRAINT FK_fa_deleted_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
 ALTER TABLE /*_*/filearchive ADD CONSTRAINT DF_fa_description DEFAULT '' FOR fa_description;
-ALTER TABLE /*_*/filearchive ADD fa_description_id bigint unsigned NOT NULL CONSTRAINT DF_fa_description_id DEFAULT 0 CONSTRAINT FK_fa_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/filearchive ADD fa_description_id bigint NOT NULL CONSTRAINT DF_fa_description_id DEFAULT 0 CONSTRAINT FK_fa_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
 
-ALTER TABLE /*_*/recentchanges ADD rc_comment_id bigint unsigned NOT NULL CONSTRAINT DF_rc_comment_id DEFAULT 0 CONSTRAINT FK_rc_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/recentchanges ADD rc_comment_id bigint NOT NULL CONSTRAINT DF_rc_comment_id DEFAULT 0 CONSTRAINT FK_rc_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
 
-ALTER TABLE /*_*/logging ADD log_comment_id bigint unsigned NOT NULL CONSTRAINT DF_log_comment_id DEFAULT 0 CONSTRAINT FK_log_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/logging ADD log_comment_id bigint NOT NULL CONSTRAINT DF_log_comment_id DEFAULT 0 CONSTRAINT FK_log_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
 
 ALTER TABLE /*_*/protected_titles ADD CONSTRAINT DF_pt_reason DEFAULT '' FOR pt_reason;
-ALTER TABLE /*_*/protected_titles ADD pt_reason_id bigint unsigned NOT NULL CONSTRAINT DF_pt_reason_id DEFAULT 0 CONSTRAINT FK_pt_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
+ALTER TABLE /*_*/protected_titles ADD pt_reason_id bigint NOT NULL CONSTRAINT DF_pt_reason_id DEFAULT 0 CONSTRAINT FK_pt_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id);
index c5b079a..a899f27 100644 (file)
@@ -5,17 +5,17 @@
 CREATE TABLE /*_*/content (
 
   -- ID of the content object
-  content_id bigint unsigned NOT NULL CONSTRAINT PK_content PRIMARY KEY IDENTITY,
+  content_id bigint NOT NULL CONSTRAINT PK_content PRIMARY KEY IDENTITY,
 
   -- Nominal size of the content object (not necessarily of the serialized blob)
-  content_size int unsigned NOT NULL,
+  content_size int NOT NULL,
 
   -- Nominal hash of the content object (not necessarily of the serialized blob)
   content_sha1 varchar(32) NOT NULL,
 
   -- reference to model_id
-  content_model smallint unsigned NOT NULL CONSTRAINT FK_content_content_models FOREIGN KEY REFERENCES /*_*/content_models(model_id),
+  content_model smallint NOT NULL CONSTRAINT FK_content_content_models FOREIGN KEY REFERENCES /*_*/content_models(model_id),
 
   -- URL-like address of the content blob
   content_address nvarchar(255) NOT NULL
-);
\ No newline at end of file
+);
index e9ec7c3..2fc615e 100644 (file)
@@ -6,17 +6,17 @@
 CREATE TABLE /*_*/slots (
 
   -- reference to rev_id
-  slot_revision_id bigint unsigned NOT NULL,
+  slot_revision_id bigint NOT NULL,
 
   -- reference to role_id
-  slot_role_id smallint unsigned NOT NULL CONSTRAINT FK_slots_slot_role FOREIGN KEY REFERENCES slot_roles(role_id),
+  slot_role_id smallint NOT NULL CONSTRAINT FK_slots_slot_role FOREIGN KEY REFERENCES slot_roles(role_id),
 
   -- reference to content_id
-  slot_content_id bigint unsigned NOT NULL CONSTRAINT FK_slots_content_id FOREIGN KEY REFERENCES content(content_id),
+  slot_content_id bigint NOT NULL CONSTRAINT FK_slots_content_id FOREIGN KEY REFERENCES content(content_id),
 
   -- The revision ID of the revision that originated the slot's content.
   -- To find revisions that changed slots, look for slot_origin = slot_revision_id.
-  slot_origin bigint unsigned NOT NULL,
+  slot_origin bigint NOT NULL,
 
   CONSTRAINT PK_slots PRIMARY KEY (slot_revision_id, slot_role_id)
 );
index 8f30e80..f040c15 100644 (file)
@@ -61,8 +61,8 @@ INSERT INTO /*_*/mwuser (user_name) VALUES ('##Anonymous##');
 -- can refer to the user table directly.
 --
 CREATE TABLE /*_*/actor (
-  actor_id bigint unsigned NOT NULL CONSTRAINT PK_actor PRIMARY KEY IDENTITY(0,1),
-  actor_user int unsigned,
+  actor_id bigint NOT NULL CONSTRAINT PK_actor PRIMARY KEY IDENTITY(0,1),
+  actor_user int,
   actor_name nvarchar(255) NOT NULL
 );
 CREATE UNIQUE INDEX /*i*/actor_user ON /*_*/actor (actor_user);
@@ -144,7 +144,7 @@ CREATE TABLE /*_*/bot_passwords (
 -- the same comment_text and comment_data.
 --
 CREATE TABLE /*_*/comment (
-  comment_id bigint unsigned NOT NULL PRIMARY KEY IDENTITY(0,1),
+  comment_id bigint NOT NULL PRIMARY KEY IDENTITY(0,1),
   comment_hash INT NOT NULL,
   comment_text nvarchar(max) NOT NULL,
   comment_data nvarchar(max)
@@ -225,16 +225,16 @@ ALTER TABLE /*_*/page ADD CONSTRAINT FK_page_latest_page_id FOREIGN KEY (page_la
 --
 CREATE TABLE /*_*/revision_comment_temp (
   revcomment_rev INT NOT NULL CONSTRAINT FK_revcomment_rev FOREIGN KEY REFERENCES /*_*/revision(rev_id) ON DELETE CASCADE,
-  revcomment_comment_id bigint unsigned NOT NULL CONSTRAINT FK_revcomment_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  revcomment_comment_id bigint NOT NULL CONSTRAINT FK_revcomment_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   CONSTRAINT PK_revision_comment_temp PRIMARY KEY (revcomment_rev, revcomment_comment_id)
 );
 CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
 
 CREATE TABLE /*_*/revision_actor_temp (
-  revactor_rev int unsigned NOT NULL CONSTRAINT FK_revactor_rev FOREIGN KEY REFERENCES /*_*/revision(rev_id) ON DELETE CASCADE,
-  revactor_actor bigint unsigned NOT NULL,
+  revactor_rev int NOT NULL CONSTRAINT FK_revactor_rev FOREIGN KEY REFERENCES /*_*/revision(rev_id) ON DELETE CASCADE,
+  revactor_actor bigint NOT NULL,
   revactor_timestamp varchar(14) NOT NULL CONSTRAINT DF_revactor_timestamp DEFAULT '',
-  revactor_page int unsigned NOT NULL,
+  revactor_page int NOT NULL,
   CONSTRAINT PK_revision_actor_temp PRIMARY KEY (revactor_rev, revactor_actor)
 );
 CREATE UNIQUE INDEX /*i*/revactor_rev ON /*_*/revision_actor_temp (revactor_rev);
@@ -271,10 +271,10 @@ CREATE TABLE /*_*/archive (
    ar_namespace SMALLINT NOT NULL DEFAULT 0,
    ar_title NVARCHAR(255) NOT NULL DEFAULT '',
    ar_comment NVARCHAR(255) NOT NULL CONSTRAINT DF_ar_comment DEFAULT '',
-   ar_comment_id bigint unsigned NOT NULL CONSTRAINT DF_ar_comment_id DEFAULT 0 CONSTRAINT FK_ar_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+   ar_comment_id bigint NOT NULL CONSTRAINT DF_ar_comment_id DEFAULT 0 CONSTRAINT FK_ar_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
    ar_user INT CONSTRAINT ar_user__user_id__fk FOREIGN KEY REFERENCES /*_*/mwuser(user_id),
    ar_user_text NVARCHAR(255) NOT NULL CONSTRAINT DF_ar_user_text DEFAULT '',
-   ar_actor bigint unsigned NOT NULL CONSTRAINT DF_ar_actor DEFAULT 0,
+   ar_actor bigint NOT NULL CONSTRAINT DF_ar_actor DEFAULT 0,
    ar_timestamp varchar(14) NOT NULL default '',
    ar_minor_edit BIT NOT NULL DEFAULT 0,
    ar_rev_id INT NOT NULL, -- NOT a FK, the row gets deleted from revision and moved here
@@ -294,30 +294,26 @@ CREATE UNIQUE INDEX /*i*/ar_revid_uniq ON /*_*/archive (ar_rev_id);
 
 
 --
--- Slots represent an n:m relation between revisions and content objects.
--- A content object can have a specific "role" in one or more revisions.
--- Each revision can have multiple content objects, each having a different role.
+-- Normalization table for role names
 --
-CREATE TABLE /*_*/slots (
-
-  -- reference to rev_id
-  slot_revision_id bigint unsigned NOT NULL,
-
-  -- reference to role_id
-  slot_role_id smallint unsigned NOT NULL CONSTRAINT FK_slots_slot_role FOREIGN KEY REFERENCES slot_roles(role_id),
-
-  -- reference to content_id
-  slot_content_id bigint unsigned NOT NULL CONSTRAINT FK_slots_content_id FOREIGN KEY REFERENCES content(content_id),
+CREATE TABLE /*_*/slot_roles (
+  role_id smallint NOT NULL CONSTRAINT PK_slot_roles PRIMARY KEY IDENTITY,
+  role_name nvarchar(64) NOT NULL
+);
 
-  -- The revision ID of the revision that originated the slot's content.
-  -- To find revisions that changed slots, look for slot_origin = slot_revision_id.
-  slot_origin bigint NOT NULL,
+-- Index for looking of the internal ID of for a name
+CREATE UNIQUE INDEX /*i*/role_name ON /*_*/slot_roles (role_name);
 
-  CONSTRAINT PK_slots PRIMARY KEY (slot_revision_id, slot_role_id)
+--
+-- Normalization table for content model names
+--
+CREATE TABLE /*_*/content_models (
+  model_id smallint NOT NULL CONSTRAINT PK_content_models PRIMARY KEY IDENTITY,
+  model_name nvarchar(64) NOT NULL
 );
 
--- Index for finding revisions that modified a specific slot
-CREATE INDEX /*i*/slot_revision_origin_role ON /*_*/slots (slot_revision_id, slot_origin, slot_role_id);
+-- Index for looking of the internal ID of for a name
+CREATE UNIQUE INDEX /*i*/model_name ON /*_*/content_models (model_name);
 
 --
 -- The content table represents content objects. It's primary purpose is to provide the necessary
@@ -326,42 +322,46 @@ CREATE INDEX /*i*/slot_revision_origin_role ON /*_*/slots (slot_revision_id, slo
 CREATE TABLE /*_*/content (
 
   -- ID of the content object
-  content_id bigint unsigned NOT NULL CONSTRAINT PK_content PRIMARY KEY IDENTITY,
+  content_id bigint NOT NULL CONSTRAINT PK_content PRIMARY KEY IDENTITY,
 
   -- Nominal size of the content object (not necessarily of the serialized blob)
-  content_size int unsigned NOT NULL,
+  content_size int NOT NULL,
 
   -- Nominal hash of the content object (not necessarily of the serialized blob)
   content_sha1 varchar(32) NOT NULL,
 
   -- reference to model_id
-  content_model smallint unsigned NOT NULL CONSTRAINT FK_content_content_models FOREIGN KEY REFERENCES /*_*/content_models(model_id),
+  content_model smallint NOT NULL CONSTRAINT FK_content_content_models FOREIGN KEY REFERENCES /*_*/content_models(model_id),
 
   -- URL-like address of the content blob
   content_address nvarchar(255) NOT NULL
 );
 
 --
--- Normalization table for role names
+-- Slots represent an n:m relation between revisions and content objects.
+-- A content object can have a specific "role" in one or more revisions.
+-- Each revision can have multiple content objects, each having a different role.
 --
-CREATE TABLE /*_*/slot_roles (
-  role_id smallint NOT NULL CONSTRAINT PK_slot_roles PRIMARY KEY IDENTITY,
-  role_name nvarchar(64) NOT NULL
-);
+CREATE TABLE /*_*/slots (
 
--- Index for looking of the internal ID of for a name
-CREATE UNIQUE INDEX /*i*/role_name ON /*_*/slot_roles (role_name);
+  -- reference to rev_id
+  slot_revision_id bigint NOT NULL,
 
---
--- Normalization table for content model names
---
-CREATE TABLE /*_*/content_models (
-  model_id smallint NOT NULL CONSTRAINT PK_content_models PRIMARY KEY IDENTITY,
-  model_name nvarchar(64) NOT NULL
+  -- reference to role_id
+  slot_role_id smallint NOT NULL CONSTRAINT FK_slots_slot_role FOREIGN KEY REFERENCES slot_roles(role_id),
+
+  -- reference to content_id
+  slot_content_id bigint NOT NULL CONSTRAINT FK_slots_content_id FOREIGN KEY REFERENCES content(content_id),
+
+  -- The revision ID of the revision that originated the slot's content.
+  -- To find revisions that changed slots, look for slot_origin = slot_revision_id.
+  slot_origin bigint NOT NULL,
+
+  CONSTRAINT PK_slots PRIMARY KEY (slot_revision_id, slot_role_id)
 );
 
--- Index for looking of the internal ID of for a name
-CREATE UNIQUE INDEX /*i*/model_name ON /*_*/content_models (model_name);
+-- Index for finding revisions that modified a specific slot
+CREATE INDEX /*i*/slot_revision_origin_role ON /*_*/slots (slot_revision_id, slot_origin, slot_role_id);
 
 
 --
@@ -643,7 +643,7 @@ CREATE TABLE /*_*/ipblocks (
   ipb_by int REFERENCES /*_*/mwuser(user_id) ON DELETE CASCADE,
 
   -- Actor ID who made the block.
-  ipb_by_actor bigint unsigned NOT NULL CONSTRAINT DF_ipb_by_actor DEFAULT 0,
+  ipb_by_actor bigint NOT NULL CONSTRAINT DF_ipb_by_actor DEFAULT 0,
 
   -- User name of blocker
   ipb_by_text nvarchar(255) NOT NULL default '',
@@ -653,7 +653,7 @@ CREATE TABLE /*_*/ipblocks (
 
   -- Key to comment_id. Text comment made by blocker.
   -- ("DEFAULT 0" is temporary, signaling that ipb_reason should be used)
-  ipb_reason_id bigint unsigned NOT NULL CONSTRAINT DF_ipb_reason_id DEFAULT 0 CONSTRAINT FK_ipb_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  ipb_reason_id bigint NOT NULL CONSTRAINT DF_ipb_reason_id DEFAULT 0 CONSTRAINT FK_ipb_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
 
   -- Creation (or refresh) date in standard YMDHMS form.
   -- IP blocks expire automatically.
@@ -756,7 +756,7 @@ CREATE TABLE /*_*/image (
   -- user_id and user_name of uploader.
   img_user int REFERENCES /*_*/mwuser(user_id) ON DELETE SET NULL,
   img_user_text nvarchar(255) NOT NULL CONSTRAINT DF_img_user_text DEFAULT '',
-  img_actor bigint unsigned NOT NULL CONSTRAINT DF_img_actor DEFAULT 0,
+  img_actor bigint NOT NULL CONSTRAINT DF_img_actor DEFAULT 0,
 
   -- Time of the upload.
   img_timestamp nvarchar(14) NOT NULL default '',
@@ -787,8 +787,8 @@ CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,im
 -- will be merged back into image in the future.
 --
 CREATE TABLE /*_*/image_comment_temp (
-  imgcomment_name nvarchar(255) NOT NULL CONSTRAINT FK_imgcomment_name FOREIGN KEY REFERENCES /*_*/image(imgcomment_name) ON DELETE CASCADE,
-  imgcomment_description_id bigint unsigned NOT NULL CONSTRAINT FK_imgcomment_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  imgcomment_name nvarchar(255) NOT NULL CONSTRAINT FK_imgcomment_name FOREIGN KEY REFERENCES /*_*/image(img_name) ON DELETE CASCADE,
+  imgcomment_description_id bigint NOT NULL CONSTRAINT FK_imgcomment_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   CONSTRAINT PK_image_comment_temp PRIMARY KEY (imgcomment_name, imgcomment_description_id)
 );
 CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name);
@@ -814,10 +814,10 @@ CREATE TABLE /*_*/oldimage (
   oi_height int NOT NULL default 0,
   oi_bits int NOT NULL default 0,
   oi_description nvarchar(255) NOT NULL CONSTRAINT DF_oi_description DEFAULT '',
-  oi_description_id bigint unsigned NOT NULL CONSTRAINT DF_oi_description_id DEFAULT 0 CONSTRAINT FK_oi_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  oi_description_id bigint NOT NULL CONSTRAINT DF_oi_description_id DEFAULT 0 CONSTRAINT FK_oi_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   oi_user int REFERENCES /*_*/mwuser(user_id),
   oi_user_text nvarchar(255) NOT NULL CONSTRAINT DF_oi_user_text DEFAULT '',
-  oi_actor bigint unsigned NOT NULL CONSTRAINT DF_oi_actor DEFAULT 0,
+  oi_actor bigint NOT NULL CONSTRAINT DF_oi_actor DEFAULT 0,
   oi_timestamp varchar(14) NOT NULL default '',
 
   oi_metadata varbinary(max) NOT NULL,
@@ -866,7 +866,7 @@ CREATE TABLE /*_*/filearchive (
   fa_deleted_user int,
   fa_deleted_timestamp varchar(14) default '',
   fa_deleted_reason nvarchar(max) CONSTRAINT DF_fa_deleted_reason DEFAULT '',
-  fa_deleted_reason_id bigint unsigned NOT NULL CONSTRAINT DF_fa_deleted_reason_id DEFAULT 0 CONSTRAINT FK_fa_deleted_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  fa_deleted_reason_id bigint NOT NULL CONSTRAINT DF_fa_deleted_reason_id DEFAULT 0 CONSTRAINT FK_fa_deleted_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
 
   -- Duped fields from image
   fa_size int default 0,
@@ -878,10 +878,10 @@ CREATE TABLE /*_*/filearchive (
   fa_major_mime varchar(16) not null default 'unknown',
   fa_minor_mime nvarchar(100) default 'unknown',
   fa_description nvarchar(255) CONSTRAINT DF_fa_description DEFAULT '',
-  fa_description_id bigint unsigned NOT NULL CONSTRAINT DF_fa_description DEFAULT 0 CONSTRAINT FK_fa_description FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  fa_description_id bigint NOT NULL CONSTRAINT DF_fa_description_id DEFAULT 0 CONSTRAINT FK_fa_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   fa_user int default 0 REFERENCES /*_*/mwuser(user_id) ON DELETE SET NULL,
   fa_user_text nvarchar(255) CONSTRAINT DF_fa_user_text DEFAULT '',
-  fa_actor bigint unsigned NOT NULL CONSTRAINT DF_fa_actor DEFAULT 0,
+  fa_actor bigint NOT NULL CONSTRAINT DF_fa_actor DEFAULT 0,
   fa_timestamp varchar(14) default '',
 
   -- Visibility of deleted revisions, bitfield
@@ -976,7 +976,7 @@ CREATE TABLE /*_*/recentchanges (
   -- As in revision
   rc_user int NOT NULL default 0 CONSTRAINT rc_user__user_id__fk FOREIGN KEY REFERENCES /*_*/mwuser(user_id),
   rc_user_text nvarchar(255) NOT NULL CONSTRAINT DF_rc_user_text DEFAULT '',
-  rc_actor bigint unsigned NOT NULL CONSTRAINT DF_rc_actor DEFAULT 0,
+  rc_actor bigint NOT NULL CONSTRAINT DF_rc_actor DEFAULT 0,
 
   -- When pages are renamed, their RC entries do _not_ change.
   rc_namespace int NOT NULL default 0,
@@ -984,7 +984,7 @@ CREATE TABLE /*_*/recentchanges (
 
   -- as in revision...
   rc_comment nvarchar(255) NOT NULL default '',
-  rc_comment_id bigint unsigned NOT NULL CONSTRAINT DF_rc_comment_id DEFAULT 0 CONSTRAINT FK_rc_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  rc_comment_id bigint NOT NULL CONSTRAINT DF_rc_comment_id DEFAULT 0 CONSTRAINT FK_rc_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   rc_minor bit NOT NULL default 0,
 
   -- Edits by user accounts with the 'bot' rights key are
@@ -1180,7 +1180,7 @@ CREATE TABLE /*_*/logging (
   log_user_text nvarchar(255) NOT NULL default '',
 
   -- The actor who performed this action
-  log_actor bigint unsigned NOT NULL CONSTRAINT DF_log_actor DEFAULT 0,
+  log_actor bigint NOT NULL CONSTRAINT DF_log_actor DEFAULT 0,
 
   -- Key to the page affected. Where a user is the target,
   -- this will point to the user page.
@@ -1193,7 +1193,7 @@ CREATE TABLE /*_*/logging (
 
   -- Key to comment_id. Comment summarizing the change.
   -- ("DEFAULT 0" is temporary, signaling that log_comment should be used)
-  log_comment_id bigint unsigned NOT NULL CONSTRAINT DF_log_comment_id DEFAULT 0 CONSTRAINT FK_log_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  log_comment_id bigint NOT NULL CONSTRAINT DF_log_comment_id DEFAULT 0 CONSTRAINT FK_log_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
 
   -- miscellaneous parameters:
   -- LF separated list (old system) or serialized PHP array (new system)
@@ -1358,7 +1358,7 @@ CREATE TABLE /*_*/protected_titles (
   pt_title nvarchar(255) NOT NULL,
   pt_user int REFERENCES /*_*/mwuser(user_id) ON DELETE SET NULL,
   pt_reason nvarchar(255) CONSTRAINT DF_pt_reason DEFAULT '',
-  pt_reason_id bigint unsigned NOT NULL CONSTRAINT DF_pt_reason_id DEFAULT 0 CONSTRAINT FK_pt_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
+  pt_reason_id bigint NOT NULL CONSTRAINT DF_pt_reason_id DEFAULT 0 CONSTRAINT FK_pt_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
   pt_timestamp varchar(14) NOT NULL,
   pt_expiry varchar(14) NOT NULL,
   pt_create_perm nvarchar(60) NOT NULL,
index 93c7531..8a33888 100644 (file)
@@ -36,29 +36,29 @@ CREATE UNIQUE INDEX &mw_prefix.revactor_rev ON &mw_prefix.revision_actor_temp (r
 CREATE INDEX &mw_prefix.actor_timestamp ON &mw_prefix.revision_actor_temp (revactor_actor,revactor_timestamp);
 CREATE INDEX &mw_prefix.page_actor_timestamp ON &mw_prefix.revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp);
 
-ALTER TABLE &mw_prefix.archive ALTER COLUMN ar_user_text VARCHAR2(255) NULL;
-ALTER TABLE &mw_prefix.archive ADD COLUMN ar_actor NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.archive MODIFY ( ar_user_text NULL );
+ALTER TABLE &mw_prefix.archive ADD ( ar_actor NUMBER DEFAULT 0 NOT NULL );
 CREATE INDEX &mw_prefix.ar_actor_timestamp ON &mw_prefix.archive (ar_actor,ar_timestamp);
 
-ALTER TABLE &mw_prefix.ipblocks ADD COLUMN ipb_by_actor NUMBER DEFUALT 0 NOT NULL;
+ALTER TABLE &mw_prefix.ipblocks ADD ( ipb_by_actor NUMBER DEFAULT 0 NOT NULL );
 
-ALTER TABLE &mw_prefix.image ALTER COLUMN img_user_text VARCHAR2(255) NULL;
-ALTER TABLE &mw_prefix.image ADD COLUMN img_actor NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.image MODIFY ( img_user_text NULL );
+ALTER TABLE &mw_prefix.image ADD ( img_actor NUMBER DEFAULT 0 NOT NULL );
 CREATE INDEX &mw_prefix.img_actor_timestamp ON &mw_prefix.image (img_actor, img_timestamp);
 
-ALTER TABLE &mw_prefix.oldimage ALTER COLUMN oi_user_text VARCHAR2(255) NULL;
-ALTER TABLE &mw_prefix.oldimage ADD COLUMN oi_actor NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.oldimage MODIFY ( oi_user_text NULL );
+ALTER TABLE &mw_prefix.oldimage ADD ( oi_actor NUMBER DEFAULT 0 NOT NULL );
 CREATE INDEX &mw_prefix.oi_actor_timestamp ON &mw_prefix.oldimage (oi_actor,oi_timestamp);
 
-ALTER TABLE &mw_prefix.filearchive ALTER COLUMN fa_user_text VARCHAR2(255) NULL;
-ALTER TABLE &mw_prefix.filearchive ADD COLUMN fa_actor NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.filearchive MODIFY ( fa_user_text NULL );
+ALTER TABLE &mw_prefix.filearchive ADD ( fa_actor NUMBER DEFAULT 0 NOT NULL );
 CREATE INDEX &mw_prefix.fa_actor_timestamp ON &mw_prefix.filearchive (fa_actor,fa_timestamp);
 
-ALTER TABLE &mw_prefix.recentchanges ALTER COLUMN rc_user_text VARCHAR2(255) NULL;
-ALTER TABLE &mw_prefix.recentchanges ADD COLUMN rc_actor NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.recentchanges MODIFY ( rc_user_text NULL );
+ALTER TABLE &mw_prefix.recentchanges ADD ( rc_actor NUMBER DEFAULT 0 NOT NULL );
 CREATE INDEX &mw_prefix.rc_ns_actor ON &mw_prefix.recentchanges (rc_namespace, rc_actor);
 CREATE INDEX &mw_prefix.rc_actor ON &mw_prefix.recentchanges (rc_actor, rc_timestamp);
 
-ALTER TABLE &mw_prefix.logging ADD COLUMN log_actor NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.logging ADD ( log_actor NUMBER DEFAULT 0 NOT NULL );
 CREATE INDEX &mw_prefix.actor_time ON &mw_prefix.logging (log_actor, log_timestamp);
 CREATE INDEX &mw_prefix.log_actor_type_time ON &mw_prefix.logging (log_actor, log_type, log_timestamp);
index cfe944f..cdab291 100644 (file)
@@ -43,26 +43,26 @@ ALTER TABLE &mw_prefix.image_comment_temp ADD CONSTRAINT &mw_prefix.image_commen
 CREATE UNIQUE INDEX &mw_prefix.imgcomment_name ON &mw_prefix.image_comment_temp (imgcomment_name);
 
 
-ALTER TABLE &mw_prefix.archive ADD COLUMN ar_comment_id NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.archive ADD ( ar_comment_id NUMBER DEFAULT 0 NOT NULL );
 ALTER TABLE &mw_prefix.archive ADD CONSTRAINT &mw_prefix.archive_fk2 FOREIGN KEY (ar_comment_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE &mw_prefix.ipblocks ALTER COLUMN ipb_reason VARCHAR2(255) NULL;
-ALTER TABLE &mw_prefix.ipblocks ADD COLUMN ipb_reason_id NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.ipblocks MODIFY ( ipb_reason NULL );
+ALTER TABLE &mw_prefix.ipblocks ADD ( ipb_reason_id NUMBER DEFAULT 0 NOT NULL );
 ALTER TABLE &mw_prefix.ipblocks ADD CONSTRAINT &mw_prefix.ipblocks_fk3 FOREIGN KEY (ipb_reason_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE &mw_prefix.oldimage ADD COLUMN oi_description_id NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.oldimage ADD ( oi_description_id NUMBER DEFAULT 0 NOT NULL );
 ALTER TABLE &mw_prefix.oldimage ADD CONSTRAINT &mw_prefix.oldimage_fk3 FOREIGN KEY (oi_description_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE &mw_prefix.filearchive ADD COLUMN fa_deleted_reason_id NUMBER DEFAULT 0 NOT NULL;
-ALTER TABLE &mw_prefix.filearchive ADD COLUMN fa_description_id NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.filearchive ADD ( fa_deleted_reason_id NUMBER DEFAULT 0 NOT NULL );
+ALTER TABLE &mw_prefix.filearchive ADD ( fa_description_id NUMBER DEFAULT 0 NOT NULL );
 ALTER TABLE &mw_prefix.filearchive ADD CONSTRAINT &mw_prefix.filearchive_fk3 FOREIGN KEY (fa_deleted_reason_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 ALTER TABLE &mw_prefix.filearchive ADD CONSTRAINT &mw_prefix.filearchive_fk4 FOREIGN KEY (fa_description_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE &mw_prefix.recentchanges ADD COLUMN rc_comment_id NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.recentchanges ADD ( rc_comment_id NUMBER DEFAULT 0 NOT NULL );
 ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_fk3 FOREIGN KEY (rc_comment_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE &mw_prefix.logging ADD COLUMN log_comment_id NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.logging ADD ( log_comment_id NUMBER DEFAULT 0 NOT NULL );
 ALTER TABLE &mw_prefix.logging ADD CONSTRAINT &mw_prefix.logging_fk2 FOREIGN KEY (log_comment_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE &mw_prefix.protected_titles ADD COLUMN pt_reason_id NUMBER DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.protected_titles ADD ( pt_reason_id NUMBER DEFAULT 0 NOT NULL );
 ALTER TABLE &mw_prefix.protected_titles ADD CONSTRAINT &mw_prefix.protected_titles_fk1 FOREIGN KEY (pt_reason_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
index 612f089..b5e423d 100644 (file)
@@ -496,7 +496,7 @@ CREATE TABLE &mw_prefix.ipblocks (
   ipb_user              NUMBER      DEFAULT 0 NOT  NULL,
   ipb_by                NUMBER      DEFAULT 0 NOT NULL,
   ipb_by_text           VARCHAR2(255)      NULL,
-  ipb_by_actor          NUMBER      DEFUALT 0 NOT NULL,
+  ipb_by_actor          NUMBER      DEFAULT 0 NOT NULL,
   ipb_reason            VARCHAR2(255)      NULL,
   ipb_reason_id         NUMBER DEFAULT 0 NOT NULL,
   ipb_timestamp         TIMESTAMP(6) WITH TIME ZONE  NOT NULL,
index 68bc61e..5eb91c3 100644 (file)
@@ -1250,7 +1250,7 @@ class ParserTestRunner {
         * For best performance, call this once only for all tests. However, it can
         * be called at the start of each test if more isolation is desired.
         *
-        * @todo: This is basically an unrefactored copy of
+        * @todo This is basically an unrefactored copy of
         * MediaWikiTestCase::setupAllTestDBs. They should be factored out somehow.
         *
         * Do not call this function from a MediaWikiTestCase subclass, since
diff --git a/tests/phpunit/includes/GlobalFunctions/WfExpandUrlTest.php b/tests/phpunit/includes/GlobalFunctions/WfExpandUrlTest.php
new file mode 100644 (file)
index 0000000..f008830
--- /dev/null
@@ -0,0 +1,153 @@
+<?php
+/**
+ * @group GlobalFunctions
+ * @covers ::wfExpandUrl
+ */
+class WfExpandUrlTest extends MediaWikiTestCase {
+       /**
+        * @dataProvider provideExpandableUrls
+        */
+       public function testWfExpandUrl( $fullUrl, $shortUrl, $defaultProto,
+               $server, $canServer, $httpsMode, $httpsPort, $message
+       ) {
+               // Fake $wgServer, $wgCanonicalServer and $wgRequest->getProtocol()
+               // fake edit to fake globals
+               $this->setMwGlobals( [
+                       'wgServer' => $server,
+                       'wgCanonicalServer' => $canServer,
+                       'wgRequest' => new FauxRequest( [], false, null, $httpsMode ? 'https' : 'http' ),
+                       'wgHttpsPort' => $httpsPort
+               ] );
+
+               $this->assertEquals( $fullUrl, wfExpandUrl( $shortUrl, $defaultProto ), $message );
+       }
+
+       /**
+        * Provider of URL examples for testing wfExpandUrl()
+        *
+        * @return array
+        */
+       public static function provideExpandableUrls() {
+               $modes = [ 'http', 'https' ];
+               $servers = [
+                       'http' => 'http://example.com',
+                       'https' => 'https://example.com',
+                       'protocol-relative' => '//example.com'
+               ];
+               $defaultProtos = [
+                       'http' => PROTO_HTTP,
+                       'https' => PROTO_HTTPS,
+                       'protocol-relative' => PROTO_RELATIVE,
+                       'current' => PROTO_CURRENT,
+                       'canonical' => PROTO_CANONICAL
+               ];
+
+               $retval = [];
+               foreach ( $modes as $mode ) {
+                       $httpsMode = $mode == 'https';
+                       foreach ( $servers as $serverDesc => $server ) {
+                               foreach ( $modes as $canServerMode ) {
+                                       $canServer = "$canServerMode://example2.com";
+                                       foreach ( $defaultProtos as $protoDesc => $defaultProto ) {
+                                               $retval[] = [
+                                                       'http://example.com', 'http://example.com',
+                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
+                                                       "Testing fully qualified http URLs (no need to expand) "
+                                                               . "(defaultProto: $protoDesc , wgServer: $server, "
+                                                               . "wgCanonicalServer: $canServer, current request protocol: $mode )"
+                                               ];
+                                               $retval[] = [
+                                                       'https://example.com', 'https://example.com',
+                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
+                                                       "Testing fully qualified https URLs (no need to expand) "
+                                                               . "(defaultProto: $protoDesc , wgServer: $server, "
+                                                               . "wgCanonicalServer: $canServer, current request protocol: $mode )"
+                                               ];
+                                               # Would be nice to support this, see fixme on wfExpandUrl()
+                                               $retval[] = [
+                                                       "wiki/FooBar", 'wiki/FooBar',
+                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
+                                                       "Test non-expandable relative URLs (defaultProto: $protoDesc, "
+                                                               . "wgServer: $server, wgCanonicalServer: $canServer, "
+                                                               . "current request protocol: $mode )"
+                                               ];
+
+                                               // Determine expected protocol
+                                               if ( $protoDesc == 'protocol-relative' ) {
+                                                       $p = '';
+                                               } elseif ( $protoDesc == 'current' ) {
+                                                       $p = "$mode:";
+                                               } elseif ( $protoDesc == 'canonical' ) {
+                                                       $p = "$canServerMode:";
+                                               } else {
+                                                       $p = $protoDesc . ':';
+                                               }
+                                               // Determine expected server name
+                                               if ( $protoDesc == 'canonical' ) {
+                                                       $srv = $canServer;
+                                               } elseif ( $serverDesc == 'protocol-relative' ) {
+                                                       $srv = $p . $server;
+                                               } else {
+                                                       $srv = $server;
+                                               }
+
+                                               $retval[] = [
+                                                       "$p//wikipedia.org", '//wikipedia.org',
+                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
+                                                       "Test protocol-relative URL (defaultProto: $protoDesc, "
+                                                               . "wgServer: $server, wgCanonicalServer: $canServer, "
+                                                               . "current request protocol: $mode )"
+                                               ];
+                                               $retval[] = [
+                                                       "$srv/wiki/FooBar",
+                                                       '/wiki/FooBar',
+                                                       $defaultProto,
+                                                       $server,
+                                                       $canServer,
+                                                       $httpsMode,
+                                                       443,
+                                                       "Testing expanding URL beginning with / (defaultProto: $protoDesc, "
+                                                               . "wgServer: $server, wgCanonicalServer: $canServer, "
+                                                               . "current request protocol: $mode )"
+                                               ];
+                                       }
+                               }
+                       }
+               }
+
+               // Don't add HTTPS port to foreign URLs
+               $retval[] = [
+                       'https://foreign.example.com/foo',
+                       'https://foreign.example.com/foo',
+                       PROTO_HTTPS,
+                       '//wiki.example.com',
+                       'http://wiki.example.com',
+                       'https',
+                       111,
+                       "Don't add HTTPS port to foreign URLs"
+               ];
+               $retval[] = [
+                       'https://foreign.example.com:222/foo',
+                       'https://foreign.example.com:222/foo',
+                       PROTO_HTTPS,
+                       '//wiki.example.com',
+                       'http://wiki.example.com',
+                       'https',
+                       111,
+                       "Don't overwrite HTTPS port of foreign URLs"
+               ];
+               // Do add HTTPS port to local URLs
+               $retval[] = [
+                       'https://wiki.example.com:111/foo',
+                       '/foo',
+                       PROTO_HTTPS,
+                       '//wiki.example.com',
+                       'http://wiki.example.com',
+                       'https',
+                       111,
+                       "Do add HTTPS port to protocol-relative URLs"
+               ];
+
+               return $retval;
+       }
+}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php b/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php
deleted file mode 100644 (file)
index 159e4ad..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-/**
- * @group GlobalFunctions
- * @covers ::wfExpandUrl
- */
-class WfExpandUrlTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider provideExpandableUrls
-        */
-       public function testWfExpandUrl( $fullUrl, $shortUrl, $defaultProto,
-               $server, $canServer, $httpsMode, $httpsPort, $message
-       ) {
-               // Fake $wgServer, $wgCanonicalServer and $wgRequest->getProtocol()
-               $this->setMwGlobals( [
-                       'wgServer' => $server,
-                       'wgCanonicalServer' => $canServer,
-                       'wgRequest' => new FauxRequest( [], false, null, $httpsMode ? 'https' : 'http' ),
-                       'wgHttpsPort' => $httpsPort
-               ] );
-
-               $this->assertEquals( $fullUrl, wfExpandUrl( $shortUrl, $defaultProto ), $message );
-       }
-
-       /**
-        * Provider of URL examples for testing wfExpandUrl()
-        *
-        * @return array
-        */
-       public static function provideExpandableUrls() {
-               $modes = [ 'http', 'https' ];
-               $servers = [
-                       'http' => 'http://example.com',
-                       'https' => 'https://example.com',
-                       'protocol-relative' => '//example.com'
-               ];
-               $defaultProtos = [
-                       'http' => PROTO_HTTP,
-                       'https' => PROTO_HTTPS,
-                       'protocol-relative' => PROTO_RELATIVE,
-                       'current' => PROTO_CURRENT,
-                       'canonical' => PROTO_CANONICAL
-               ];
-
-               $retval = [];
-               foreach ( $modes as $mode ) {
-                       $httpsMode = $mode == 'https';
-                       foreach ( $servers as $serverDesc => $server ) {
-                               foreach ( $modes as $canServerMode ) {
-                                       $canServer = "$canServerMode://example2.com";
-                                       foreach ( $defaultProtos as $protoDesc => $defaultProto ) {
-                                               $retval[] = [
-                                                       'http://example.com', 'http://example.com',
-                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
-                                                       "Testing fully qualified http URLs (no need to expand) "
-                                                               . "(defaultProto: $protoDesc , wgServer: $server, "
-                                                               . "wgCanonicalServer: $canServer, current request protocol: $mode )"
-                                               ];
-                                               $retval[] = [
-                                                       'https://example.com', 'https://example.com',
-                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
-                                                       "Testing fully qualified https URLs (no need to expand) "
-                                                               . "(defaultProto: $protoDesc , wgServer: $server, "
-                                                               . "wgCanonicalServer: $canServer, current request protocol: $mode )"
-                                               ];
-                                               # Would be nice to support this, see fixme on wfExpandUrl()
-                                               $retval[] = [
-                                                       "wiki/FooBar", 'wiki/FooBar',
-                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
-                                                       "Test non-expandable relative URLs (defaultProto: $protoDesc, "
-                                                               . "wgServer: $server, wgCanonicalServer: $canServer, "
-                                                               . "current request protocol: $mode )"
-                                               ];
-
-                                               // Determine expected protocol
-                                               if ( $protoDesc == 'protocol-relative' ) {
-                                                       $p = '';
-                                               } elseif ( $protoDesc == 'current' ) {
-                                                       $p = "$mode:";
-                                               } elseif ( $protoDesc == 'canonical' ) {
-                                                       $p = "$canServerMode:";
-                                               } else {
-                                                       $p = $protoDesc . ':';
-                                               }
-                                               // Determine expected server name
-                                               if ( $protoDesc == 'canonical' ) {
-                                                       $srv = $canServer;
-                                               } elseif ( $serverDesc == 'protocol-relative' ) {
-                                                       $srv = $p . $server;
-                                               } else {
-                                                       $srv = $server;
-                                               }
-
-                                               $retval[] = [
-                                                       "$p//wikipedia.org", '//wikipedia.org',
-                                                       $defaultProto, $server, $canServer, $httpsMode, 443,
-                                                       "Test protocol-relative URL (defaultProto: $protoDesc, "
-                                                               . "wgServer: $server, wgCanonicalServer: $canServer, "
-                                                               . "current request protocol: $mode )"
-                                               ];
-                                               $retval[] = [
-                                                       "$srv/wiki/FooBar",
-                                                       '/wiki/FooBar',
-                                                       $defaultProto,
-                                                       $server,
-                                                       $canServer,
-                                                       $httpsMode,
-                                                       443,
-                                                       "Testing expanding URL beginning with / (defaultProto: $protoDesc, "
-                                                               . "wgServer: $server, wgCanonicalServer: $canServer, "
-                                                               . "current request protocol: $mode )"
-                                               ];
-                                       }
-                               }
-                       }
-               }
-
-               // Don't add HTTPS port to foreign URLs
-               $retval[] = [
-                       'https://foreign.example.com/foo',
-                       'https://foreign.example.com/foo',
-                       PROTO_HTTPS,
-                       '//wiki.example.com',
-                       'http://wiki.example.com',
-                       'https',
-                       111,
-                       "Don't add HTTPS port to foreign URLs"
-               ];
-               $retval[] = [
-                       'https://foreign.example.com:222/foo',
-                       'https://foreign.example.com:222/foo',
-                       PROTO_HTTPS,
-                       '//wiki.example.com',
-                       'http://wiki.example.com',
-                       'https',
-                       111,
-                       "Don't overwrite HTTPS port of foreign URLs"
-               ];
-               // Do add HTTPS port to local URLs
-               $retval[] = [
-                       'https://wiki.example.com:111/foo',
-                       '/foo',
-                       PROTO_HTTPS,
-                       '//wiki.example.com',
-                       'http://wiki.example.com',
-                       'https',
-                       111,
-                       "Do add HTTPS port to protocol-relative URLs"
-               ];
-
-               return $retval;
-       }
-}
index 294bd80..169a7c5 100644 (file)
@@ -235,36 +235,6 @@ class UserTest extends MediaWikiTestCase {
                ];
        }
 
-       /**
-        * Test, if for all rights a right- message exist,
-        * which is used on Special:ListGroupRights as help text
-        * Extensions and core
-        *
-        * @coversNothing
-        */
-       public function testAllRightsWithMessage() {
-               // Getting all user rights, for core: User::$mCoreRights, for extensions: $wgAvailableRights
-               $allRights = User::getAllRights();
-               $allMessageKeys = Language::getMessageKeysFor( 'en' );
-
-               $rightsWithMessage = [];
-               foreach ( $allMessageKeys as $message ) {
-                       // === 0: must be at beginning of string (position 0)
-                       if ( strpos( $message, 'right-' ) === 0 ) {
-                               $rightsWithMessage[] = substr( $message, strlen( 'right-' ) );
-                       }
-               }
-
-               sort( $allRights );
-               sort( $rightsWithMessage );
-
-               $this->assertEquals(
-                       $allRights,
-                       $rightsWithMessage,
-                       'Each user rights (core/extensions) has a corresponding right- message.'
-               );
-       }
-
        /**
         * Test User::editCount
         * @group medium
index ea132e9..a7d947e 100644 (file)
@@ -53,4 +53,36 @@ class AvailableRightsTest extends PHPUnit\Framework\TestCase {
                        'https://www.mediawiki.org/wiki/Manual:User_rights#Adding_new_rights'
                );
        }
+
+       /**
+        * Test, if for all rights a right- message exist,
+        * which is used on Special:ListGroupRights as help text
+        * Extensions and core
+        *
+        * @coversNothing
+        */
+       public function testAllRightsWithMessage() {
+               // Getting all user rights, for core: User::$mCoreRights, for extensions: $wgAvailableRights
+               $allRights = User::getAllRights();
+               $allMessageKeys = Language::getMessageKeysFor( 'en' );
+
+               $rightsWithMessage = [];
+               foreach ( $allMessageKeys as $message ) {
+                       // === 0: must be at beginning of string (position 0)
+                       if ( strpos( $message, 'right-' ) === 0 ) {
+                               $rightsWithMessage[] = substr( $message, strlen( 'right-' ) );
+                       }
+               }
+
+               $missing = array_diff(
+                       $allRights,
+                       $rightsWithMessage
+               );
+
+               $this->assertEquals(
+                       [],
+                       $missing,
+                       'Each user rights (core/extensions) has a corresponding right- message.'
+               );
+       }
 }
index fe38a98..1ea5853 100644 (file)
@@ -17,6 +17,8 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite {
        /** @var ScopedCallback */
        private $ptTeardownScope;
 
+       private $oldTablePrefix = '';
+
        /**
         * @defgroup filtering_constants Filtering constants
         *
@@ -137,7 +139,9 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite {
                $type = $db->getType();
                $prefix = $type === 'oracle' ?
                        MediaWikiTestCase::ORA_DB_PREFIX : MediaWikiTestCase::DB_PREFIX;
+               $this->oldTablePrefix = $db->tablePrefix();
                MediaWikiTestCase::setupTestDB( $db, $prefix );
+               CloneDatabase::changePrefix( $prefix );
                $teardown = $this->ptRunner->setDatabase( $db );
                $teardown = $this->ptRunner->setupUploads( $teardown );
                $this->ptTeardownScope = $teardown;
@@ -148,6 +152,7 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite {
                if ( $this->ptTeardownScope ) {
                        ScopedCallback::consume( $this->ptTeardownScope );
                }
+               CloneDatabase::changePrefix( $this->oldTablePrefix );
        }
 
        /**