diff -Nru mediawiki-1.31.2/composer.json mediawiki-1.31.7/composer.json --- mediawiki-1.31.2/composer.json 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/composer.json 2020-03-26 17:18:20.000000000 +0000 @@ -57,7 +57,6 @@ "composer/spdx-licenses": "1.3.0", "hamcrest/hamcrest-php": "^2.0", "jakub-onderka/php-parallel-lint": "0.9.2", - "jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a", "justinrainbow/json-schema": "~5.2", "mediawiki/mediawiki-codesniffer": "18.0.0", "monolog/monolog": "~1.22.1", diff -Nru mediawiki-1.31.2/debian/changelog mediawiki-1.31.7/debian/changelog --- mediawiki-1.31.2/debian/changelog 2019-06-06 16:43:56.000000000 +0000 +++ mediawiki-1.31.7/debian/changelog 2020-04-22 21:23:53.000000000 +0000 @@ -1,14 +1,32 @@ -mediawiki (1:1.31.2-1ppa1~xenial1) xenial; urgency=medium +mediawiki (1:1.31.7-1ppa1~xenial1) xenial; urgency=medium * Rebuild for xenial. - -- Kunal Mehta Thu, 06 Jun 2019 12:43:56 -0400 + -- Kunal Mehta Wed, 22 Apr 2020 14:23:53 -0700 -mediawiki (1:1.31.2-1~bpo9+1) stretch-backports; urgency=medium +mediawiki (1:1.31.7-1~deb10u1) buster-security; urgency=medium - * Rebuild for stretch-backports. + * New upstream version 1.31.7, fixing CVE-2020-10960. + CVE-2020-10960 does not affect this version of MediaWiki. + * A hardening fix was included for the OATHAuth extension to + limit access of user-controlled JavaScript. - -- Kunal Mehta Thu, 06 Jun 2019 12:38:27 -0400 + -- Kunal Mehta Thu, 26 Mar 2020 14:59:51 -0700 + +mediawiki (1:1.31.6-1~deb10u1) buster-security; urgency=medium + + * New upstream version 1.31.6 (security release), fixing + CVE-2019-19709. + + -- Kunal Mehta Thu, 19 Dec 2019 13:03:58 -0800 + +mediawiki (1:1.31.4-1~deb10u1) buster-security; urgency=medium + + * New upstream version 1.31.4 (security release), fixing + CVE-2019-16738. Add an additional patch, already merged upstream, + to fix a fatal error caused by the upstream security patch. + + -- Kunal Mehta Fri, 11 Oct 2019 14:59:46 -0700 mediawiki (1:1.31.2-1) unstable; urgency=medium diff -Nru mediawiki-1.31.2/docs/hooks.txt mediawiki-1.31.7/docs/hooks.txt --- mediawiki-1.31.2/docs/hooks.txt 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/docs/hooks.txt 2020-03-26 17:18:20.000000000 +0000 @@ -1822,7 +1822,7 @@ $page: ImagePage object &$toc: Array of
  • strings -'ImgAuthBeforeStream': executed before file is streamed to user, but only when +'ImgAuthBeforeStream': Executed before file is streamed to user, but only when using img_auth.php. &$title: the Title object of the file as it would appear for the upload page &$path: the original file and path name when img_auth was invoked by the web @@ -1835,6 +1835,14 @@ $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. +'ImgAuthModifyHeaders': Executed just before a file is streamed to a user via +img_auth.php, allowing headers to be modified beforehand. +$title: LinkTarget object +&$headers: HTTP headers ( name => value, names are case insensitive ). + Two headers get special handling: If-Modified-Since (value must be + a valid HTTP date) and Range (must be of the form "bytes=(\d*-\d*)") + will be honored when streaming the file. + 'ImportHandleLogItemXMLTag': When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader: XMLReader object diff -Nru mediawiki-1.31.2/extensions/OATHAuth/includes/special/SpecialOATHDisable.php mediawiki-1.31.7/extensions/OATHAuth/includes/special/SpecialOATHDisable.php --- mediawiki-1.31.2/extensions/OATHAuth/includes/special/SpecialOATHDisable.php 2019-06-05 20:18:12.000000000 +0000 +++ mediawiki-1.31.7/extensions/OATHAuth/includes/special/SpecialOATHDisable.php 2020-03-26 17:18:26.000000000 +0000 @@ -83,6 +83,14 @@ } /** + * @param string $par + */ + public function execute( $par ) { + $this->getOutput()->disallowUserJs(); + parent::execute( $par ); + } + + /** * @return array[] */ protected function getFormFields() { diff -Nru mediawiki-1.31.2/extensions/OATHAuth/includes/special/SpecialOATHEnable.php mediawiki-1.31.7/extensions/OATHAuth/includes/special/SpecialOATHEnable.php --- mediawiki-1.31.2/extensions/OATHAuth/includes/special/SpecialOATHEnable.php 2019-06-05 20:18:12.000000000 +0000 +++ mediawiki-1.31.7/extensions/OATHAuth/includes/special/SpecialOATHEnable.php 2020-03-26 17:18:26.000000000 +0000 @@ -86,6 +86,14 @@ } /** + * @param string $par + */ + public function execute( $par ) { + $this->getOutput()->disallowUserJs(); + parent::execute( $par ); + } + + /** * @return array[] */ protected function getFormFields() { diff -Nru mediawiki-1.31.2/extensions/SyntaxHighlight_GeSHi/README mediawiki-1.31.7/extensions/SyntaxHighlight_GeSHi/README --- mediawiki-1.31.2/extensions/SyntaxHighlight_GeSHi/README 2019-06-05 20:18:13.000000000 +0000 +++ mediawiki-1.31.7/extensions/SyntaxHighlight_GeSHi/README 2020-03-26 17:18:27.000000000 +0000 @@ -6,8 +6,8 @@ == Requirements == -This version of the extension has been tested with Pygments 1.6, 2.0.2 and -MediaWiki 1.25 as of 2015-06-19. To get releases of this extension compatible +This version of the extension has been tested with Pygments 2.2.0 and +MediaWiki 1.31. To get releases of this extension compatible with earlier versions of MediaWiki, visit: https://www.mediawiki.org/wiki/Special:ExtensionDistributor/SyntaxHighlight_GeSHi @@ -18,7 +18,7 @@ wfLoadExtension( 'SyntaxHighlight_GeSHi' ); -By default, this extension will use a bundled copy of Pygments 2.0.2. If you +By default, this extension will use a bundled copy of Pygments 2.2.0. If you would like to use a different copy of the library, you can set $wgPygmentizePath to point to the path to the 'pygmentize' binary. diff -Nru mediawiki-1.31.2/img_auth.php mediawiki-1.31.7/img_auth.php --- mediawiki-1.31.2/img_auth.php 2019-06-05 20:14:27.000000000 +0000 +++ mediawiki-1.31.7/img_auth.php 2020-03-26 17:18:20.000000000 +0000 @@ -135,12 +135,13 @@ $headers = []; // extra HTTP headers to send + $title = Title::makeTitleSafe( NS_FILE, $name ); + if ( !$publicWiki ) { // For private wikis, run extra auth checks and set cache control headers - $headers[] = 'Cache-Control: private'; - $headers[] = 'Vary: Cookie'; + $headers['Cache-Control'] = 'private'; + $headers['Vary'] = 'Cookie'; - $title = Title::makeTitleSafe( NS_FILE, $name ); if ( !$title instanceof Title ) { // files have valid titles wfForbidden( 'img-auth-accessdenied', 'img-auth-badtitle', $name ); return; @@ -162,19 +163,22 @@ } } - $options = []; // HTTP header options if ( isset( $_SERVER['HTTP_RANGE'] ) ) { - $options['range'] = $_SERVER['HTTP_RANGE']; + $headers['Range'] = $_SERVER['HTTP_RANGE']; } if ( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { - $options['if-modified-since'] = $_SERVER['HTTP_IF_MODIFIED_SINCE']; + $headers['If-Modified-Since'] = $_SERVER['HTTP_IF_MODIFIED_SINCE']; } if ( $request->getCheck( 'download' ) ) { - $headers[] = 'Content-Disposition: attachment'; + $headers['Content-Disposition'] = 'attachment'; } + // Allow modification of headers before streaming a file + Hooks::run( 'ImgAuthModifyHeaders', [ $title->getTitleValue(), &$headers ] ); + // Stream the requested file + list( $headers, $options ) = HTTPFileStreamer::preprocessHeaders( $headers ); wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." ); $repo->streamFile( $filename, $headers, $options ); } diff -Nru mediawiki-1.31.2/includes/api/ApiEditPage.php mediawiki-1.31.7/includes/api/ApiEditPage.php --- mediawiki-1.31.2/includes/api/ApiEditPage.php 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/includes/api/ApiEditPage.php 2020-03-26 17:18:20.000000000 +0000 @@ -70,6 +70,20 @@ ]; $titleObj = $newTitle; + + // T239428: Check whether the new title is valid + if ( $titleObj->isExternal() || !$titleObj->canExist() ) { + $redirValues[count( $redirValues ) - 1]['to'] = $titleObj->getFullText(); + $this->dieWithError( + [ + 'apierror-edit-invalidredirect', + Message::plaintextParam( $oldTitle->getPrefixedText() ), + Message::plaintextParam( $titleObj->getFullText() ), + ], + 'edit-invalidredirect', + [ 'redirects' => $redirValues ] + ); + } } ApiResult::setIndexedTagName( $redirValues, 'r' ); diff -Nru mediawiki-1.31.2/includes/api/i18n/en.json mediawiki-1.31.7/includes/api/i18n/en.json --- mediawiki-1.31.2/includes/api/i18n/en.json 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/includes/api/i18n/en.json 2020-03-26 17:18:21.000000000 +0000 @@ -1694,6 +1694,7 @@ "apierror-databaseerror": "[$1] Database query error.", "apierror-deletedrevs-param-not-1-2": "The $1 parameter cannot be used in modes 1 or 2.", "apierror-deletedrevs-param-not-3": "The $1 parameter cannot be used in mode 3.", + "apierror-edit-invalidredirect": "Cannot edit $1 while following redirects, as target $2 is not valid.", "apierror-emptynewsection": "Creating empty new sections is not possible.", "apierror-emptypage": "Creating new, empty pages is not allowed.", "apierror-exceptioncaught": "[$1] Exception caught: $2", diff -Nru mediawiki-1.31.2/includes/api/i18n/qqq.json mediawiki-1.31.7/includes/api/i18n/qqq.json --- mediawiki-1.31.2/includes/api/i18n/qqq.json 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/api/i18n/qqq.json 2020-03-26 17:18:21.000000000 +0000 @@ -1582,6 +1582,7 @@ "apierror-databaseerror": "{{doc-apierror}}\n\nParameters:\n* $1 - Exception log ID code. This is meaningless to the end user, but can be used by people with access to the logs to easily find the logged error.", "apierror-deletedrevs-param-not-1-2": "{{doc-apierror}}\n\nParameters:\n* $1 - Parameter name.\n\nSee also:\n* {{msg-mw|apihelp-query+deletedrevs-extended-description}}", "apierror-deletedrevs-param-not-3": "{{doc-apierror}}\n\nParameters:\n* $1 - Parameter name.\n\nSee also:\n* {{msg-mw|apihelp-query+deletedrevs-extended-description}}", + "apierror-edit-invalidredirect": "{{doc-apierror}}\n\nParameters:\n* $1 - Redirect being edited\n* $2 - Target of the redirect that cannot be edited.", "apierror-emptynewsection": "{{doc-apierror}}", "apierror-emptypage": "{{doc-apierror}}", "apierror-exceptioncaught": "{{doc-apierror}}\n\nParameters:\n* $1 - Exception log ID code. This is meaningless to the end user, but can be used by people with access to the logs to easily find the logged error.\n* $2 - Exception message, which may end with punctuation. Probably in English.", diff -Nru mediawiki-1.31.2/includes/DefaultSettings.php mediawiki-1.31.7/includes/DefaultSettings.php --- mediawiki-1.31.2/includes/DefaultSettings.php 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/includes/DefaultSettings.php 2020-03-26 17:18:20.000000000 +0000 @@ -70,8 +70,9 @@ /** * MediaWiki version number * @since 1.2 + * @deprecated since 1.35; use the MW_VERSION constant instead */ -$wgVersion = '1.31.2'; +$wgVersion = MW_VERSION; /** * Name of the site. It must be changed in LocalSettings.php @@ -4472,7 +4473,8 @@ * Statements: * - MinimalPasswordLength - minimum length a user can set * - MinimumPasswordLengthToLogin - passwords shorter than this will - * not be allowed to login, regardless if it is correct. + * not be allowed to login, or offered a chance to reset their password + * as part of the login workflow, regardless if it is correct. * - MaximalPasswordLength - maximum length password a user is allowed * to attempt. Prevents DoS attacks with pbkdf2. * - PasswordCannotMatchUsername - Password cannot match username to diff -Nru mediawiki-1.31.2/includes/Defines.php mediawiki-1.31.7/includes/Defines.php --- mediawiki-1.31.2/includes/Defines.php 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/includes/Defines.php 2020-03-26 17:18:20.000000000 +0000 @@ -30,6 +30,15 @@ * @defgroup Constants MediaWiki constants */ +/** + * The running version of MediaWiki. + * + * This replaces the the $wgVersion global found in earlier versions. + * + * @since 1.31.7 + */ +define( 'MW_VERSION', '1.31.7' ); + # Obsolete aliases /** * @deprecated since 1.28 diff -Nru mediawiki-1.31.2/includes/DevelopmentSettings.php mediawiki-1.31.7/includes/DevelopmentSettings.php --- mediawiki-1.31.2/includes/DevelopmentSettings.php 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/includes/DevelopmentSettings.php 2020-03-26 17:18:20.000000000 +0000 @@ -52,3 +52,6 @@ $wgDebugLogGroups['error'] = "$logDir/mw-error.log"; } unset( $logDir ); + +// Disable rate-limiting +$wgRateLimits = []; diff -Nru mediawiki-1.31.2/includes/GlobalFunctions.php mediawiki-1.31.7/includes/GlobalFunctions.php --- mediawiki-1.31.2/includes/GlobalFunctions.php 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/includes/GlobalFunctions.php 2020-03-26 17:18:20.000000000 +0000 @@ -811,6 +811,18 @@ Wikimedia\suppressWarnings(); $bits = parse_url( $url ); Wikimedia\restoreWarnings(); + + // T212067: PHP < 5.6.28, 7.0.0–7.0.12, and HHVM (all relevant versions) screw up parsing + // the query part of pathless URLs + if ( isset( $bits['host'] ) && strpos( $bits['host'], '?' ) !== false ) { + list( $host, $query ) = explode( '?', $bits['host'], 2 ); + $bits['host'] = $host; + $bits['query'] = $query + . ( $bits['path'] ?? '' ) + . ( isset( $bits['query'] ) ? '?' . $bits['query'] : '' ); + unset( $bits['path'] ); + } + // parse_url() returns an array without scheme for some invalid URLs, e.g. // parse_url("%0Ahttp://example.com") == [ 'host' => '%0Ahttp', 'path' => 'example.com' ] if ( !$bits || !isset( $bits['scheme'] ) ) { diff -Nru mediawiki-1.31.2/includes/installer/CliInstaller.php mediawiki-1.31.7/includes/installer/CliInstaller.php --- mediawiki-1.31.2/includes/installer/CliInstaller.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/installer/CliInstaller.php 2020-03-26 17:18:21.000000000 +0000 @@ -126,6 +126,15 @@ * Main entry point. */ public function execute() { + // If APC is available, use that as the MainCacheType, instead of nothing. + // This is hacky and should be consolidated with WebInstallerOptions. + // This is here instead of in __construct(), because it should run run after + // doEnvironmentChecks(), which populates '_Caches'. + if ( count( $this->getVar( '_Caches' ) ) ) { + // We detected a CACHE_ACCEL implementation, use it. + $this->setVar( '_MainCacheType', 'accel' ); + } + $vars = Installer::getExistingLocalSettings(); if ( $vars ) { $this->showStatusMessage( diff -Nru mediawiki-1.31.2/includes/installer/i18n/en.json mediawiki-1.31.7/includes/installer/i18n/en.json --- mediawiki-1.31.2/includes/installer/i18n/en.json 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/installer/i18n/en.json 2020-03-26 17:18:21.000000000 +0000 @@ -45,8 +45,8 @@ "config-env-bad": "The environment has been checked.\nYou cannot install MediaWiki.", "config-env-php": "PHP $1 is installed.", "config-env-hhvm": "HHVM $1 is installed.", - "config-unicode-using-intl": "Using the [https://pecl.php.net/intl intl PECL extension] for Unicode normalization.", - "config-unicode-pure-php-warning": "Warning: The [https://pecl.php.net/intl intl PECL extension] is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.\nIf you run a high-traffic site, you should read a little on [https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations Unicode normalization].", + "config-unicode-using-intl": "Using the [https://php.net/manual/en/book.intl.php PHP intl extension] for Unicode normalization.", + "config-unicode-pure-php-warning": "Warning: The [https://php.net/manual/en/book.intl.php PHP intl extension] is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.\nIf you run a high-traffic site, you should read on [https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations Unicode normalization].", "config-unicode-update-warning": "Warning: The installed version of the Unicode normalization wrapper uses an older version of [http://site.icu-project.org/ the ICU project's] library.\nYou should [https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations upgrade] if you are at all concerned about using Unicode.", "config-no-db": "Could not find a suitable database driver! You need to install a database driver for PHP.\nThe following database {{PLURAL:$2|type is|types are}} supported: $1.\n\nIf you compiled PHP yourself, reconfigure it with a database client enabled, for example, using ./configure --with-mysqli.\nIf you installed PHP from a Debian or Ubuntu package, then you also need to install, for example, the php5-mysql package.", "config-outdated-sqlite": "Warning: you have SQLite $2, which is lower than minimum required version $1. SQLite will be unavailable.", diff -Nru mediawiki-1.31.2/includes/installer/Installer.php mediawiki-1.31.7/includes/installer/Installer.php --- mediawiki-1.31.2/includes/installer/Installer.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/installer/Installer.php 2020-03-26 17:18:21.000000000 +0000 @@ -697,6 +697,7 @@ 'enableSectionEditLinks' => false, 'unwrap' => true, ] ); + $html = Parser::stripOuterParagraph( $html ); } catch ( MediaWiki\Services\ServiceDisabledException $e ) { $html = ' ' . htmlspecialchars( $text ); } diff -Nru mediawiki-1.31.2/includes/installer/MysqlUpdater.php mediawiki-1.31.7/includes/installer/MysqlUpdater.php --- mediawiki-1.31.2/includes/installer/MysqlUpdater.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/installer/MysqlUpdater.php 2020-03-26 17:18:21.000000000 +0000 @@ -325,6 +325,17 @@ [ 'renameIndex', 'user_properties', 'user_properties_user_property', 'PRIMARY', false, 'patch-user_properties-fix-pk.sql' ], [ 'addTable', 'comment', 'patch-comment-table.sql' ], + [ 'addTable', 'revision_comment_temp', 'patch-revision_comment_temp-table.sql' ], + [ 'addTable', 'image_comment_temp', 'patch-image_comment_temp-table.sql' ], + [ 'addField', 'archive', 'ar_comment_id', 'patch-archive-ar_comment_id.sql' ], + [ 'addField', 'filearchive', 'fa_description_id', 'patch-filearchive-fa_description_id.sql' ], + [ 'modifyField', 'image', 'img_description', 'patch-image-img_description-default.sql' ], + [ 'addField', 'ipblocks', 'ipb_reason_id', 'patch-ipblocks-ipb_reason_id.sql' ], + [ 'addField', 'logging', 'log_comment_id', 'patch-logging-log_comment_id.sql' ], + [ 'addField', 'oldimage', 'oi_description_id', 'patch-oldimage-oi_description_id.sql' ], + [ 'addField', 'protected_titles', 'pt_reason_id', 'patch-protected_titles-pt_reason_id.sql' ], + [ 'addField', 'recentchanges', 'rc_comment_id', 'patch-recentchanges-rc_comment_id.sql' ], + [ 'modifyField', 'revision', 'rev_comment', 'patch-revision-rev_comment-default.sql' ], // This field was added in 1.31, but is put here so it can be used by 'migrateComments' [ 'addField', 'image', 'img_description_id', 'patch-image-img_description_id.sql' ], @@ -342,6 +353,14 @@ [ 'addTable', 'content_models', 'patch-content_models.sql' ], [ 'migrateArchiveText' ], [ 'addTable', 'actor', 'patch-actor-table.sql' ], + [ 'addTable', 'revision_actor_temp', 'patch-revision_actor_temp-table.sql' ], + [ 'addField', 'archive', 'ar_actor', 'patch-archive-ar_actor.sql' ], + [ 'addField', 'ipblocks', 'ipb_by_actor', 'patch-ipblocks-ipb_by_actor.sql' ], + [ 'addField', 'image', 'img_actor', 'patch-image-img_actor.sql' ], + [ 'addField', 'oldimage', 'oi_actor', 'patch-oldimage-oi_actor.sql' ], + [ 'addField', 'filearchive', 'fa_actor', 'patch-filearchive-fa_actor.sql' ], + [ 'addField', 'recentchanges', 'rc_actor', 'patch-recentchanges-rc_actor.sql' ], + [ 'addField', 'logging', 'log_actor', 'patch-logging-log_actor.sql' ], [ 'migrateActors' ], [ 'modifyField', 'revision', 'rev_text_id', 'patch-rev_text_id-default.sql' ], [ 'modifyTable', 'site_stats', 'patch-site_stats-modify.sql' ], diff -Nru mediawiki-1.31.2/includes/installer/PostgresUpdater.php mediawiki-1.31.7/includes/installer/PostgresUpdater.php --- mediawiki-1.31.2/includes/installer/PostgresUpdater.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/installer/PostgresUpdater.php 2020-03-26 17:18:21.000000000 +0000 @@ -481,6 +481,11 @@ [ 'changeNullableField', 'protected_titles', 'pt_reason', 'NOT NULL', true ], [ 'addPgField', 'protected_titles', 'pt_reason_id', 'INTEGER NOT NULL DEFAULT 0' ], [ 'addTable', 'comment', 'patch-comment-table.sql' ], + [ 'addTable', 'revision_comment_temp', 'patch-revision_comment_temp-table.sql' ], + // image_comment_temp is no longer needed when upgrading to MW 1.31 or newer, + // as it is dropped later in the update process as part of 'migrateImageCommentTemp'. + // File kept on disk and the updater entry here for historical purposes. + // [ 'addTable', 'image_comment_temp', 'patch-image_comment_temp-table.sql' ], // This field was added in 1.31, but is put here so it can be used by 'migrateComments' [ 'addPgField', 'image', 'img_description_id', 'INTEGER NOT NULL DEFAULT 0' ], @@ -505,6 +510,7 @@ [ 'addTable', 'slot_roles', 'patch-slot_roles-table.sql' ], [ 'migrateArchiveText' ], [ 'addTable', 'actor', 'patch-actor-table.sql' ], + [ 'addTable', 'revision_actor_temp', 'patch-revision_actor_temp-table.sql' ], [ 'setDefault', 'revision', 'rev_user', 0 ], [ 'setDefault', 'revision', 'rev_user_text', '' ], [ 'setDefault', 'archive', 'ar_user', 0 ], diff -Nru mediawiki-1.31.2/includes/installer/SqliteUpdater.php mediawiki-1.31.7/includes/installer/SqliteUpdater.php --- mediawiki-1.31.2/includes/installer/SqliteUpdater.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/installer/SqliteUpdater.php 2020-03-26 17:18:21.000000000 +0000 @@ -190,9 +190,20 @@ [ 'renameIndex', 'user_properties', 'user_properties_user_property', 'PRIMARY', false, 'patch-user_properties-fix-pk.sql' ], [ 'addTable', 'comment', 'patch-comment-table.sql' ], + [ 'addTable', 'revision_comment_temp', 'patch-revision_comment_temp-table.sql' ], + [ 'addTable', 'image_comment_temp', 'patch-image_comment_temp-table.sql' ], + [ 'addField', 'archive', 'ar_comment_id', 'patch-archive-ar_comment_id.sql' ], + [ 'modifyField', 'image', 'img_description', 'patch-image-img_description-default.sql' ], + [ 'addField', 'ipblocks', 'ipb_reason_id', 'patch-ipblocks-ipb_reason_id.sql' ], + [ 'addField', 'logging', 'log_comment_id', 'patch-logging-log_comment_id.sql' ], + [ 'addField', 'oldimage', 'oi_description_id', 'patch-oldimage-oi_description_id.sql' ], + [ 'addField', 'protected_titles', 'pt_reason_id', 'patch-protected_titles-pt_reason_id.sql' ], + [ 'addField', 'recentchanges', 'rc_comment_id', 'patch-recentchanges-rc_comment_id.sql' ], + [ 'modifyField', 'revision', 'rev_comment', 'patch-revision-rev_comment-default.sql' ], // This field was added in 1.31, but is put here so it can be used by 'migrateComments' [ 'addField', 'image', 'img_description_id', 'patch-image-img_description_id.sql' ], + [ 'addField', 'filearchive', 'fa_description_id', 'patch-filearchive-fa_description_id.sql' ], [ 'migrateComments' ], [ 'renameIndex', 'l10n_cache', 'lc_lang_key', 'PRIMARY', false, @@ -206,6 +217,14 @@ [ 'addTable', 'slot_roles', 'patch-slot_roles.sql' ], [ 'migrateArchiveText' ], [ 'addTable', 'actor', 'patch-actor-table.sql' ], + [ 'addField', 'archive', 'ar_actor', 'patch-archive-ar_actor.sql' ], + [ 'addTable', 'revision_actor_temp', 'patch-revision_actor_temp-table.sql' ], + [ 'addField', 'ipblocks', 'ipb_by_actor', 'patch-ipblocks-ipb_by_actor.sql' ], + [ 'addField', 'image', 'img_actor', 'patch-image-img_actor.sql' ], + [ 'addField', 'oldimage', 'oi_actor', 'patch-oldimage-oi_actor.sql' ], + [ 'addField', 'filearchive', 'fa_actor', 'patch-filearchive-fa_actor.sql' ], + [ 'addField', 'recentchanges', 'rc_actor', 'patch-recentchanges-rc_actor.sql' ], + [ 'addField', 'logging', 'log_actor', 'patch-logging-log_actor.sql' ], [ 'migrateActors' ], [ 'modifyField', 'revision', 'rev_text_id', 'patch-rev_text_id-default.sql' ], [ 'modifyTable', 'site_stats', 'patch-site_stats-modify.sql' ], diff -Nru mediawiki-1.31.2/includes/jobqueue/JobQueueRedis.php mediawiki-1.31.7/includes/jobqueue/JobQueueRedis.php --- mediawiki-1.31.2/includes/jobqueue/JobQueueRedis.php 2019-06-05 20:14:28.000000000 +0000 +++ mediawiki-1.31.7/includes/jobqueue/JobQueueRedis.php 2020-03-26 17:18:21.000000000 +0000 @@ -132,7 +132,7 @@ protected function doGetSize() { $conn = $this->getConnection(); try { - return $conn->lSize( $this->getQueueKey( 'l-unclaimed' ) ); + return $conn->lLen( $this->getQueueKey( 'l-unclaimed' ) ); } catch ( RedisException $e ) { $this->throwRedisException( $conn, $e ); } @@ -502,7 +502,7 @@ $keys[] = $this->getQueueKey( $prop ); } - $ok = ( $conn->delete( $keys ) !== false ); + $ok = ( $conn->del( $keys ) !== false ); $conn->sRem( $this->getGlobalKey( 's-queuesWithJobs' ), $this->encodeQueueName() ); return $ok; @@ -607,7 +607,7 @@ try { $conn->multi( Redis::PIPELINE ); foreach ( $types as $type ) { - $conn->lSize( $this->getQueueKey( 'l-unclaimed', $type ) ); + $conn->lLen( $this->getQueueKey( 'l-unclaimed', $type ) ); } $res = $conn->exec(); if ( is_array( $res ) ) { diff -Nru mediawiki-1.31.2/includes/libs/filebackend/HTTPFileStreamer.php mediawiki-1.31.7/includes/libs/filebackend/HTTPFileStreamer.php --- mediawiki-1.31.2/includes/libs/filebackend/HTTPFileStreamer.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/filebackend/HTTPFileStreamer.php 2020-03-26 17:18:21.000000000 +0000 @@ -40,6 +40,27 @@ const STREAM_ALLOW_OB = 2; /** + * Takes HTTP headers in a name => value format and converts them to the weird format + * expected by stream(). + * @param string[] $headers + * @return array[] [ $headers, $optHeaders ] + * @since 1.34 + */ + public static function preprocessHeaders( $headers ) { + $rawHeaders = []; + $optHeaders = []; + foreach ( $headers as $name => $header ) { + $nameLower = strtolower( $name ); + if ( in_array( $nameLower, [ 'range', 'if-modified-since' ], true ) ) { + $optHeaders[$nameLower] = $header; + } else { + $rawHeaders[] = "$name: $header"; + } + } + return [ $rawHeaders, $optHeaders ]; + } + + /** * @param string $path Local filesystem path to a file * @param array $params Options map, which includes: * - obResetFunc : alternative callback to clear the output buffer diff -Nru mediawiki-1.31.2/includes/libs/mime/MimeAnalyzer.php mediawiki-1.31.7/includes/libs/mime/MimeAnalyzer.php --- mediawiki-1.31.2/includes/libs/mime/MimeAnalyzer.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/mime/MimeAnalyzer.php 2020-03-26 17:18:21.000000000 +0000 @@ -760,7 +760,9 @@ /** * look for XML formats (XHTML and SVG) */ + Wikimedia\suppressWarnings(); $xml = new XmlTypeCheck( $file ); + Wikimedia\restoreWarnings(); if ( $xml->wellFormed ) { $xmlTypes = $this->xmlTypes; if ( isset( $xmlTypes[$xml->getRootElement()] ) ) { diff -Nru mediawiki-1.31.2/includes/libs/MultiHttpClient.php mediawiki-1.31.7/includes/libs/MultiHttpClient.php --- mediawiki-1.31.2/includes/libs/MultiHttpClient.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/MultiHttpClient.php 2020-03-26 17:18:21.000000000 +0000 @@ -375,7 +375,7 @@ } $length = strlen( $header ); $matches = []; - if ( preg_match( "/^(HTTP\/1\.[01]) (\d{3}) (.*)/", $header, $matches ) ) { + if ( preg_match( "/^(HTTP\/(?:1\.[01]|2)) (\d{3}) (.*)/", $header, $matches ) ) { $req['response']['code'] = (int)$matches[2]; $req['response']['reason'] = trim( $matches[3] ); return $length; diff -Nru mediawiki-1.31.2/includes/libs/objectcache/RedisBagOStuff.php mediawiki-1.31.7/includes/libs/objectcache/RedisBagOStuff.php --- mediawiki-1.31.2/includes/libs/objectcache/RedisBagOStuff.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/objectcache/RedisBagOStuff.php 2020-03-26 17:18:21.000000000 +0000 @@ -21,8 +21,9 @@ */ /** - * Redis-based caching module for redis server >= 2.6.12 + * Redis-based caching module for redis server >= 2.6.12 and phpredis >= 2.2.4 * + * @see https://github.com/phpredis/phpredis/blob/d310ed7c8/Changelog.md * @note Avoid use of Redis::MULTI transactions for twemproxy support * * @ingroup Cache @@ -135,7 +136,7 @@ return false; } try { - $conn->delete( $key ); + $conn->del( $key ); // Return true even if the key didn't exist $result = true; } catch ( RedisException $e ) { diff -Nru mediawiki-1.31.2/includes/libs/rdbms/database/DatabaseDomain.php mediawiki-1.31.7/includes/libs/rdbms/database/DatabaseDomain.php --- mediawiki-1.31.2/includes/libs/rdbms/database/DatabaseDomain.php 2019-06-05 20:14:28.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/rdbms/database/DatabaseDomain.php 2020-03-26 17:18:21.000000000 +0000 @@ -84,6 +84,10 @@ $database = null; } + if ( $schema === '' ) { + $schema = null; + } + return new self( $database, $schema, $prefix ); } @@ -96,10 +100,10 @@ /** * @param DatabaseDomain|string $other - * @return bool + * @return bool Whether the domain instances are the same by value */ public function equals( $other ) { - if ( $other instanceof DatabaseDomain ) { + if ( $other instanceof self ) { return ( $this->database === $other->database && $this->schema === $other->schema && @@ -111,6 +115,44 @@ } /** + * Check whether the domain $other meets the specifications of this domain + * + * If this instance has a null database specifier, then $other can have any database + * specified, including the null, and likewise if the schema specifier is null. This + * is not transitive like equals() since a domain that explicitly wants a certain + * database or schema cannot be satisfied by one of another (nor null). If the prefix + * is empty and the DB and schema are both null, then the entire domain is considered + * unspecified, and any prefix of $other is considered compatible. + * + * @param DatabaseDomain|string $other + * @return bool + * @since 1.32 + */ + public function isCompatible( $other ) { + if ( $this->isUnspecified() ) { + return true; // even the prefix doesn't matter + } + + $other = ( $other instanceof self ) ? $other : self::newFromId( $other ); + + return ( + ( $this->database === $other->database || $this->database === null ) && + ( $this->schema === $other->schema || $this->schema === null ) && + $this->prefix === $other->prefix + ); + } + + /** + * @return bool + * @since 1.32 + */ + public function isUnspecified() { + return ( + $this->database === null && $this->schema === null && $this->prefix === '' + ); + } + + /** * @return string|null Database name */ public function getDatabase() { @@ -150,7 +192,12 @@ if ( $this->schema !== null ) { $parts[] = $this->schema; } - if ( $this->prefix != '' ) { + if ( $this->prefix != '' || $this->schema !== null ) { + // If there is a schema, then we need the prefix to disambiguate. + // For engines like Postgres that use schemas, this awkwardness is hopefully + // avoided since it is easy to have one DB per server (to avoid having many users) + // and use schema/prefix to have wiki farms. For example, a domain schemes could be + // wiki--, e.g. "wiki-fitness-es"/"wiki-sports-fr"/"wiki-news-en". $parts[] = $this->prefix; } diff -Nru mediawiki-1.31.2/includes/libs/rdbms/database/Database.php mediawiki-1.31.7/includes/libs/rdbms/database/Database.php --- mediawiki-1.31.2/includes/libs/rdbms/database/Database.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/rdbms/database/Database.php 2020-03-26 17:18:21.000000000 +0000 @@ -2235,7 +2235,7 @@ if ( preg_match( '/(^|\s)(DISTINCT|JOIN|ON|AS)(\s|$)/i', $name ) !== 0 ) { $this->queryLogger->warning( __METHOD__ . ": use of subqueries is not supported this way.", - [ 'trace' => ( new RuntimeException() )->getTraceAsString() ] + [ 'exception' => new RuntimeException() ] ); return $name; @@ -3994,7 +3994,7 @@ $fname . ': lost connection to {dbserver}; reconnected', [ 'dbserver' => $this->getServer(), - 'trace' => ( new RuntimeException() )->getTraceAsString() + 'exception' => new RuntimeException() ] ); } catch ( DBConnectionError $e ) { @@ -4510,8 +4510,8 @@ */ public function __clone() { $this->connLogger->warning( - "Cloning " . static::class . " is not recomended; forking connection:\n" . - ( new RuntimeException() )->getTraceAsString() + "Cloning " . static::class . " is not recommended; forking connection", + [ 'exception' => new RuntimeException() ] ); if ( $this->isOpen() ) { diff -Nru mediawiki-1.31.2/includes/libs/rdbms/database/DatabasePostgres.php mediawiki-1.31.7/includes/libs/rdbms/database/DatabasePostgres.php --- mediawiki-1.31.2/includes/libs/rdbms/database/DatabasePostgres.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/rdbms/database/DatabasePostgres.php 2020-03-26 17:18:21.000000000 +0000 @@ -119,7 +119,7 @@ $connectVars['port'] = (int)$this->port; } if ( $this->flags & self::DBO_SSL ) { - $connectVars['sslmode'] = 1; + $connectVars['sslmode'] = 'require'; } $this->connectString = $this->makeConnectionString( $connectVars ); @@ -816,7 +816,7 @@ . ' WHERE relkind = \'r\'' . ' AND nspname = ' . $this->addQuotes( $this->getCoreSchema() ) . ' AND relname = ' . $this->addQuotes( $oldName ) - . ' AND adsrc LIKE \'nextval(%\'', + . ' AND pg_get_expr(adbin, adrelid) LIKE \'nextval(%\'', $fname ); $row = $this->fetchObject( $res ); @@ -851,10 +851,10 @@ } $oid = $this->fetchObject( $res )->oid; - $res = $this->query( 'SELECT adsrc FROM pg_attribute a' + $res = $this->query( 'SELECT pg_get_expr(adbin, adrelid) AS adsrc FROM pg_attribute a' . ' JOIN pg_attrdef d ON (a.attrelid=d.adrelid and a.attnum=d.adnum)' . " WHERE a.attrelid = $oid" - . ' AND adsrc LIKE \'nextval(%\'', + . ' AND pg_get_expr(adbin, adrelid) LIKE \'nextval(%\'', $fname ); $row = $this->fetchObject( $res ); diff -Nru mediawiki-1.31.2/includes/libs/rdbms/field/PostgresField.php mediawiki-1.31.7/includes/libs/rdbms/field/PostgresField.php --- mediawiki-1.31.2/includes/libs/rdbms/field/PostgresField.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/rdbms/field/PostgresField.php 2019-12-01 19:49:55.000000000 +0000 @@ -17,7 +17,7 @@ SELECT attnotnull, attlen, conname AS conname, atthasdef, - adsrc, + pg_get_expr(adbin, adrelid) AS adsrc, COALESCE(condeferred, 'f') AS deferred, COALESCE(condeferrable, 'f') AS deferrable, CASE WHEN typname = 'int2' THEN 'smallint' diff -Nru mediawiki-1.31.2/includes/libs/rdbms/loadbalancer/LoadBalancer.php mediawiki-1.31.7/includes/libs/rdbms/loadbalancer/LoadBalancer.php --- mediawiki-1.31.2/includes/libs/rdbms/loadbalancer/LoadBalancer.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/libs/rdbms/loadbalancer/LoadBalancer.php 2020-03-26 17:18:21.000000000 +0000 @@ -28,6 +28,7 @@ use EmptyBagOStuff; use WANObjectCache; use ArrayUtils; +use UnexpectedValueException; use InvalidArgumentException; use RuntimeException; use Exception; @@ -998,8 +999,13 @@ } } - // Increment reference count if ( $conn instanceof IDatabase ) { + // Final sanity check to make sure the right domain is selected + if ( !$domainInstance->isCompatible( $conn->getDomainID() ) ) { + throw new UnexpectedValueException( + "Got connection to '{$conn->getDomainID()}', but expected '$domain'." ); + } + // Increment reference count $refCount = $conn->getLBInfo( 'foreignPoolRefCount' ); $conn->setLBInfo( 'foreignPoolRefCount', $refCount + 1 ); } diff -Nru mediawiki-1.31.2/includes/logging/LogEventsList.php mediawiki-1.31.7/includes/logging/LogEventsList.php --- mediawiki-1.31.2/includes/logging/LogEventsList.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/logging/LogEventsList.php 2020-03-26 17:18:21.000000000 +0000 @@ -563,12 +563,12 @@ * Determine if the current user is allowed to view a particular * field of this log row, if it's marked as restricted log type. * - * @param stdClass $row + * @param stdClass $type * @param User|null $user User to check, or null to use $wgUser * @return bool */ public static function userCanViewLogType( $type, User $user = null ) { - if ( $user === null ){ + if ( $user === null ) { global $wgUser; $user = $wgUser; } diff -Nru mediawiki-1.31.2/includes/media/FormatMetadata.php mediawiki-1.31.7/includes/media/FormatMetadata.php --- mediawiki-1.31.2/includes/media/FormatMetadata.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/media/FormatMetadata.php 2020-03-26 17:18:21.000000000 +0000 @@ -1400,11 +1400,16 @@ * Format a coordinate value, convert numbers from floating point * into degree minute second representation. * - * @param int $coord Degrees, minutes and seconds - * @param string $type Latitude or longitude (for if its a NWS or E) - * @return mixed A floating point number or whatever we were fed + * @param float|string $coord Expected to be a number or numeric string in degrees + * @param string $type "latitude" or "longitude" + * @return string */ private function formatCoords( $coord, $type ) { + if ( !is_numeric( $coord ) ) { + wfDebugLog( 'exif', __METHOD__ . ": \"$coord\" is not a number" ); + return (string)$coord; + } + $ref = ''; if ( $coord < 0 ) { $nCoord = -$coord; @@ -1414,7 +1419,7 @@ $ref = 'W'; } } else { - $nCoord = $coord; + $nCoord = (float)$coord; if ( $type === 'latitude' ) { $ref = 'N'; } elseif ( $type === 'longitude' ) { @@ -1423,13 +1428,14 @@ } $deg = floor( $nCoord ); - $min = floor( ( $nCoord - $deg ) * 60.0 ); - $sec = round( ( ( $nCoord - $deg ) - $min / 60 ) * 3600, 2 ); + $min = floor( ( $nCoord - $deg ) * 60 ); + $sec = round( ( ( $nCoord - $deg ) * 60 - $min ) * 60, 2 ); $deg = $this->formatNum( $deg ); $min = $this->formatNum( $min ); $sec = $this->formatNum( $sec ); + // Note the default message "$1° $2′ $3″ $4" ignores the 5th parameter return $this->msg( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord )->text(); } diff -Nru mediawiki-1.31.2/includes/media/JpegMetadataExtractor.php mediawiki-1.31.7/includes/media/JpegMetadataExtractor.php --- mediawiki-1.31.2/includes/media/JpegMetadataExtractor.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/media/JpegMetadataExtractor.php 2020-03-26 17:18:21.000000000 +0000 @@ -120,14 +120,17 @@ $temp = self::jpegExtractMarker( $fh ); // check what type of app segment this is. if ( substr( $temp, 0, 29 ) === "http://ns.adobe.com/xap/1.0/\x00" && $showXMP ) { - $segments["XMP"] = substr( $temp, 29 ); + // use trim to remove trailing \0 chars + $segments["XMP"] = trim( substr( $temp, 29 ) ); } elseif ( substr( $temp, 0, 35 ) === "http://ns.adobe.com/xmp/extension/\x00" && $showXMP ) { - $segments["XMP_ext"][] = substr( $temp, 35 ); + // use trim to remove trailing \0 chars + $segments["XMP_ext"][] = trim( substr( $temp, 35 ) ); } elseif ( substr( $temp, 0, 29 ) === "XMP\x00://ns.adobe.com/xap/1.0/\x00" && $showXMP ) { // Some images (especially flickr images) seem to have this. // I really have no idea what the deal is with them, but // whatever... - $segments["XMP"] = substr( $temp, 29 ); + // use trim to remove trailing \0 chars + $segments["XMP"] = trim( substr( $temp, 29 ) ); wfDebug( __METHOD__ . ' Found XMP section with wrong app identifier ' . "Using anyways.\n" ); } elseif ( substr( $temp, 0, 6 ) === "Exif\0\0" ) { diff -Nru mediawiki-1.31.2/includes/MediaWikiVersionFetcher.php mediawiki-1.31.7/includes/MediaWikiVersionFetcher.php --- mediawiki-1.31.2/includes/MediaWikiVersionFetcher.php 2018-12-12 23:21:34.000000000 +0000 +++ mediawiki-1.31.7/includes/MediaWikiVersionFetcher.php 2020-03-26 16:54:25.000000000 +0000 @@ -9,19 +9,19 @@ class MediaWikiVersionFetcher { /** - * Returns the MediaWiki version, in the format used by MediaWiki's wgVersion global. + * Get the MediaWiki version, extracted from the PHP source file where it is defined. * * @return string * @throws RuntimeException */ public function fetchVersion() { - $defaultSettings = file_get_contents( __DIR__ . '/DefaultSettings.php' ); + $code = file_get_contents( __DIR__ . '/Defines.php' ); $matches = []; - preg_match( "/wgVersion = '([0-9a-zA-Z\.\-]+)';/", $defaultSettings, $matches ); + preg_match( "/define\( 'MW_VERSION', '([0-9a-zA-Z\.\-]+)'/", $code, $matches ); if ( count( $matches ) !== 2 ) { - throw new RuntimeException( 'Could not extract the MediaWiki version from DefaultSettings.php' ); + throw new RuntimeException( 'Could not extract the MediaWiki version from Defines.php' ); } return $matches[1]; diff -Nru mediawiki-1.31.2/includes/password/PasswordPolicyChecks.php mediawiki-1.31.7/includes/password/PasswordPolicyChecks.php --- mediawiki-1.31.2/includes/password/PasswordPolicyChecks.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/password/PasswordPolicyChecks.php 2020-03-26 17:18:21.000000000 +0000 @@ -44,7 +44,9 @@ } /** - * Check password is longer than minimum, fatal + * Check password is longer than minimum, fatal. + * Intended for locking out users with passwords too short to trust, requiring them + * to recover their account by some other means. * @param int $policyVal minimal length * @param User $user * @param string $password diff -Nru mediawiki-1.31.2/includes/PHPVersionCheck.php mediawiki-1.31.7/includes/PHPVersionCheck.php --- mediawiki-1.31.2/includes/PHPVersionCheck.php 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/includes/PHPVersionCheck.php 2020-03-26 17:18:20.000000000 +0000 @@ -93,7 +93,7 @@ 'implementation' => 'PHP', 'version' => PHP_VERSION, 'vendor' => 'the PHP Group', - 'upstreamSupported' => '5.6.0', + 'upstreamSupported' => '7.2.0', 'minSupported' => '7.0.13', 'upgradeURL' => 'https://secure.php.net/downloads.php', ); diff -Nru mediawiki-1.31.2/includes/specials/SpecialBrokenRedirects.php mediawiki-1.31.7/includes/specials/SpecialBrokenRedirects.php --- mediawiki-1.31.2/includes/specials/SpecialBrokenRedirects.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialBrokenRedirects.php 2020-03-26 17:15:34.000000000 +0000 @@ -63,7 +63,6 @@ 'fields' => [ 'namespace' => 'p1.page_namespace', 'title' => 'p1.page_title', - 'value' => 'p1.page_title', 'rd_namespace', 'rd_title', 'rd_fragment', diff -Nru mediawiki-1.31.2/includes/specials/SpecialChangeEmail.php mediawiki-1.31.7/includes/specials/SpecialChangeEmail.php --- mediawiki-1.31.2/includes/specials/SpecialChangeEmail.php 2019-06-05 20:14:29.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialChangeEmail.php 2020-03-26 17:18:21.000000000 +0000 @@ -61,9 +61,9 @@ parent::execute( $par ); } - protected function getLoginSecurityLevel() { - return $this->getName(); - } + protected function getLoginSecurityLevel() { + return $this->getName(); + } protected function checkExecutePermissions( User $user ) { if ( !AuthManager::singleton()->allowsPropertyChange( 'emailaddress' ) ) { diff -Nru mediawiki-1.31.2/includes/specials/SpecialDoubleRedirects.php mediawiki-1.31.7/includes/specials/SpecialDoubleRedirects.php --- mediawiki-1.31.2/includes/specials/SpecialDoubleRedirects.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialDoubleRedirects.php 2020-03-26 17:15:34.000000000 +0000 @@ -64,7 +64,6 @@ 'fields' => [ 'namespace' => 'pa.page_namespace', 'title' => 'pa.page_title', - 'value' => 'pa.page_title', 'b_namespace' => 'pb.page_namespace', 'b_title' => 'pb.page_title', diff -Nru mediawiki-1.31.2/includes/specials/SpecialEditTags.php mediawiki-1.31.7/includes/specials/SpecialEditTags.php --- mediawiki-1.31.2/includes/specials/SpecialEditTags.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialEditTags.php 2020-03-26 17:18:21.000000000 +0000 @@ -225,7 +225,7 @@ // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $list->reset(); $list->current(); $list->next() ) { $item = $list->current(); - if ( !$item->canView() ){ + if ( !$item->canView() ) { throw new ErrorPageError( 'permissionserrors', 'tags-update-no-permission' ); } $numRevisions++; diff -Nru mediawiki-1.31.2/includes/specials/SpecialListredirects.php mediawiki-1.31.7/includes/specials/SpecialListredirects.php --- mediawiki-1.31.2/includes/specials/SpecialListredirects.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialListredirects.php 2020-03-26 17:15:34.000000000 +0000 @@ -53,7 +53,6 @@ 'tables' => [ 'p1' => 'page', 'redirect', 'p2' => 'page' ], 'fields' => [ 'namespace' => 'p1.page_namespace', 'title' => 'p1.page_title', - 'value' => 'p1.page_title', 'rd_namespace', 'rd_title', 'rd_fragment', diff -Nru mediawiki-1.31.2/includes/specials/SpecialLonelypages.php mediawiki-1.31.7/includes/specials/SpecialLonelypages.php --- mediawiki-1.31.2/includes/specials/SpecialLonelypages.php 2019-06-04 20:51:40.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialLonelypages.php 2020-03-26 17:15:34.000000000 +0000 @@ -79,7 +79,6 @@ 'fields' => [ 'namespace' => 'page_namespace', 'title' => 'page_title', - 'value' => 'page_title' ], 'conds' => $conds, 'join_conds' => $joinConds diff -Nru mediawiki-1.31.2/includes/specials/SpecialPasswordReset.php mediawiki-1.31.7/includes/specials/SpecialPasswordReset.php --- mediawiki-1.31.2/includes/specials/SpecialPasswordReset.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialPasswordReset.php 2020-03-26 17:18:21.000000000 +0000 @@ -74,6 +74,15 @@ parent::checkExecutePermissions( $user ); } + /** + * @param string $par + */ + public function execute( $par ) { + $out = $this->getOutput(); + $out->disallowUserJs(); + parent::execute( $par ); + } + protected function getFormFields() { $resetRoutes = $this->getConfig()->get( 'PasswordResetRoutes' ); $a = []; diff -Nru mediawiki-1.31.2/includes/specials/SpecialRedirect.php mediawiki-1.31.7/includes/specials/SpecialRedirect.php --- mediawiki-1.31.2/includes/specials/SpecialRedirect.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialRedirect.php 2020-03-26 17:18:21.000000000 +0000 @@ -68,37 +68,49 @@ /** * Handle Special:Redirect/user/xxxx (by redirecting to User:YYYY) * - * @return string|null Url to redirect to, or null if $mValue is invalid. + * @return Status A good status contains the url to redirect to */ function dispatchUser() { if ( !ctype_digit( $this->mValue ) ) { - return null; + // Message: redirect-not-numeric + return Status::newFatal( $this->getMessagePrefix() . '-not-numeric' ); } $user = User::newFromId( (int)$this->mValue ); $username = $user->getName(); // load User as side-effect if ( $user->isAnon() ) { - return null; + // Message: redirect-not-exists + return Status::newFatal( $this->getMessagePrefix() . '-not-exists' ); + } + if ( $user->isHidden() && !$this->getUser()->isAllowed( 'hideuser' ) ) { + throw new PermissionsError( null, [ 'badaccess-group0' ] ); } $userpage = Title::makeTitle( NS_USER, $username ); - return $userpage->getFullURL( '', false, PROTO_CURRENT ); + return Status::newGood( [ + $userpage->getFullURL( '', false, PROTO_CURRENT ), 302 + ] ); } /** * Handle Special:Redirect/file/xxxx * - * @return string|null Url to redirect to, or null if $mValue is not found. + * @return Status A good status contains the url to redirect to */ function dispatchFile() { - $title = Title::makeTitleSafe( NS_FILE, $this->mValue ); - - if ( !$title instanceof Title ) { - return null; + try { + $title = Title::newFromTextThrow( $this->mValue, NS_FILE ); + if ( $title && !$title->inNamespace( NS_FILE ) ) { + // If the given value contains a namespace enforce file namespace + $title = Title::newFromTextThrow( Title::makeName( NS_FILE, $this->mValue ) ); + } + } catch ( MalformedTitleException $e ) { + return Status::newFatal( $e->getMessageObject() ); } $file = wfFindFile( $title ); if ( !$file || !$file->exists() ) { - return null; + // Message: redirect-not-exists + return Status::newFatal( $this->getMessagePrefix() . '-not-exists' ); } // Default behavior: Use the direct link to the file. $url = $file->getUrl(); @@ -112,52 +124,58 @@ // ... and we can if ( $mto && !$mto->isError() ) { // ... change the URL to point to a thumbnail. - $url = $mto->getUrl(); + // Note: This url is more temporary as can change + // if file is reuploaded and has different aspect ratio. + $url = [ $mto->getUrl(), $height === -1 ? 301 : 302 ]; } } - return $url; + return Status::newGood( $url ); } /** * Handle Special:Redirect/revision/xxx * (by redirecting to index.php?oldid=xxx) * - * @return string|null Url to redirect to, or null if $mValue is invalid. + * @return Status A good status contains the url to redirect to */ function dispatchRevision() { $oldid = $this->mValue; if ( !ctype_digit( $oldid ) ) { - return null; + // Message: redirect-not-numeric + return Status::newFatal( $this->getMessagePrefix() . '-not-numeric' ); } $oldid = (int)$oldid; if ( $oldid === 0 ) { - return null; + // Message: redirect-not-exists + return Status::newFatal( $this->getMessagePrefix() . '-not-exists' ); } - return wfAppendQuery( wfScript( 'index' ), [ + return Status::newGood( wfAppendQuery( wfScript( 'index' ), [ 'oldid' => $oldid - ] ); + ] ) ); } /** * Handle Special:Redirect/page/xxx (by redirecting to index.php?curid=xxx) * - * @return string|null Url to redirect to, or null if $mValue is invalid. + * @return Status A good status contains the url to redirect to */ function dispatchPage() { $curid = $this->mValue; if ( !ctype_digit( $curid ) ) { - return null; + // Message: redirect-not-numeric + return Status::newFatal( $this->getMessagePrefix() . '-not-numeric' ); } $curid = (int)$curid; if ( $curid === 0 ) { - return null; + // Message: redirect-not-exists + return Status::newFatal( $this->getMessagePrefix() . '-not-exists' ); } - return wfAppendQuery( wfScript( 'index' ), [ + return Status::newGood( wfAppendQuery( wfScript( 'index' ), [ 'curid' => $curid - ] ); + ] ) ); } /** @@ -165,19 +183,21 @@ * (by redirecting to index.php?title=Special:Log&logid=xxx) * * @since 1.27 - * @return string|null Url to redirect to, or null if $mValue is invalid. + * @return Status A good status contains the url to redirect to */ function dispatchLog() { $logid = $this->mValue; if ( !ctype_digit( $logid ) ) { - return null; + // Message: redirect-not-numeric + return Status::newFatal( $this->getMessagePrefix() . '-not-numeric' ); } $logid = (int)$logid; if ( $logid === 0 ) { - return null; + // Message: redirect-not-exists + return Status::newFatal( $this->getMessagePrefix() . '-not-exists' ); } $query = [ 'title' => 'Special:Log', 'logid' => $logid ]; - return wfAppendQuery( wfScript( 'index' ), $query ); + return Status::newGood( wfAppendQuery( wfScript( 'index' ), $query ) ); } /** @@ -186,41 +206,53 @@ * or do nothing (if $mValue wasn't set) allowing the form to be * displayed. * - * @return bool True if a redirect was successfully handled. + * @return Status|bool True if a redirect was successfully handled. */ function dispatch() { // the various namespaces supported by Special:Redirect switch ( $this->mType ) { case 'user': - $url = $this->dispatchUser(); + $status = $this->dispatchUser(); break; case 'file': - $url = $this->dispatchFile(); + $status = $this->dispatchFile(); break; case 'revision': - $url = $this->dispatchRevision(); + $status = $this->dispatchRevision(); break; case 'page': - $url = $this->dispatchPage(); + $status = $this->dispatchPage(); break; case 'logid': - $url = $this->dispatchLog(); + $status = $this->dispatchLog(); break; default: - $url = null; + $status = null; break; } - if ( $url ) { - $this->getOutput()->redirect( $url ); + if ( $status && $status->isGood() ) { + // These urls can sometimes be linked from prominent places, + // so varnish cache. + $value = $status->getValue(); + if ( is_array( $value ) ) { + list( $url, $code ) = $value; + } else { + $url = $value; + $code = 301; + } + if ( $code === 301 ) { + $this->getOutput()->setCdnMaxage( 60 * 60 ); + } else { + $this->getOutput()->setCdnMaxage( 10 ); + } + $this->getOutput()->redirect( $url, $code ); return true; } if ( !is_null( $this->mValue ) ) { $this->getOutput()->setStatusCode( 404 ); - // Message: redirect-not-exists - $msg = $this->getMessagePrefix() . '-not-exists'; - return Status::newFatal( $msg ); + return $status; } return false; diff -Nru mediawiki-1.31.2/includes/specials/SpecialUncategorizedimages.php mediawiki-1.31.7/includes/specials/SpecialUncategorizedimages.php --- mediawiki-1.31.2/includes/specials/SpecialUncategorizedimages.php 2018-12-12 23:21:35.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialUncategorizedimages.php 2020-03-26 17:15:34.000000000 +0000 @@ -45,17 +45,28 @@ return false; } + function getOrderFields() { + return [ 'title' ]; + } + function getQueryInfo() { return [ 'tables' => [ 'page', 'categorylinks' ], - 'fields' => [ 'namespace' => 'page_namespace', + 'fields' => [ + 'namespace' => 'page_namespace', 'title' => 'page_title', - 'value' => 'page_title' ], - 'conds' => [ 'cl_from IS NULL', + ], + 'conds' => [ + 'cl_from IS NULL', 'page_namespace' => NS_FILE, - 'page_is_redirect' => 0 ], - 'join_conds' => [ 'categorylinks' => [ - 'LEFT JOIN', 'cl_from=page_id' ] ] + 'page_is_redirect' => 0, + ], + 'join_conds' => [ + 'categorylinks' => [ + 'LEFT JOIN', + 'cl_from=page_id', + ], + ], ]; } diff -Nru mediawiki-1.31.2/includes/specials/SpecialUncategorizedpages.php mediawiki-1.31.7/includes/specials/SpecialUncategorizedpages.php --- mediawiki-1.31.2/includes/specials/SpecialUncategorizedpages.php 2019-06-04 20:51:40.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialUncategorizedpages.php 2020-03-26 17:15:34.000000000 +0000 @@ -52,7 +52,6 @@ 'fields' => [ 'namespace' => 'page_namespace', 'title' => 'page_title', - 'value' => 'page_title' ], // default for page_namespace is all content namespaces (if requestedNamespace is false) // otherwise, page_namespace is requestedNamespace diff -Nru mediawiki-1.31.2/includes/specials/SpecialUnusedcategories.php mediawiki-1.31.7/includes/specials/SpecialUnusedcategories.php --- mediawiki-1.31.2/includes/specials/SpecialUnusedcategories.php 2019-06-05 20:14:29.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialUnusedcategories.php 2020-03-26 17:18:21.000000000 +0000 @@ -37,13 +37,16 @@ return $this->msg( 'unusedcategoriestext' )->parseAsBlock(); } + function getOrderFields() { + return [ 'title' ]; + } + public function getQueryInfo() { return [ 'tables' => [ 'page', 'categorylinks' ], 'fields' => [ 'namespace' => 'page_namespace', 'title' => 'page_title', - 'value' => 'page_title' ], 'conds' => [ 'cl_from IS NULL', diff -Nru mediawiki-1.31.2/includes/specials/SpecialUnusedtemplates.php mediawiki-1.31.7/includes/specials/SpecialUnusedtemplates.php --- mediawiki-1.31.2/includes/specials/SpecialUnusedtemplates.php 2019-06-05 20:14:29.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialUnusedtemplates.php 2020-03-26 17:15:34.000000000 +0000 @@ -46,13 +46,16 @@ return false; } + function getOrderFields() { + return [ 'title' ]; + } + public function getQueryInfo() { return [ 'tables' => [ 'page', 'templatelinks' ], 'fields' => [ 'namespace' => 'page_namespace', 'title' => 'page_title', - 'value' => 'page_title' ], 'conds' => [ 'page_namespace' => NS_TEMPLATE, diff -Nru mediawiki-1.31.2/includes/specials/SpecialWithoutinterwiki.php mediawiki-1.31.7/includes/specials/SpecialWithoutinterwiki.php --- mediawiki-1.31.2/includes/specials/SpecialWithoutinterwiki.php 2019-06-05 20:14:29.000000000 +0000 +++ mediawiki-1.31.7/includes/specials/SpecialWithoutinterwiki.php 2020-03-26 17:15:34.000000000 +0000 @@ -87,7 +87,6 @@ 'fields' => [ 'namespace' => 'page_namespace', 'title' => 'page_title', - 'value' => 'page_title' ], 'conds' => [ 'll_title IS NULL', diff -Nru mediawiki-1.31.2/includes/user/UserGroupMembership.php mediawiki-1.31.7/includes/user/UserGroupMembership.php --- mediawiki-1.31.2/includes/user/UserGroupMembership.php 2019-06-05 20:18:05.000000000 +0000 +++ mediawiki-1.31.7/includes/user/UserGroupMembership.php 2020-03-26 17:18:21.000000000 +0000 @@ -396,15 +396,19 @@ // link to the group description page, if it exists $linkTitle = self::getGroupPage( $group ); - if ( $linkTitle ) { - if ( $format === 'wiki' ) { + if ( $format === 'wiki' ) { + if ( $linkTitle ) { $linkPage = $linkTitle->getFullText(); $groupLink = "[[$linkPage|$groupName]]"; } else { - $groupLink = Linker::link( $linkTitle, htmlspecialchars( $groupName ) ); + $groupLink = $groupName; } } else { - $groupLink = htmlspecialchars( $groupName ); + if ( $linkTitle ) { + $groupLink = Linker::link( $linkTitle, htmlspecialchars( $groupName ) ); + } else { + $groupLink = htmlspecialchars( $groupName ); + } } if ( $expiry ) { @@ -414,14 +418,18 @@ $expiryDT = $uiLanguage->userTimeAndDate( $expiry, $uiUser ); $expiryD = $uiLanguage->userDate( $expiry, $uiUser ); $expiryT = $uiLanguage->userTime( $expiry, $uiUser ); - if ( $format === 'html' ) { + + if ( $format === 'wiki' ) { + return $context->msg( 'group-membership-link-with-expiry' ) + ->params( $groupLink, $expiryDT, $expiryD, $expiryT )->text(); + } else { $groupLink = Message::rawParam( $groupLink ); + return $context->msg( 'group-membership-link-with-expiry' ) + ->params( $groupLink, $expiryDT, $expiryD, $expiryT )->escaped(); } - return $context->msg( 'group-membership-link-with-expiry' ) - ->params( $groupLink, $expiryDT, $expiryD, $expiryT )->text(); - } else { - return $groupLink; } + + return $groupLink; } /** diff -Nru mediawiki-1.31.2/languages/classes/LanguageTr.php mediawiki-1.31.7/languages/classes/LanguageTr.php --- mediawiki-1.31.2/languages/classes/LanguageTr.php 2019-06-05 20:14:29.000000000 +0000 +++ mediawiki-1.31.7/languages/classes/LanguageTr.php 2020-03-26 16:54:26.000000000 +0000 @@ -24,21 +24,33 @@ /** * Turkish (Türkçe) * - * Turkish has two different i, one with a dot and another without a dot. They - * are totally different letters in this language, so we have to override the + * The Turkish language, like other Turkic languages, distinguishes + * a dotted letter 'i' from a dotless letter 'ı' (U+0131 LATIN SMALL LETTER DOTLESS I). + * In these languages, each has an equivalent uppercase mapping: + * ı (U+0131 LATIN SMALL LETTER DOTLESS I) -> I (U+0049 LATIN CAPITAL LETTER I), + * i (U+0069 LATIN SMALL LETTER I) -> İ (U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE). + * + * Unicode CaseFolding.txt defines this case as type 'T', a special case for Turkic languages: + * tr and az. PHP 7.3 parser ignores this special cases. so we have to override the * ucfirst and lcfirst methods. + * * See https://en.wikipedia.org/wiki/Dotted_and_dotless_I and T30040 * @ingroup Language */ class LanguageTr extends Language { + private $uc = [ 'I', 'İ' ]; + private $lc = [ 'ı', 'i' ]; + /** * @param string $string * @return string */ public function ucfirst( $string ) { - if ( strlen( $string ) && $string[0] == 'i' ) { - return 'İ' . substr( $string, 1 ); + $first = mb_substr( $string, 0, 1 ); + if ( in_array( $first, $this->lc ) ) { + $first = str_replace( $this->lc, $this->uc, $first ); + return $first . mb_substr( $string, 1 ); } return parent::ucfirst( $string ); } @@ -48,8 +60,10 @@ * @return mixed|string */ function lcfirst( $string ) { - if ( strlen( $string ) && $string[0] == 'I' ) { - return 'ı' . substr( $string, 1 ); + $first = mb_substr( $string, 0, 1 ); + if ( in_array( $first, $this->uc ) ) { + $first = str_replace( $this->uc, $this->lc, $first ); + return $first . mb_substr( $string, 1 ); } return parent::lcfirst( $string ); } diff -Nru mediawiki-1.31.2/languages/i18n/en.json mediawiki-1.31.7/languages/i18n/en.json --- mediawiki-1.31.2/languages/i18n/en.json 2019-06-05 20:18:06.000000000 +0000 +++ mediawiki-1.31.7/languages/i18n/en.json 2020-03-26 17:18:22.000000000 +0000 @@ -3869,6 +3869,7 @@ "redirect-file": "Filename", "redirect-logid": "Log ID", "redirect-not-exists": "Value not found", + "redirect-not-numeric": "Value not numeric", "fileduplicatesearch": "Search for duplicate files", "fileduplicatesearch-summary": "Search for duplicate files based on hash values.", "fileduplicatesearch-filename": "Filename:", diff -Nru mediawiki-1.31.2/languages/i18n/qqq.json mediawiki-1.31.7/languages/i18n/qqq.json --- mediawiki-1.31.2/languages/i18n/qqq.json 2019-06-05 20:18:07.000000000 +0000 +++ mediawiki-1.31.7/languages/i18n/qqq.json 2020-03-26 17:18:23.000000000 +0000 @@ -4066,6 +4066,7 @@ "redirect-file": "Description of lookup type for [[Special:Redirect]].\n{{Identical|Filename}}", "redirect-logid": "Description of lookup type for [[Special:Redirect]].\n{{Identical|Log ID}}", "redirect-not-exists": "Used as error message in [[Special:Redirect]]", + "redirect-not-numeric": "Used as error message in [[Special:Redirect]]", "fileduplicatesearch": "Name of special page [[Special:FileDuplicateSearch]].", "fileduplicatesearch-summary": "Summary of [[Special:FileDuplicateSearch]]", "fileduplicatesearch-filename": "Input form of [[Special:FileDuplicateSearch]]:\n\n{{Identical|Filename}}", diff -Nru mediawiki-1.31.2/maintenance/addSite.php mediawiki-1.31.7/maintenance/addSite.php --- mediawiki-1.31.2/maintenance/addSite.php 2019-06-05 20:18:08.000000000 +0000 +++ mediawiki-1.31.7/maintenance/addSite.php 2020-03-26 17:18:23.000000000 +0000 @@ -21,13 +21,13 @@ $this->addArg( 'globalid', 'The global id of the site to add, e.g. "wikipedia".', true ); $this->addArg( 'group', 'In which group this site should be sorted in.', true ); - $this->addOption( 'language', 'The language code of the site, e.g. "de".' ); - $this->addOption( 'interwiki-id', 'The interwiki ID of the site.' ); - $this->addOption( 'navigation-id', 'The navigation ID of the site.' ); + $this->addOption( 'language', 'The language code of the site, e.g. "de".', false, true ); + $this->addOption( 'interwiki-id', 'The interwiki ID of the site.', false, true ); + $this->addOption( 'navigation-id', 'The navigation ID of the site.', false, true ); $this->addOption( 'pagepath', 'The URL to pages of this site, e.g.' . - ' https://example.com/wiki/\$1.' ); - $this->addOption( 'filepath', 'The URL to files of this site, e.g. https://example - .com/w/\$1.' ); + ' https://example.com/wiki/\$1.', false, true ); + $this->addOption( 'filepath', 'The URL to files of this site, e.g. https://example' . + '.com/w/\$1.', false, true ); parent::__construct(); } diff -Nru mediawiki-1.31.2/maintenance/archives/patch-actor-table.sql mediawiki-1.31.7/maintenance/archives/patch-actor-table.sql --- mediawiki-1.31.2/maintenance/archives/patch-actor-table.sql 2019-06-05 20:18:08.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-actor-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -1,7 +1,7 @@ -- -- patch-actor-table.sql -- --- T167246. Add an `actor` table and various columns (and temporary tables) to reference it. +-- T167246. Add an `actor` table. CREATE TABLE /*_*/actor ( actor_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, @@ -10,48 +10,3 @@ ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/actor_user ON /*_*/actor (actor_user); CREATE UNIQUE INDEX /*i*/actor_name ON /*_*/actor (actor_name); - -CREATE TABLE /*_*/revision_actor_temp ( - revactor_rev int unsigned NOT NULL, - revactor_actor bigint unsigned NOT NULL, - revactor_timestamp binary(14) NOT NULL default '', - revactor_page int unsigned NOT NULL, - PRIMARY KEY (revactor_rev, revactor_actor) -) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/revactor_rev ON /*_*/revision_actor_temp (revactor_rev); -CREATE INDEX /*i*/actor_timestamp ON /*_*/revision_actor_temp (revactor_actor,revactor_timestamp); -CREATE INDEX /*i*/page_actor_timestamp ON /*_*/revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp); - -ALTER TABLE /*_*/archive - ALTER COLUMN ar_user_text SET DEFAULT '', - ADD COLUMN ar_actor bigint unsigned NOT NULL DEFAULT 0 AFTER ar_user_text; -CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp); - -ALTER TABLE /*_*/ipblocks - ADD COLUMN ipb_by_actor bigint unsigned NOT NULL DEFAULT 0 AFTER ipb_by_text; - -ALTER TABLE /*_*/image - ALTER COLUMN img_user_text SET DEFAULT '', - ADD COLUMN img_actor bigint unsigned NOT NULL DEFAULT 0 AFTER img_user_text; -CREATE INDEX /*i*/img_actor_timestamp ON /*_*/image (img_actor, img_timestamp); - -ALTER TABLE /*_*/oldimage - ALTER COLUMN oi_user_text SET DEFAULT '', - ADD COLUMN oi_actor bigint unsigned NOT NULL DEFAULT 0 AFTER oi_user_text; -CREATE INDEX /*i*/oi_actor_timestamp ON /*_*/oldimage (oi_actor,oi_timestamp); - -ALTER TABLE /*_*/filearchive - ALTER COLUMN fa_user_text SET DEFAULT '', - ADD COLUMN fa_actor bigint unsigned NOT NULL DEFAULT 0 AFTER fa_user_text; -CREATE INDEX /*i*/fa_actor_timestamp ON /*_*/filearchive (fa_actor,fa_timestamp); - -ALTER TABLE /*_*/recentchanges - ALTER COLUMN rc_user_text SET DEFAULT '', - ADD COLUMN rc_actor bigint unsigned NOT NULL DEFAULT 0 AFTER rc_user_text; -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 COLUMN log_actor bigint unsigned NOT NULL DEFAULT 0 AFTER log_user_text; -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); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-archive-ar_actor.sql mediawiki-1.31.7/maintenance/archives/patch-archive-ar_actor.sql --- mediawiki-1.31.2/maintenance/archives/patch-archive-ar_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-archive-ar_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,4 @@ +ALTER TABLE /*_*/archive + ALTER COLUMN ar_user_text SET DEFAULT '', + ADD COLUMN ar_actor bigint unsigned NOT NULL DEFAULT 0 AFTER ar_user_text; +CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-archive-ar_comment_id.sql mediawiki-1.31.7/maintenance/archives/patch-archive-ar_comment_id.sql --- mediawiki-1.31.2/maintenance/archives/patch-archive-ar_comment_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-archive-ar_comment_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,3 @@ +ALTER TABLE /*_*/archive + ALTER COLUMN ar_comment SET DEFAULT '', + ADD COLUMN ar_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER ar_comment; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-comment-table.sql mediawiki-1.31.7/maintenance/archives/patch-comment-table.sql --- mediawiki-1.31.2/maintenance/archives/patch-comment-table.sql 2019-06-05 20:14:32.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-comment-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -1,7 +1,7 @@ -- -- patch-comment-table.sql -- --- T166732. Add a `comment` table and various columns (and temporary tables) to reference it. +-- T166732. Add a `comment` table. CREATE TABLE /*_*/comment ( comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, @@ -10,50 +10,3 @@ comment_data BLOB ) /*$wgDBTableOptions*/; CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash); - -CREATE TABLE /*_*/revision_comment_temp ( - revcomment_rev int unsigned NOT NULL, - revcomment_comment_id bigint unsigned NOT NULL, - PRIMARY KEY (revcomment_rev, revcomment_comment_id) -) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev); - -CREATE TABLE /*_*/image_comment_temp ( - imgcomment_name varchar(255) binary NOT NULL, - imgcomment_description_id bigint unsigned NOT NULL, - PRIMARY KEY (imgcomment_name, imgcomment_description_id) -) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name); - -ALTER TABLE /*_*/revision - ALTER COLUMN rev_comment SET DEFAULT ''; - -ALTER TABLE /*_*/archive - ALTER COLUMN ar_comment SET DEFAULT '', - ADD COLUMN ar_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER ar_comment; - -ALTER TABLE /*_*/ipblocks - ALTER COLUMN ipb_reason SET DEFAULT '', - ADD COLUMN ipb_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER ipb_reason; - -ALTER TABLE /*_*/image - ALTER COLUMN img_description SET DEFAULT ''; - -ALTER TABLE /*_*/oldimage - ALTER COLUMN oi_description SET DEFAULT '', - ADD COLUMN oi_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER oi_description; - -ALTER TABLE /*_*/filearchive - ADD COLUMN fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_deleted_reason, - ALTER COLUMN fa_description SET DEFAULT '', - ADD COLUMN fa_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_description; - -ALTER TABLE /*_*/recentchanges - ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER rc_comment; - -ALTER TABLE /*_*/logging - ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER log_comment; - -ALTER TABLE /*_*/protected_titles - ALTER COLUMN pt_reason SET DEFAULT '', - ADD COLUMN pt_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER pt_reason; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-filearchive-fa_actor.sql mediawiki-1.31.7/maintenance/archives/patch-filearchive-fa_actor.sql --- mediawiki-1.31.2/maintenance/archives/patch-filearchive-fa_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-filearchive-fa_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,4 @@ +ALTER TABLE /*_*/filearchive + ALTER COLUMN fa_user_text SET DEFAULT '', + ADD COLUMN fa_actor bigint unsigned NOT NULL DEFAULT 0 AFTER fa_user_text; +CREATE INDEX /*i*/fa_actor_timestamp ON /*_*/filearchive (fa_actor,fa_timestamp); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-filearchive-fa_description_id.sql mediawiki-1.31.7/maintenance/archives/patch-filearchive-fa_description_id.sql --- mediawiki-1.31.2/maintenance/archives/patch-filearchive-fa_description_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-filearchive-fa_description_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,4 @@ +ALTER TABLE /*_*/filearchive + ADD COLUMN fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_deleted_reason, + ALTER COLUMN fa_description SET DEFAULT '', + ADD COLUMN fa_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_description; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-image_comment_temp-table.sql mediawiki-1.31.7/maintenance/archives/patch-image_comment_temp-table.sql --- mediawiki-1.31.2/maintenance/archives/patch-image_comment_temp-table.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-image_comment_temp-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,6 @@ +CREATE TABLE /*_*/image_comment_temp ( + imgcomment_name varchar(255) binary NOT NULL, + imgcomment_description_id bigint unsigned NOT NULL, + PRIMARY KEY (imgcomment_name, imgcomment_description_id) +) /*$wgDBTableOptions*/; +CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-image-img_actor.sql mediawiki-1.31.7/maintenance/archives/patch-image-img_actor.sql --- mediawiki-1.31.2/maintenance/archives/patch-image-img_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-image-img_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,4 @@ +ALTER TABLE /*_*/image + ALTER COLUMN img_user_text SET DEFAULT '', + ADD COLUMN img_actor bigint unsigned NOT NULL DEFAULT 0 AFTER img_user_text; +CREATE INDEX /*i*/img_actor_timestamp ON /*_*/image (img_actor, img_timestamp); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-image-img_description-default.sql mediawiki-1.31.7/maintenance/archives/patch-image-img_description-default.sql --- mediawiki-1.31.2/maintenance/archives/patch-image-img_description-default.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-image-img_description-default.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/image + ALTER COLUMN img_description SET DEFAULT ''; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-ipblocks-ipb_by_actor.sql mediawiki-1.31.7/maintenance/archives/patch-ipblocks-ipb_by_actor.sql --- mediawiki-1.31.2/maintenance/archives/patch-ipblocks-ipb_by_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-ipblocks-ipb_by_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/ipblocks + ADD COLUMN ipb_by_actor bigint unsigned NOT NULL DEFAULT 0 AFTER ipb_by_text; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-ipblocks-ipb_reason_id.sql mediawiki-1.31.7/maintenance/archives/patch-ipblocks-ipb_reason_id.sql --- mediawiki-1.31.2/maintenance/archives/patch-ipblocks-ipb_reason_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-ipblocks-ipb_reason_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,3 @@ +ALTER TABLE /*_*/ipblocks + ALTER COLUMN ipb_reason SET DEFAULT '', + ADD COLUMN ipb_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER ipb_reason; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-logging-log_actor.sql mediawiki-1.31.7/maintenance/archives/patch-logging-log_actor.sql --- mediawiki-1.31.2/maintenance/archives/patch-logging-log_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-logging-log_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,4 @@ +ALTER TABLE /*_*/logging + ADD COLUMN log_actor bigint unsigned NOT NULL DEFAULT 0 AFTER log_user_text; +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); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-logging-log_comment_id.sql mediawiki-1.31.7/maintenance/archives/patch-logging-log_comment_id.sql --- mediawiki-1.31.2/maintenance/archives/patch-logging-log_comment_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-logging-log_comment_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/logging + ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER log_comment; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-oldimage-oi_actor.sql mediawiki-1.31.7/maintenance/archives/patch-oldimage-oi_actor.sql --- mediawiki-1.31.2/maintenance/archives/patch-oldimage-oi_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-oldimage-oi_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,4 @@ +ALTER TABLE /*_*/oldimage + ALTER COLUMN oi_user_text SET DEFAULT '', + ADD COLUMN oi_actor bigint unsigned NOT NULL DEFAULT 0 AFTER oi_user_text; +CREATE INDEX /*i*/oi_actor_timestamp ON /*_*/oldimage (oi_actor,oi_timestamp); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-oldimage-oi_description_id.sql mediawiki-1.31.7/maintenance/archives/patch-oldimage-oi_description_id.sql --- mediawiki-1.31.2/maintenance/archives/patch-oldimage-oi_description_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-oldimage-oi_description_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,3 @@ +ALTER TABLE /*_*/oldimage + ALTER COLUMN oi_description SET DEFAULT '', + ADD COLUMN oi_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER oi_description; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-protected_titles-pt_reason_id.sql mediawiki-1.31.7/maintenance/archives/patch-protected_titles-pt_reason_id.sql --- mediawiki-1.31.2/maintenance/archives/patch-protected_titles-pt_reason_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-protected_titles-pt_reason_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,3 @@ +ALTER TABLE /*_*/protected_titles + ALTER COLUMN pt_reason SET DEFAULT '', + ADD COLUMN pt_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER pt_reason; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-recentchanges-rc_actor.sql mediawiki-1.31.7/maintenance/archives/patch-recentchanges-rc_actor.sql --- mediawiki-1.31.2/maintenance/archives/patch-recentchanges-rc_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-recentchanges-rc_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,5 @@ +ALTER TABLE /*_*/recentchanges + ALTER COLUMN rc_user_text SET DEFAULT '', + ADD COLUMN rc_actor bigint unsigned NOT NULL DEFAULT 0 AFTER rc_user_text; +CREATE INDEX /*i*/rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor); +CREATE INDEX /*i*/rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-recentchanges-rc_comment_id.sql mediawiki-1.31.7/maintenance/archives/patch-recentchanges-rc_comment_id.sql --- mediawiki-1.31.2/maintenance/archives/patch-recentchanges-rc_comment_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-recentchanges-rc_comment_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/recentchanges + ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER rc_comment; diff -Nru mediawiki-1.31.2/maintenance/archives/patch-revision_actor_temp-table.sql mediawiki-1.31.7/maintenance/archives/patch-revision_actor_temp-table.sql --- mediawiki-1.31.2/maintenance/archives/patch-revision_actor_temp-table.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-revision_actor_temp-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,10 @@ +CREATE TABLE /*_*/revision_actor_temp ( + revactor_rev int unsigned NOT NULL, + revactor_actor bigint unsigned NOT NULL, + revactor_timestamp binary(14) NOT NULL default '', + revactor_page int unsigned NOT NULL, + PRIMARY KEY (revactor_rev, revactor_actor) +) /*$wgDBTableOptions*/; +CREATE UNIQUE INDEX /*i*/revactor_rev ON /*_*/revision_actor_temp (revactor_rev); +CREATE INDEX /*i*/actor_timestamp ON /*_*/revision_actor_temp (revactor_actor,revactor_timestamp); +CREATE INDEX /*i*/page_actor_timestamp ON /*_*/revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-revision_comment_temp-table.sql mediawiki-1.31.7/maintenance/archives/patch-revision_comment_temp-table.sql --- mediawiki-1.31.2/maintenance/archives/patch-revision_comment_temp-table.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-revision_comment_temp-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,6 @@ +CREATE TABLE /*_*/revision_comment_temp ( + revcomment_rev int unsigned NOT NULL, + revcomment_comment_id bigint unsigned NOT NULL, + PRIMARY KEY (revcomment_rev, revcomment_comment_id) +) /*$wgDBTableOptions*/; +CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev); diff -Nru mediawiki-1.31.2/maintenance/archives/patch-revision-rev_comment-default.sql mediawiki-1.31.7/maintenance/archives/patch-revision-rev_comment-default.sql --- mediawiki-1.31.2/maintenance/archives/patch-revision-rev_comment-default.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/archives/patch-revision-rev_comment-default.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/revision + ALTER COLUMN rev_comment SET DEFAULT ''; diff -Nru mediawiki-1.31.2/maintenance/checkComposerLockUpToDate.php mediawiki-1.31.7/maintenance/checkComposerLockUpToDate.php --- mediawiki-1.31.2/maintenance/checkComposerLockUpToDate.php 2019-06-05 20:18:08.000000000 +0000 +++ mediawiki-1.31.7/maintenance/checkComposerLockUpToDate.php 2020-03-02 01:05:32.000000000 +0000 @@ -2,6 +2,8 @@ require_once __DIR__ . '/Maintenance.php'; +use Composer\Semver\Semver; + /** * Checks whether your composer-installed dependencies are up to date * @@ -38,7 +40,7 @@ $installed = $lock->getInstalledDependencies(); foreach ( $json->getRequiredDependencies() as $name => $version ) { if ( isset( $installed[$name] ) ) { - if ( $installed[$name]['version'] !== $version ) { + if ( !SemVer::satisfies( $installed[$name]['version'], $version ) ) { $this->output( "$name: {$installed[$name]['version']} installed, $version required.\n" ); diff -Nru mediawiki-1.31.2/maintenance/postgres/archives/patch-actor-table.sql mediawiki-1.31.7/maintenance/postgres/archives/patch-actor-table.sql --- mediawiki-1.31.2/maintenance/postgres/archives/patch-actor-table.sql 2019-06-05 20:18:08.000000000 +0000 +++ mediawiki-1.31.7/maintenance/postgres/archives/patch-actor-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -1,7 +1,7 @@ -- -- patch-actor-table.sql -- --- T167246. Add an `actor` table and various columns (and temporary tables) to reference it. +-- T167246. Add an `actor` table. CREATE SEQUENCE actor_actor_id_seq; CREATE TABLE actor ( @@ -11,14 +11,3 @@ ); CREATE UNIQUE INDEX actor_user ON actor (actor_user); CREATE UNIQUE INDEX actor_name ON actor (actor_name); - -CREATE TABLE revision_actor_temp ( - revactor_rev INTEGER NOT NULL, - revactor_actor INTEGER NOT NULL, - revactor_timestamp TIMESTAMPTZ NOT NULL, - revactor_page INTEGER NULL REFERENCES page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - PRIMARY KEY (revactor_rev, revactor_actor) -); -CREATE UNIQUE INDEX revactor_rev ON revision_actor_temp (revactor_rev); -CREATE INDEX rev_actor_timestamp ON revision_actor_temp (revactor_actor,revactor_timestamp); -CREATE INDEX rev_page_actor_timestamp ON revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp); diff -Nru mediawiki-1.31.2/maintenance/postgres/archives/patch-comment-table.sql mediawiki-1.31.7/maintenance/postgres/archives/patch-comment-table.sql --- mediawiki-1.31.2/maintenance/postgres/archives/patch-comment-table.sql 2019-06-05 20:14:32.000000000 +0000 +++ mediawiki-1.31.7/maintenance/postgres/archives/patch-comment-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -1,7 +1,7 @@ -- -- patch-comment-table.sql -- --- T166732. Add a `comment` table, and temporary tables to reference it. +-- T166732. Add a `comment` table CREATE SEQUENCE comment_comment_id_seq; CREATE TABLE comment ( @@ -11,17 +11,3 @@ comment_data TEXT ); CREATE INDEX comment_hash ON comment (comment_hash); - -CREATE TABLE revision_comment_temp ( - revcomment_rev INTEGER NOT NULL, - revcomment_comment_id INTEGER NOT NULL, - PRIMARY KEY (revcomment_rev, revcomment_comment_id) -); -CREATE UNIQUE INDEX revcomment_rev ON revision_comment_temp (revcomment_rev); - -CREATE TABLE image_comment_temp ( - imgcomment_name TEXT NOT NULL, - imgcomment_description_id INTEGER NOT NULL, - PRIMARY KEY (imgcomment_name, imgcomment_description_id) -); -CREATE UNIQUE INDEX imgcomment_name ON image_comment_temp (imgcomment_name); diff -Nru mediawiki-1.31.2/maintenance/postgres/archives/patch-image_comment_temp-table.sql mediawiki-1.31.7/maintenance/postgres/archives/patch-image_comment_temp-table.sql --- mediawiki-1.31.2/maintenance/postgres/archives/patch-image_comment_temp-table.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/postgres/archives/patch-image_comment_temp-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,6 @@ +CREATE TABLE image_comment_temp ( + imgcomment_name TEXT NOT NULL, + imgcomment_description_id INTEGER NOT NULL, + PRIMARY KEY (imgcomment_name, imgcomment_description_id) +); +CREATE UNIQUE INDEX imgcomment_name ON image_comment_temp (imgcomment_name); diff -Nru mediawiki-1.31.2/maintenance/postgres/archives/patch-revision_actor_temp-table.sql mediawiki-1.31.7/maintenance/postgres/archives/patch-revision_actor_temp-table.sql --- mediawiki-1.31.2/maintenance/postgres/archives/patch-revision_actor_temp-table.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/postgres/archives/patch-revision_actor_temp-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,10 @@ +CREATE TABLE revision_actor_temp ( + revactor_rev INTEGER NOT NULL, + revactor_actor INTEGER NOT NULL, + revactor_timestamp TIMESTAMPTZ NOT NULL, + revactor_page INTEGER NULL REFERENCES page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + PRIMARY KEY (revactor_rev, revactor_actor) +); +CREATE UNIQUE INDEX revactor_rev ON revision_actor_temp (revactor_rev); +CREATE INDEX rev_actor_timestamp ON revision_actor_temp (revactor_actor,revactor_timestamp); +CREATE INDEX rev_page_actor_timestamp ON revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp); diff -Nru mediawiki-1.31.2/maintenance/postgres/archives/patch-revision_comment_temp-table.sql mediawiki-1.31.7/maintenance/postgres/archives/patch-revision_comment_temp-table.sql --- mediawiki-1.31.2/maintenance/postgres/archives/patch-revision_comment_temp-table.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/postgres/archives/patch-revision_comment_temp-table.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,6 @@ +CREATE TABLE revision_comment_temp ( + revcomment_rev INTEGER NOT NULL, + revcomment_comment_id INTEGER NOT NULL, + PRIMARY KEY (revcomment_rev, revcomment_comment_id) +); +CREATE UNIQUE INDEX revcomment_rev ON revision_comment_temp (revcomment_rev); diff -Nru mediawiki-1.31.2/maintenance/recountCategories.php mediawiki-1.31.7/maintenance/recountCategories.php --- mediawiki-1.31.2/maintenance/recountCategories.php 2019-06-05 20:18:08.000000000 +0000 +++ mediawiki-1.31.7/maintenance/recountCategories.php 2020-03-26 17:15:36.000000000 +0000 @@ -98,7 +98,7 @@ protected function doWork() { $this->output( "Finding up to {$this->getBatchSize()} drifted rows " . - "starting at cat_id {$this->getBatchSize()}...\n" ); + "greater than cat_id {$this->minimumId}...\n" ); $countingConds = [ 'cl_to = cat_title' ]; if ( $this->mode === 'subcats' ) { diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-actor-table.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-actor-table.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-actor-table.sql 2019-06-05 20:18:08.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-actor-table.sql 1970-01-01 00:00:00.000000000 +0000 @@ -1,368 +0,0 @@ --- --- patch-actor-table.sql --- --- T167246. Add an `actor` table and various columns (and temporary tables) to reference it. --- Sigh, sqlite, such trouble just to change the default value of a column. - -CREATE TABLE /*_*/actor ( - actor_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, - actor_user int unsigned, - actor_name varchar(255) binary NOT NULL -) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/actor_user ON /*_*/actor (actor_user); -CREATE UNIQUE INDEX /*i*/actor_name ON /*_*/actor (actor_name); - -CREATE TABLE /*_*/revision_actor_temp ( - revactor_rev int unsigned NOT NULL, - revactor_actor bigint unsigned NOT NULL, - revactor_timestamp binary(14) NOT NULL default '', - revactor_page int unsigned NOT NULL, - PRIMARY KEY (revactor_rev, revactor_actor) -) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/revactor_rev ON /*_*/revision_actor_temp (revactor_rev); -CREATE INDEX /*i*/actor_timestamp ON /*_*/revision_actor_temp (revactor_actor,revactor_timestamp); -CREATE INDEX /*i*/page_actor_timestamp ON /*_*/revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp); - -BEGIN; - -DROP TABLE IF EXISTS /*_*/archive_tmp; -CREATE TABLE /*_*/archive_tmp ( - ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, - ar_namespace int NOT NULL default 0, - ar_title varchar(255) binary NOT NULL default '', - ar_comment varbinary(767) NOT NULL default '', - ar_comment_id bigint unsigned NOT NULL DEFAULT 0, - ar_user int unsigned NOT NULL default 0, - ar_user_text varchar(255) binary NOT NULL DEFAULT '', - ar_actor bigint unsigned NOT NULL DEFAULT 0, - ar_timestamp binary(14) NOT NULL default '', - ar_minor_edit tinyint NOT NULL default 0, - ar_rev_id int unsigned, - ar_text_id int unsigned NOT NULL default 0, - ar_deleted tinyint unsigned NOT NULL default 0, - ar_len int unsigned, - ar_page_id int unsigned, - ar_parent_id int unsigned default NULL, - ar_sha1 varbinary(32) NOT NULL default '', - ar_content_model varbinary(32) DEFAULT NULL, - ar_content_format varbinary(64) DEFAULT NULL -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/archive_tmp ( - ar_id, ar_namespace, ar_title, ar_comment, ar_user, ar_user_text, - ar_timestamp, ar_minor_edit, ar_rev_id, ar_text_id, ar_deleted, ar_len, - ar_page_id, ar_parent_id, ar_sha1, ar_content_model, ar_content_format) - SELECT - ar_id, ar_namespace, ar_title, ar_comment, ar_user, ar_user_text, - ar_timestamp, ar_minor_edit, ar_rev_id, ar_text_id, ar_deleted, ar_len, - ar_page_id, ar_parent_id, ar_sha1, ar_content_model, ar_content_format - FROM /*_*/archive; - -DROP TABLE /*_*/archive; -ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive; -CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); -CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); -CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id); -CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS ipblocks_tmp; -CREATE TABLE /*_*/ipblocks_tmp ( - ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, - ipb_address tinyblob NOT NULL, - ipb_user int unsigned NOT NULL default 0, - ipb_by int unsigned NOT NULL default 0, - ipb_by_text varchar(255) binary NOT NULL default '', - ipb_by_actor bigint unsigned NOT NULL DEFAULT 0, - ipb_reason varbinary(767) NOT NULL default '', - ipb_reason_id bigint unsigned NOT NULL DEFAULT 0, - ipb_timestamp binary(14) NOT NULL default '', - ipb_auto bool NOT NULL default 0, - ipb_anon_only bool NOT NULL default 0, - ipb_create_account bool NOT NULL default 1, - ipb_enable_autoblock bool NOT NULL default '1', - ipb_expiry varbinary(14) NOT NULL default '', - ipb_range_start tinyblob NOT NULL, - ipb_range_end tinyblob NOT NULL, - ipb_deleted bool NOT NULL default 0, - ipb_block_email bool NOT NULL default 0, - ipb_allow_usertalk bool NOT NULL default 0, - ipb_parent_block_id int default NULL -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/ipblocks_tmp ( - ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, - ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, - ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, - ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id) - SELECT - ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, - ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, - ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, - ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id - FROM /*_*/ipblocks; - -DROP TABLE /*_*/ipblocks; -ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks; -CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); -CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user); -CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); -CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); -CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry); -CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/image_tmp; -CREATE TABLE /*_*/image_tmp ( - img_name varchar(255) binary NOT NULL default '' PRIMARY KEY, - img_size int unsigned NOT NULL default 0, - img_width int NOT NULL default 0, - img_height int NOT NULL default 0, - img_metadata mediumblob NOT NULL, - img_bits int NOT NULL default 0, - img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", - img_minor_mime varbinary(100) NOT NULL default "unknown", - img_description varbinary(767) NOT NULL default '', - img_description_id bigint unsigned NOT NULL DEFAULT 0, - img_user int unsigned NOT NULL default 0, - img_user_text varchar(255) binary NOT NULL DEFAULT '', - img_actor bigint unsigned NOT NULL DEFAULT 0, - img_timestamp varbinary(14) NOT NULL default '', - img_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/image_tmp ( - img_name, img_size, img_width, img_height, img_metadata, img_bits, - img_media_type, img_major_mime, img_minor_mime, img_description, - img_description_id, img_user, img_user_text, img_timestamp, img_sha1) - SELECT - img_name, img_size, img_width, img_height, img_metadata, img_bits, - img_media_type, img_major_mime, img_minor_mime, img_description, - img_description_id, img_user, img_user_text, img_timestamp, img_sha1 - FROM /*_*/image; - -DROP TABLE /*_*/image; -ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image; -CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); -CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); -CREATE INDEX /*i*/img_actor_timestamp ON /*_*/image (img_actor,img_timestamp); -CREATE INDEX /*i*/img_size ON /*_*/image (img_size); -CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); -CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10)); -CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/oldimage_tmp; -CREATE TABLE /*_*/oldimage_tmp ( - oi_name varchar(255) binary NOT NULL default '', - oi_archive_name varchar(255) binary NOT NULL default '', - oi_size int unsigned NOT NULL default 0, - oi_width int NOT NULL default 0, - oi_height int NOT NULL default 0, - oi_bits int NOT NULL default 0, - oi_description varbinary(767) NOT NULL default '', - oi_description_id bigint unsigned NOT NULL DEFAULT 0, - oi_user int unsigned NOT NULL default 0, - oi_user_text varchar(255) binary NOT NULL DEFAULT '', - oi_actor bigint unsigned NOT NULL DEFAULT 0, - oi_timestamp binary(14) NOT NULL default '', - oi_metadata mediumblob NOT NULL, - oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", - oi_minor_mime varbinary(100) NOT NULL default "unknown", - oi_deleted tinyint unsigned NOT NULL default 0, - oi_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/oldimage_tmp ( - oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, - oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, - oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1) - SELECT - oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, - oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, - oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1 - FROM /*_*/oldimage; - -DROP TABLE /*_*/oldimage; -ALTER TABLE /*_*/oldimage_tmp RENAME TO /*_*/oldimage; -CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); -CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); -CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); -CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10)); -CREATE INDEX /*i*/oi_actor_timestamp ON /*_*/oldimage (oi_actor,oi_timestamp); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/filearchive_tmp; -CREATE TABLE /*_*/filearchive_tmp ( - fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, - fa_name varchar(255) binary NOT NULL default '', - fa_archive_name varchar(255) binary default '', - fa_storage_group varbinary(16), - fa_storage_key varbinary(64) default '', - fa_deleted_user int, - fa_deleted_timestamp binary(14) default '', - fa_deleted_reason varbinary(767) default '', - fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0, - fa_size int unsigned default 0, - fa_width int default 0, - fa_height int default 0, - fa_metadata mediumblob, - fa_bits int default 0, - fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown", - fa_minor_mime varbinary(100) default "unknown", - fa_description varbinary(767) default '', - fa_description_id bigint unsigned NOT NULL DEFAULT 0, - fa_user int unsigned default 0, - fa_user_text varchar(255) binary DEFAULT '', - fa_actor bigint unsigned NOT NULL DEFAULT 0, - fa_timestamp binary(14) default '', - fa_deleted tinyint unsigned NOT NULL default 0, - fa_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/filearchive_tmp ( - fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, - fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, - fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, - fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, - fa_deleted, fa_sha1) - SELECT - fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, - fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, - fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, - fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, - fa_deleted, fa_sha1 - FROM /*_*/filearchive; - -DROP TABLE /*_*/filearchive; -ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive; -CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); -CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); -CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); -CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); -CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10)); -CREATE INDEX /*i*/fa_actor_timestamp ON /*_*/filearchive (fa_actor,fa_timestamp); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/logging_tmp; -CREATE TABLE /*_*/logging_tmp ( - log_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, - log_type varbinary(32) NOT NULL default '', - log_action varbinary(32) NOT NULL default '', - log_timestamp binary(14) NOT NULL default '19700101000000', - log_user int unsigned NOT NULL default 0, - log_user_text varchar(255) binary NOT NULL default '', - log_actor bigint unsigned NOT NULL DEFAULT 0, - log_namespace int NOT NULL default 0, - log_title varchar(255) binary NOT NULL default '', - log_page int unsigned NULL, - log_comment varbinary(767) NOT NULL default '', - log_comment_id bigint unsigned NOT NULL DEFAULT 0, - log_params blob NOT NULL, - log_deleted tinyint unsigned NOT NULL default 0 -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/logging_tmp ( - log_id, log_type, log_action, log_timestamp, log_user, log_user_text, - log_namespace, log_title, log_page, log_comment, log_comment_id, - log_params, log_deleted) - SELECT - log_id, log_type, log_action, log_timestamp, log_user, log_user_text, - log_namespace, log_title, log_page, log_comment, log_comment_id, - log_params, log_deleted - FROM /*_*/logging; - -DROP TABLE /*_*/logging; -ALTER TABLE /*_*/logging_tmp RENAME TO /*_*/logging; -CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp); -CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp); -CREATE INDEX /*i*/actor_time ON /*_*/logging (log_actor, log_timestamp); -CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); -CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp); -CREATE INDEX /*i*/log_user_type_time ON /*_*/logging (log_user, log_type, log_timestamp); -CREATE INDEX /*i*/log_actor_type_time ON /*_*/logging (log_actor, log_type, log_timestamp); -CREATE INDEX /*i*/log_page_id_time ON /*_*/logging (log_page,log_timestamp); -CREATE INDEX /*i*/type_action ON /*_*/logging (log_type, log_action, log_timestamp); -CREATE INDEX /*i*/log_user_text_type_time ON /*_*/logging (log_user_text, log_type, log_timestamp); -CREATE INDEX /*i*/log_user_text_time ON /*_*/logging (log_user_text, log_timestamp); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/recentchanges_tmp; -CREATE TABLE /*_*/recentchanges_tmp ( - rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, - rc_timestamp varbinary(14) NOT NULL default '', - rc_user int unsigned NOT NULL default 0, - rc_user_text varchar(255) binary NOT NULL DEFAULT '', - rc_actor bigint unsigned NOT NULL DEFAULT 0, - rc_namespace int NOT NULL default 0, - rc_title varchar(255) binary NOT NULL default '', - rc_comment varbinary(767) NOT NULL default '', - rc_comment_id bigint unsigned NOT NULL DEFAULT 0, - rc_minor tinyint unsigned NOT NULL default 0, - rc_bot tinyint unsigned NOT NULL default 0, - rc_new tinyint unsigned NOT NULL default 0, - rc_cur_id int unsigned NOT NULL default 0, - rc_this_oldid int unsigned NOT NULL default 0, - rc_last_oldid int unsigned NOT NULL default 0, - rc_type tinyint unsigned NOT NULL default 0, - rc_source varchar(16) binary not null default '', - rc_patrolled tinyint unsigned NOT NULL default 0, - rc_ip varbinary(40) NOT NULL default '', - rc_old_len int, - rc_new_len int, - rc_deleted tinyint unsigned NOT NULL default 0, - rc_logid int unsigned NOT NULL default 0, - rc_log_type varbinary(255) NULL default NULL, - rc_log_action varbinary(255) NULL default NULL, - rc_params blob NULL -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/recentchanges_tmp ( - rc_id, rc_timestamp, rc_user, rc_user_text, rc_namespace, rc_title, - rc_comment, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id, - rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, - rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, - rc_params) - SELECT - rc_id, rc_timestamp, rc_user, rc_user_text, rc_namespace, rc_title, - rc_comment, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id, - rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, - rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, - rc_params - FROM /*_*/recentchanges; - -DROP TABLE /*_*/recentchanges; -ALTER TABLE /*_*/recentchanges_tmp RENAME TO /*_*/recentchanges; -CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp); -CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); -CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id); -CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); -CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip); -CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); -CREATE INDEX /*i*/rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor); -CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); -CREATE INDEX /*i*/rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp); -CREATE INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp); - -COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-add-3d.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-add-3d.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-add-3d.sql 2019-06-05 20:14:32.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-add-3d.sql 2019-11-04 18:09:16.000000000 +0000 @@ -1,249 +1,255 @@ --- image - -CREATE TABLE /*_*/image_tmp ( - -- Filename. - -- This is also the title of the associated description page, - -- which will be in namespace 6 (NS_FILE). - img_name varchar(255) binary NOT NULL default '' PRIMARY KEY, - - -- File size in bytes. - img_size int unsigned NOT NULL default 0, - - -- For images, size in pixels. - img_width int NOT NULL default 0, - img_height int NOT NULL default 0, - - -- Extracted Exif metadata stored as a serialized PHP array. - img_metadata mediumblob NOT NULL, - - -- For images, bits per pixel if known. - img_bits int NOT NULL default 0, - - -- Media type as defined by the MEDIATYPE_xxx constants - img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, - - -- major part of a MIME media type as defined by IANA - -- see https://www.iana.org/assignments/media-types/ - -- for "chemical" cf. http://dx.doi.org/10.1021/ci9803233 by the ACS - img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", - - -- minor part of a MIME media type as defined by IANA - -- the minor parts are not required to adher to any standard - -- but should be consistent throughout the database - -- see https://www.iana.org/assignments/media-types/ - img_minor_mime varbinary(100) NOT NULL default "unknown", - - -- Description field as entered by the uploader. - -- This is displayed in image upload history and logs. - img_description varbinary(767) NOT NULL, - - -- user_id and user_name of uploader. - img_user int unsigned NOT NULL default 0, - img_user_text varchar(255) binary NOT NULL, - - -- Time of the upload. - img_timestamp varbinary(14) NOT NULL default '', - - -- SHA-1 content hash in base-36 - img_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT INTO /*_*/image_tmp - SELECT img_name, img_size, img_width, img_height, img_metadata, img_bits, - img_media_type, img_major_mime, img_minor_mime, img_description, - img_user, img_user_text, img_timestamp, img_sha1 - FROM /*_*/image; - -DROP TABLE /*_*/image; - -ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image; - --- Used by Special:Newimages and ApiQueryAllImages -CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); -CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); --- Used by Special:ListFiles for sort-by-size -CREATE INDEX /*i*/img_size ON /*_*/image (img_size); --- Used by Special:Newimages and Special:ListFiles -CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); --- Used in API and duplicate search -CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10)); --- Used to get media of one type -CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime); - --- oldimage - -CREATE TABLE /*_*/oldimage_tmp ( - -- Base filename: key to image.img_name - oi_name varchar(255) binary NOT NULL default '', - - -- Filename of the archived file. - -- This is generally a timestamp and '!' prepended to the base name. - oi_archive_name varchar(255) binary NOT NULL default '', - - -- Other fields as in image... - oi_size int unsigned NOT NULL default 0, - oi_width int NOT NULL default 0, - oi_height int NOT NULL default 0, - oi_bits int NOT NULL default 0, - oi_description varbinary(767) NOT NULL, - oi_user int unsigned NOT NULL default 0, - oi_user_text varchar(255) binary NOT NULL, - oi_timestamp binary(14) NOT NULL default '', - - oi_metadata mediumblob NOT NULL, - oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, - oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", - oi_minor_mime varbinary(100) NOT NULL default "unknown", - oi_deleted tinyint unsigned NOT NULL default 0, - oi_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT INTO /*_*/oldimage_tmp - SELECT oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, - oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, - oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1 - FROM /*_*/oldimage; - -DROP TABLE /*_*/oldimage; - -ALTER TABLE oldimage_tmp RENAME TO /*_*/oldimage; - -CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); -CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); --- oi_archive_name truncated to 14 to avoid key length overflow -CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); -CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10)); - --- filearchive - -CREATE TABLE /*_*/filearchive_tmp ( - -- Unique row id - fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, - - -- Original base filename; key to image.img_name, page.page_title, etc - fa_name varchar(255) binary NOT NULL default '', - - -- Filename of archived file, if an old revision - fa_archive_name varchar(255) binary default '', - - -- Which storage bin (directory tree or object store) the file data - -- is stored in. Should be 'deleted' for files that have been deleted; - -- any other bin is not yet in use. - fa_storage_group varbinary(16), - - -- SHA-1 of the file contents plus extension, used as a key for storage. - -- eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg - -- - -- If NULL, the file was missing at deletion time or has been purged - -- from the archival storage. - fa_storage_key varbinary(64) default '', - - -- Deletion information, if this file is deleted. - fa_deleted_user int, - fa_deleted_timestamp binary(14) default '', - fa_deleted_reason varbinary(767) default '', - - -- Duped fields from image - fa_size int unsigned default 0, - fa_width int default 0, - fa_height int default 0, - fa_metadata mediumblob, - fa_bits int default 0, - fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, - fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown", - fa_minor_mime varbinary(100) default "unknown", - fa_description varbinary(767), - fa_user int unsigned default 0, - fa_user_text varchar(255) binary, - fa_timestamp binary(14) default '', - - -- Visibility of deleted revisions, bitfield - fa_deleted tinyint unsigned NOT NULL default 0, - - -- sha1 hash of file content - fa_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT INTO /*_*/filearchive_tmp - SELECT fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp, - fa_deleted_reason, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, - fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, fa_deleted, fa_sha1 - FROM /*_*/filearchive; - -DROP TABLE /*_*/filearchive; - -ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive; - --- pick out by image name -CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); --- pick out dupe files -CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); --- sort by deletion time -CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); --- sort by uploader -CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); --- find file by sha1, 10 bytes will be enough for hashes to be indexed -CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10)); - --- uploadstash - -CREATE TABLE /*_*/uploadstash_tmp ( - us_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, - - -- the user who uploaded the file. - us_user int unsigned NOT NULL, - - -- file key. this is how applications actually search for the file. - -- this might go away, or become the primary key. - us_key varchar(255) NOT NULL, - - -- the original path - us_orig_path varchar(255) NOT NULL, - - -- the temporary path at which the file is actually stored - us_path varchar(255) NOT NULL, - - -- which type of upload the file came from (sometimes) - us_source_type varchar(50), - - -- the date/time on which the file was added - us_timestamp varbinary(14) NOT NULL, - - us_status varchar(50) NOT NULL, - - -- chunk counter starts at 0, current offset is stored in us_size - us_chunk_inx int unsigned NULL, - - -- Serialized file properties from FSFile::getProps() - us_props blob, - - -- file size in bytes - us_size int unsigned NOT NULL, - -- this hash comes from FSFile::getSha1Base36(), and is 31 characters - us_sha1 varchar(31) NOT NULL, - us_mime varchar(255), - -- Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table - us_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, - -- image-specific properties - us_image_width int unsigned, - us_image_height int unsigned, - us_image_bits smallint unsigned - -) /*$wgDBTableOptions*/; - -INSERT INTO /*_*/uploadstash_tmp - SELECT us_id, us_user, us_key, us_orig_path, us_path, us_source_type, - us_timestamp, us_status, us_chunk_inx, us_props, us_size, us_sha1, us_mime, - us_media_type, us_image_width, us_image_height, us_image_bits - FROM /*_*/uploadstash; - -DROP TABLE uploadstash; - -ALTER TABLE /*_*/uploadstash_tmp RENAME TO /*_*/uploadstash; - --- sometimes there's a delete for all of a user's stuff. -CREATE INDEX /*i*/us_user ON /*_*/uploadstash (us_user); --- pick out files by key, enforce key uniqueness -CREATE UNIQUE INDEX /*i*/us_key ON /*_*/uploadstash (us_key); --- the abandoned upload cleanup script needs this -CREATE INDEX /*i*/us_timestamp ON /*_*/uploadstash (us_timestamp); +-- In theory all the stuff below would be needed to change the ENUM. But in +-- practice sqlite3 ignores the list of values and stores an "ENUM" as TEXT, +-- making this a no-op. So for efficiency and to avoid screwing up tables that +-- are otherwise correct from tables.sql let's just skip it. +-- (see code review on I7bf4ad01 and I335cb8d for details). + +---- image +-- +--CREATE TABLE /*_*/image_tmp ( +-- -- Filename. +-- -- This is also the title of the associated description page, +-- -- which will be in namespace 6 (NS_FILE). +-- img_name varchar(255) binary NOT NULL default '' PRIMARY KEY, +-- +-- -- File size in bytes. +-- img_size int unsigned NOT NULL default 0, +-- +-- -- For images, size in pixels. +-- img_width int NOT NULL default 0, +-- img_height int NOT NULL default 0, +-- +-- -- Extracted Exif metadata stored as a serialized PHP array. +-- img_metadata mediumblob NOT NULL, +-- +-- -- For images, bits per pixel if known. +-- img_bits int NOT NULL default 0, +-- +-- -- Media type as defined by the MEDIATYPE_xxx constants +-- img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, +-- +-- -- major part of a MIME media type as defined by IANA +-- -- see https://www.iana.org/assignments/media-types/ +-- -- for "chemical" cf. http://dx.doi.org/10.1021/ci9803233 by the ACS +-- img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", +-- +-- -- minor part of a MIME media type as defined by IANA +-- -- the minor parts are not required to adher to any standard +-- -- but should be consistent throughout the database +-- -- see https://www.iana.org/assignments/media-types/ +-- img_minor_mime varbinary(100) NOT NULL default "unknown", +-- +-- -- Description field as entered by the uploader. +-- -- This is displayed in image upload history and logs. +-- img_description varbinary(767) NOT NULL, +-- +-- -- user_id and user_name of uploader. +-- img_user int unsigned NOT NULL default 0, +-- img_user_text varchar(255) binary NOT NULL, +-- +-- -- Time of the upload. +-- img_timestamp varbinary(14) NOT NULL default '', +-- +-- -- SHA-1 content hash in base-36 +-- img_sha1 varbinary(32) NOT NULL default '' +--) /*$wgDBTableOptions*/; +-- +--INSERT INTO /*_*/image_tmp +-- SELECT img_name, img_size, img_width, img_height, img_metadata, img_bits, +-- img_media_type, img_major_mime, img_minor_mime, img_description, +-- img_user, img_user_text, img_timestamp, img_sha1 +-- FROM /*_*/image; +-- +--DROP TABLE /*_*/image; +-- +--ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image; +-- +---- Used by Special:Newimages and ApiQueryAllImages +--CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); +--CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); +---- Used by Special:ListFiles for sort-by-size +--CREATE INDEX /*i*/img_size ON /*_*/image (img_size); +---- Used by Special:Newimages and Special:ListFiles +--CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); +---- Used in API and duplicate search +--CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10)); +---- Used to get media of one type +--CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime); +-- +---- oldimage +-- +--CREATE TABLE /*_*/oldimage_tmp ( +-- -- Base filename: key to image.img_name +-- oi_name varchar(255) binary NOT NULL default '', +-- +-- -- Filename of the archived file. +-- -- This is generally a timestamp and '!' prepended to the base name. +-- oi_archive_name varchar(255) binary NOT NULL default '', +-- +-- -- Other fields as in image... +-- oi_size int unsigned NOT NULL default 0, +-- oi_width int NOT NULL default 0, +-- oi_height int NOT NULL default 0, +-- oi_bits int NOT NULL default 0, +-- oi_description varbinary(767) NOT NULL, +-- oi_user int unsigned NOT NULL default 0, +-- oi_user_text varchar(255) binary NOT NULL, +-- oi_timestamp binary(14) NOT NULL default '', +-- +-- oi_metadata mediumblob NOT NULL, +-- oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, +-- oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", +-- oi_minor_mime varbinary(100) NOT NULL default "unknown", +-- oi_deleted tinyint unsigned NOT NULL default 0, +-- oi_sha1 varbinary(32) NOT NULL default '' +--) /*$wgDBTableOptions*/; +-- +--INSERT INTO /*_*/oldimage_tmp +-- SELECT oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, +-- oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, +-- oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1 +-- FROM /*_*/oldimage; +-- +--DROP TABLE /*_*/oldimage; +-- +--ALTER TABLE oldimage_tmp RENAME TO /*_*/oldimage; +-- +--CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); +--CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); +---- oi_archive_name truncated to 14 to avoid key length overflow +--CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); +--CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10)); +-- +---- filearchive +-- +--CREATE TABLE /*_*/filearchive_tmp ( +-- -- Unique row id +-- fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +-- +-- -- Original base filename; key to image.img_name, page.page_title, etc +-- fa_name varchar(255) binary NOT NULL default '', +-- +-- -- Filename of archived file, if an old revision +-- fa_archive_name varchar(255) binary default '', +-- +-- -- Which storage bin (directory tree or object store) the file data +-- -- is stored in. Should be 'deleted' for files that have been deleted; +-- -- any other bin is not yet in use. +-- fa_storage_group varbinary(16), +-- +-- -- SHA-1 of the file contents plus extension, used as a key for storage. +-- -- eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg +-- -- +-- -- If NULL, the file was missing at deletion time or has been purged +-- -- from the archival storage. +-- fa_storage_key varbinary(64) default '', +-- +-- -- Deletion information, if this file is deleted. +-- fa_deleted_user int, +-- fa_deleted_timestamp binary(14) default '', +-- fa_deleted_reason varbinary(767) default '', +-- +-- -- Duped fields from image +-- fa_size int unsigned default 0, +-- fa_width int default 0, +-- fa_height int default 0, +-- fa_metadata mediumblob, +-- fa_bits int default 0, +-- fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, +-- fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown", +-- fa_minor_mime varbinary(100) default "unknown", +-- fa_description varbinary(767), +-- fa_user int unsigned default 0, +-- fa_user_text varchar(255) binary, +-- fa_timestamp binary(14) default '', +-- +-- -- Visibility of deleted revisions, bitfield +-- fa_deleted tinyint unsigned NOT NULL default 0, +-- +-- -- sha1 hash of file content +-- fa_sha1 varbinary(32) NOT NULL default '' +--) /*$wgDBTableOptions*/; +-- +--INSERT INTO /*_*/filearchive_tmp +-- SELECT fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp, +-- fa_deleted_reason, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, +-- fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, fa_deleted, fa_sha1 +-- FROM /*_*/filearchive; +-- +--DROP TABLE /*_*/filearchive; +-- +--ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive; +-- +---- pick out by image name +--CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); +---- pick out dupe files +--CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); +---- sort by deletion time +--CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); +---- sort by uploader +--CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); +---- find file by sha1, 10 bytes will be enough for hashes to be indexed +--CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10)); +-- +---- uploadstash +-- +--CREATE TABLE /*_*/uploadstash_tmp ( +-- us_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, +-- +-- -- the user who uploaded the file. +-- us_user int unsigned NOT NULL, +-- +-- -- file key. this is how applications actually search for the file. +-- -- this might go away, or become the primary key. +-- us_key varchar(255) NOT NULL, +-- +-- -- the original path +-- us_orig_path varchar(255) NOT NULL, +-- +-- -- the temporary path at which the file is actually stored +-- us_path varchar(255) NOT NULL, +-- +-- -- which type of upload the file came from (sometimes) +-- us_source_type varchar(50), +-- +-- -- the date/time on which the file was added +-- us_timestamp varbinary(14) NOT NULL, +-- +-- us_status varchar(50) NOT NULL, +-- +-- -- chunk counter starts at 0, current offset is stored in us_size +-- us_chunk_inx int unsigned NULL, +-- +-- -- Serialized file properties from FSFile::getProps() +-- us_props blob, +-- +-- -- file size in bytes +-- us_size int unsigned NOT NULL, +-- -- this hash comes from FSFile::getSha1Base36(), and is 31 characters +-- us_sha1 varchar(31) NOT NULL, +-- us_mime varchar(255), +-- -- Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table +-- us_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, +-- -- image-specific properties +-- us_image_width int unsigned, +-- us_image_height int unsigned, +-- us_image_bits smallint unsigned +-- +--) /*$wgDBTableOptions*/; +-- +--INSERT INTO /*_*/uploadstash_tmp +-- SELECT us_id, us_user, us_key, us_orig_path, us_path, us_source_type, +-- us_timestamp, us_status, us_chunk_inx, us_props, us_size, us_sha1, us_mime, +-- us_media_type, us_image_width, us_image_height, us_image_bits +-- FROM /*_*/uploadstash; +-- +--DROP TABLE uploadstash; +-- +--ALTER TABLE /*_*/uploadstash_tmp RENAME TO /*_*/uploadstash; +-- +---- sometimes there's a delete for all of a user's stuff. +--CREATE INDEX /*i*/us_user ON /*_*/uploadstash (us_user); +---- pick out files by key, enforce key uniqueness +--CREATE UNIQUE INDEX /*i*/us_key ON /*_*/uploadstash (us_key); +---- the abandoned upload cleanup script needs this +--CREATE INDEX /*i*/us_timestamp ON /*_*/uploadstash (us_timestamp); diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-archive-ar_actor.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-archive-ar_actor.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-archive-ar_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-archive-ar_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,43 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/archive_tmp; +CREATE TABLE /*_*/archive_tmp ( + ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, + ar_namespace int NOT NULL default 0, + ar_title varchar(255) binary NOT NULL default '', + ar_comment varbinary(767) NOT NULL default '', + ar_comment_id bigint unsigned NOT NULL DEFAULT 0, + ar_user int unsigned NOT NULL default 0, + ar_user_text varchar(255) binary NOT NULL DEFAULT '', + ar_actor bigint unsigned NOT NULL DEFAULT 0, + ar_timestamp binary(14) NOT NULL default '', + ar_minor_edit tinyint NOT NULL default 0, + ar_rev_id int unsigned, + ar_text_id int unsigned NOT NULL default 0, + ar_deleted tinyint unsigned NOT NULL default 0, + ar_len int unsigned, + ar_page_id int unsigned, + ar_parent_id int unsigned default NULL, + ar_sha1 varbinary(32) NOT NULL default '', + ar_content_model varbinary(32) DEFAULT NULL, + ar_content_format varbinary(64) DEFAULT NULL +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/archive_tmp ( + ar_id, ar_namespace, ar_title, ar_comment, ar_user, ar_user_text, + ar_timestamp, ar_minor_edit, ar_rev_id, ar_text_id, ar_deleted, ar_len, + ar_page_id, ar_parent_id, ar_sha1, ar_content_model, ar_content_format) + SELECT + ar_id, ar_namespace, ar_title, ar_comment, ar_user, ar_user_text, + ar_timestamp, ar_minor_edit, ar_rev_id, ar_text_id, ar_deleted, ar_len, + ar_page_id, ar_parent_id, ar_sha1, ar_content_model, ar_content_format + FROM /*_*/archive; + +DROP TABLE /*_*/archive; +ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive; +CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); +CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); +CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id); +CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-archive-ar_comment_id.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-archive-ar_comment_id.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-archive-ar_comment_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-archive-ar_comment_id.sql 2020-03-26 16:54:29.000000000 +0000 @@ -0,0 +1,46 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/archive_tmp; +CREATE TABLE /*_*/archive_tmp ( + ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, + ar_namespace int NOT NULL default 0, + ar_title varchar(255) binary NOT NULL default '', + ar_text mediumblob NOT NULL, + ar_comment varbinary(767) NOT NULL default '', + ar_comment_id bigint unsigned NOT NULL DEFAULT 0, + ar_user int unsigned NOT NULL default 0, + ar_user_text varchar(255) binary NOT NULL, + ar_timestamp binary(14) NOT NULL default '', + ar_minor_edit tinyint NOT NULL default 0, + ar_flags tinyblob NOT NULL, + ar_rev_id int unsigned, + ar_text_id int unsigned, + ar_deleted tinyint unsigned NOT NULL default 0, + ar_len int unsigned, + ar_page_id int unsigned, + ar_parent_id int unsigned default NULL, + ar_sha1 varbinary(32) NOT NULL default '', + ar_content_model varbinary(32) DEFAULT NULL, + ar_content_format varbinary(64) DEFAULT NULL +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/archive_tmp ( + ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text, + ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted, + ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model, + ar_content_format) + SELECT + ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text, + ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted, + ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model, + ar_content_format + FROM /*_*/archive; + +DROP TABLE /*_*/archive; +ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive; +CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); +CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); +CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id); + +COMMIT; + diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-comment-table.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-comment-table.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-comment-table.sql 2019-06-05 20:14:32.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-comment-table.sql 1970-01-01 00:00:00.000000000 +0000 @@ -1,332 +0,0 @@ --- --- patch-comment-table.sql --- --- T166732. Add a `comment` table and various columns (and temporary tables) to reference it. --- Sigh, sqlite, such trouble just to change the default value of a column. - -CREATE TABLE /*_*/comment ( - comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, - comment_hash INT NOT NULL, - comment_text BLOB NOT NULL, - comment_data BLOB -) /*$wgDBTableOptions*/; -CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash); - -CREATE TABLE /*_*/revision_comment_temp ( - revcomment_rev int unsigned NOT NULL, - revcomment_comment_id bigint unsigned NOT NULL, - PRIMARY KEY (revcomment_rev, revcomment_comment_id) -) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev); - -CREATE TABLE /*_*/image_comment_temp ( - imgcomment_name varchar(255) binary NOT NULL, - imgcomment_description_id bigint unsigned NOT NULL, - PRIMARY KEY (imgcomment_name, imgcomment_description_id) -) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name); - -ALTER TABLE /*_*/recentchanges - ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0; - -ALTER TABLE /*_*/logging - ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/revision_tmp; -CREATE TABLE /*_*/revision_tmp ( - rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, - rev_page int unsigned NOT NULL, - rev_text_id int unsigned NOT NULL, - rev_comment varbinary(767) NOT NULL default '', - rev_user int unsigned NOT NULL default 0, - rev_user_text varchar(255) binary NOT NULL default '', - rev_timestamp binary(14) NOT NULL default '', - rev_minor_edit tinyint unsigned NOT NULL default 0, - rev_deleted tinyint unsigned NOT NULL default 0, - rev_len int unsigned, - rev_parent_id int unsigned default NULL, - rev_sha1 varbinary(32) NOT NULL default '', - rev_content_model varbinary(32) DEFAULT NULL, - rev_content_format varbinary(64) DEFAULT NULL -) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024; - -INSERT OR IGNORE INTO /*_*/revision_tmp ( - rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text, - rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, - rev_sha1, rev_content_model, rev_content_format) - SELECT - rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text, - rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, - rev_sha1, rev_content_model, rev_content_format - FROM /*_*/revision; - -DROP TABLE /*_*/revision; -ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision; -CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id); -CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp); -CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp); -CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp); -CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp); -CREATE INDEX /*i*/page_user_timestamp ON /*_*/revision (rev_page,rev_user,rev_timestamp); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/archive_tmp; -CREATE TABLE /*_*/archive_tmp ( - ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, - ar_namespace int NOT NULL default 0, - ar_title varchar(255) binary NOT NULL default '', - ar_text mediumblob NOT NULL, - ar_comment varbinary(767) NOT NULL default '', - ar_comment_id bigint unsigned NOT NULL DEFAULT 0, - ar_user int unsigned NOT NULL default 0, - ar_user_text varchar(255) binary NOT NULL, - ar_timestamp binary(14) NOT NULL default '', - ar_minor_edit tinyint NOT NULL default 0, - ar_flags tinyblob NOT NULL, - ar_rev_id int unsigned, - ar_text_id int unsigned, - ar_deleted tinyint unsigned NOT NULL default 0, - ar_len int unsigned, - ar_page_id int unsigned, - ar_parent_id int unsigned default NULL, - ar_sha1 varbinary(32) NOT NULL default '', - ar_content_model varbinary(32) DEFAULT NULL, - ar_content_format varbinary(64) DEFAULT NULL -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/archive_tmp ( - ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text, - ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted, - ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model, - ar_content_format) - SELECT - ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text, - ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted, - ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model, - ar_content_format - FROM /*_*/archive; - -DROP TABLE /*_*/archive; -ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive; -CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); -CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); -CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS ipblocks_tmp; -CREATE TABLE /*_*/ipblocks_tmp ( - ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, - ipb_address tinyblob NOT NULL, - ipb_user int unsigned NOT NULL default 0, - ipb_by int unsigned NOT NULL default 0, - ipb_by_text varchar(255) binary NOT NULL default '', - ipb_reason varbinary(767) NOT NULL default '', - ipb_reason_id bigint unsigned NOT NULL DEFAULT 0, - ipb_timestamp binary(14) NOT NULL default '', - ipb_auto bool NOT NULL default 0, - ipb_anon_only bool NOT NULL default 0, - ipb_create_account bool NOT NULL default 1, - ipb_enable_autoblock bool NOT NULL default '1', - ipb_expiry varbinary(14) NOT NULL default '', - ipb_range_start tinyblob NOT NULL, - ipb_range_end tinyblob NOT NULL, - ipb_deleted bool NOT NULL default 0, - ipb_block_email bool NOT NULL default 0, - ipb_allow_usertalk bool NOT NULL default 0, - ipb_parent_block_id int default NULL -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/ipblocks_tmp ( - ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, - ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, - ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, - ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id) - SELECT - ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, - ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, - ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, - ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id - FROM /*_*/ipblocks; - -DROP TABLE /*_*/ipblocks; -ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks; -CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); -CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user); -CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); -CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); -CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry); -CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/image_tmp; -CREATE TABLE /*_*/image_tmp ( - img_name varchar(255) binary NOT NULL default '' PRIMARY KEY, - img_size int unsigned NOT NULL default 0, - img_width int NOT NULL default 0, - img_height int NOT NULL default 0, - img_metadata mediumblob NOT NULL, - img_bits int NOT NULL default 0, - img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", - img_minor_mime varbinary(100) NOT NULL default "unknown", - img_description varbinary(767) NOT NULL default '', - img_user int unsigned NOT NULL default 0, - img_user_text varchar(255) binary NOT NULL, - img_timestamp varbinary(14) NOT NULL default '', - img_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/image_tmp ( - img_name, img_size, img_width, img_height, img_metadata, img_bits, - img_media_type, img_major_mime, img_minor_mime, img_description, img_user, - img_user_text, img_timestamp, img_sha1) - SELECT - img_name, img_size, img_width, img_height, img_metadata, img_bits, - img_media_type, img_major_mime, img_minor_mime, img_description, img_user, - img_user_text, img_timestamp, img_sha1 - FROM /*_*/image; - -DROP TABLE /*_*/image; -ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image; -CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); -CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); -CREATE INDEX /*i*/img_size ON /*_*/image (img_size); -CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); -CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10)); -CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/oldimage_tmp; -CREATE TABLE /*_*/oldimage_tmp ( - oi_name varchar(255) binary NOT NULL default '', - oi_archive_name varchar(255) binary NOT NULL default '', - oi_size int unsigned NOT NULL default 0, - oi_width int NOT NULL default 0, - oi_height int NOT NULL default 0, - oi_bits int NOT NULL default 0, - oi_description varbinary(767) NOT NULL default '', - oi_description_id bigint unsigned NOT NULL DEFAULT 0, - oi_user int unsigned NOT NULL default 0, - oi_user_text varchar(255) binary NOT NULL, - oi_timestamp binary(14) NOT NULL default '', - oi_metadata mediumblob NOT NULL, - oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", - oi_minor_mime varbinary(100) NOT NULL default "unknown", - oi_deleted tinyint unsigned NOT NULL default 0, - oi_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/oldimage_tmp ( - oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, - oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, - oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1) - SELECT - oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, - oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, - oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1 - FROM /*_*/oldimage; - -DROP TABLE /*_*/oldimage; -ALTER TABLE /*_*/oldimage_tmp RENAME TO /*_*/oldimage; -CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); -CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); -CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); -CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10)); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/filearchive_tmp; -CREATE TABLE /*_*/filearchive_tmp ( - fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, - fa_name varchar(255) binary NOT NULL default '', - fa_archive_name varchar(255) binary default '', - fa_storage_group varbinary(16), - fa_storage_key varbinary(64) default '', - fa_deleted_user int, - fa_deleted_timestamp binary(14) default '', - fa_deleted_reason varbinary(767) default '', - fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0, - fa_size int unsigned default 0, - fa_width int default 0, - fa_height int default 0, - fa_metadata mediumblob, - fa_bits int default 0, - fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown", - fa_minor_mime varbinary(100) default "unknown", - fa_description varbinary(767) default '', - fa_description_id bigint unsigned NOT NULL DEFAULT 0, - fa_user int unsigned default 0, - fa_user_text varchar(255) binary, - fa_timestamp binary(14) default '', - fa_deleted tinyint unsigned NOT NULL default 0, - fa_sha1 varbinary(32) NOT NULL default '' -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/filearchive_tmp ( - fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, - fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, - fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, - fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, - fa_deleted, fa_sha1) - SELECT - fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, - fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, - fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, - fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, - fa_deleted, fa_sha1 - FROM /*_*/filearchive; - -DROP TABLE /*_*/filearchive; -ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive; -CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); -CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); -CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); -CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); -CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10)); - -COMMIT; - -BEGIN; - -DROP TABLE IF EXISTS /*_*/protected_titles_tmp; -CREATE TABLE /*_*/protected_titles_tmp ( - pt_namespace int NOT NULL, - pt_title varchar(255) binary NOT NULL, - pt_user int unsigned NOT NULL, - pt_reason varbinary(767) default '', - pt_reason_id bigint unsigned NOT NULL DEFAULT 0, - pt_timestamp binary(14) NOT NULL, - pt_expiry varbinary(14) NOT NULL default '', - pt_create_perm varbinary(60) NOT NULL -) /*$wgDBTableOptions*/; - -INSERT OR IGNORE INTO /*_*/protected_titles_tmp ( - pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm) - SELECT - pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm - FROM /*_*/protected_titles; - -DROP TABLE /*_*/protected_titles; -ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles; -CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title); -CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp); - -COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-filearchive-fa_actor.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-filearchive-fa_actor.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-filearchive-fa_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-filearchive-fa_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,61 @@ +-- +-- patch-filearchive-fa_actor.sql +-- +-- Split from patch-actor-table.sql to work around SQLite unconditionally running +-- patch-add-3d.sql on a fresh install, which wipes out fa_actor. + +BEGIN; + +DROP TABLE IF EXISTS /*_*/filearchive_tmp; +CREATE TABLE /*_*/filearchive_tmp ( + fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, + fa_name varchar(255) binary NOT NULL default '', + fa_archive_name varchar(255) binary default '', + fa_storage_group varbinary(16), + fa_storage_key varbinary(64) default '', + fa_deleted_user int, + fa_deleted_timestamp binary(14) default '', + fa_deleted_reason varbinary(767) default '', + fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0, + fa_size int unsigned default 0, + fa_width int default 0, + fa_height int default 0, + fa_metadata mediumblob, + fa_bits int default 0, + fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, + fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown", + fa_minor_mime varbinary(100) default "unknown", + fa_description varbinary(767) default '', + fa_description_id bigint unsigned NOT NULL DEFAULT 0, + fa_user int unsigned default 0, + fa_user_text varchar(255) binary DEFAULT '', + fa_actor bigint unsigned NOT NULL DEFAULT 0, + fa_timestamp binary(14) default '', + fa_deleted tinyint unsigned NOT NULL default 0, + fa_sha1 varbinary(32) NOT NULL default '' +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/filearchive_tmp ( + fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, + fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, + fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, + fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, + fa_deleted, fa_sha1) + SELECT + fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, + fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, + fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, + fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, + fa_deleted, fa_sha1 + FROM /*_*/filearchive; + +DROP TABLE /*_*/filearchive; +ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive; +CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); +CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); +CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); +CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); +CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10)); +CREATE INDEX /*i*/fa_actor_timestamp ON /*_*/filearchive (fa_actor,fa_timestamp); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-filearchive-fa_description_id.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-filearchive-fa_description_id.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-filearchive-fa_description_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-filearchive-fa_description_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,60 @@ +-- +-- patch-filearchive-fa_description_id.sql +-- +-- Split from patch-comment-table.sql to work around SQLite unconditionally running +-- patch-add-3d.sql on a fresh install, which wipes out fa_description_id and +-- fa_deleted_reason_id. + +BEGIN; + +DROP TABLE IF EXISTS /*_*/filearchive_tmp; +CREATE TABLE /*_*/filearchive_tmp ( + fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, + fa_name varchar(255) binary NOT NULL default '', + fa_archive_name varchar(255) binary default '', + fa_storage_group varbinary(16), + fa_storage_key varbinary(64) default '', + fa_deleted_user int, + fa_deleted_timestamp binary(14) default '', + fa_deleted_reason varbinary(767) default '', + fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0, + fa_size int unsigned default 0, + fa_width int default 0, + fa_height int default 0, + fa_metadata mediumblob, + fa_bits int default 0, + fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, + fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown", + fa_minor_mime varbinary(100) default "unknown", + fa_description varbinary(767) default '', + fa_description_id bigint unsigned NOT NULL DEFAULT 0, + fa_user int unsigned default 0, + fa_user_text varchar(255) binary, + fa_timestamp binary(14) default '', + fa_deleted tinyint unsigned NOT NULL default 0, + fa_sha1 varbinary(32) NOT NULL default '' +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/filearchive_tmp ( + fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, + fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, + fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, + fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, + fa_deleted, fa_sha1) + SELECT + fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, + fa_deleted_user, fa_deleted_timestamp, fa_deleted_reason, fa_size, + fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime, + fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, + fa_deleted, fa_sha1 + FROM /*_*/filearchive; + +DROP TABLE /*_*/filearchive; +ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive; +CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); +CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); +CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); +CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); +CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10)); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-image-img_actor.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-image-img_actor.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-image-img_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-image-img_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,43 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/image_tmp; +CREATE TABLE /*_*/image_tmp ( + img_name varchar(255) binary NOT NULL default '' PRIMARY KEY, + img_size int unsigned NOT NULL default 0, + img_width int NOT NULL default 0, + img_height int NOT NULL default 0, + img_metadata mediumblob NOT NULL, + img_bits int NOT NULL default 0, + img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, + img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", + img_minor_mime varbinary(100) NOT NULL default "unknown", + img_description varbinary(767) NOT NULL default '', + img_description_id bigint unsigned NOT NULL DEFAULT 0, + img_user int unsigned NOT NULL default 0, + img_user_text varchar(255) binary NOT NULL DEFAULT '', + img_actor bigint unsigned NOT NULL DEFAULT 0, + img_timestamp varbinary(14) NOT NULL default '', + img_sha1 varbinary(32) NOT NULL default '' +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/image_tmp ( + img_name, img_size, img_width, img_height, img_metadata, img_bits, + img_media_type, img_major_mime, img_minor_mime, img_description, + img_description_id, img_user, img_user_text, img_timestamp, img_sha1) + SELECT + img_name, img_size, img_width, img_height, img_metadata, img_bits, + img_media_type, img_major_mime, img_minor_mime, img_description, + img_description_id, img_user, img_user_text, img_timestamp, img_sha1 + FROM /*_*/image; + +DROP TABLE /*_*/image; +ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image; +CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); +CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); +CREATE INDEX /*i*/img_actor_timestamp ON /*_*/image (img_actor,img_timestamp); +CREATE INDEX /*i*/img_size ON /*_*/image (img_size); +CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); +CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10)); +CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-image-img_description-default.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-image-img_description-default.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-image-img_description-default.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-image-img_description-default.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,40 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/image_tmp; +CREATE TABLE /*_*/image_tmp ( + img_name varchar(255) binary NOT NULL default '' PRIMARY KEY, + img_size int unsigned NOT NULL default 0, + img_width int NOT NULL default 0, + img_height int NOT NULL default 0, + img_metadata mediumblob NOT NULL, + img_bits int NOT NULL default 0, + img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, + img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", + img_minor_mime varbinary(100) NOT NULL default "unknown", + img_description varbinary(767) NOT NULL default '', + img_user int unsigned NOT NULL default 0, + img_user_text varchar(255) binary NOT NULL, + img_timestamp varbinary(14) NOT NULL default '', + img_sha1 varbinary(32) NOT NULL default '' +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/image_tmp ( + img_name, img_size, img_width, img_height, img_metadata, img_bits, + img_media_type, img_major_mime, img_minor_mime, img_description, img_user, + img_user_text, img_timestamp, img_sha1) + SELECT + img_name, img_size, img_width, img_height, img_metadata, img_bits, + img_media_type, img_major_mime, img_minor_mime, img_description, img_user, + img_user_text, img_timestamp, img_sha1 + FROM /*_*/image; + +DROP TABLE /*_*/image; +ALTER TABLE /*_*/image_tmp RENAME TO /*_*/image; +CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); +CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); +CREATE INDEX /*i*/img_size ON /*_*/image (img_size); +CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); +CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10)); +CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-imagelinks-fix-pk.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-imagelinks-fix-pk.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-imagelinks-fix-pk.sql 2019-06-05 20:14:32.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-imagelinks-fix-pk.sql 2019-11-04 18:09:16.000000000 +0000 @@ -11,8 +11,8 @@ PRIMARY KEY (il_from,il_to) ) /*$wgDBTableOptions*/; -INSERT INTO /*_*/imagelinks_tmp - SELECT * FROM /*_*/imagelinks; +INSERT INTO /*_*/imagelinks_tmp (il_from, il_from_namespace, il_to) + SELECT il_from, il_from_namespace, il_to FROM /*_*/imagelinks; DROP TABLE /*_*/imagelinks; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-ipblocks-ipb_by_actor.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-ipblocks-ipb_by_actor.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-ipblocks-ipb_by_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-ipblocks-ipb_by_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,48 @@ +BEGIN; + +DROP TABLE IF EXISTS ipblocks_tmp; +CREATE TABLE /*_*/ipblocks_tmp ( + ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, + ipb_address tinyblob NOT NULL, + ipb_user int unsigned NOT NULL default 0, + ipb_by int unsigned NOT NULL default 0, + ipb_by_text varchar(255) binary NOT NULL default '', + ipb_by_actor bigint unsigned NOT NULL DEFAULT 0, + ipb_reason varbinary(767) NOT NULL default '', + ipb_reason_id bigint unsigned NOT NULL DEFAULT 0, + ipb_timestamp binary(14) NOT NULL default '', + ipb_auto bool NOT NULL default 0, + ipb_anon_only bool NOT NULL default 0, + ipb_create_account bool NOT NULL default 1, + ipb_enable_autoblock bool NOT NULL default '1', + ipb_expiry varbinary(14) NOT NULL default '', + ipb_range_start tinyblob NOT NULL, + ipb_range_end tinyblob NOT NULL, + ipb_deleted bool NOT NULL default 0, + ipb_block_email bool NOT NULL default 0, + ipb_allow_usertalk bool NOT NULL default 0, + ipb_parent_block_id int default NULL +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/ipblocks_tmp ( + ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, + ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, + ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, + ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id) + SELECT + ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, + ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, + ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, + ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id + FROM /*_*/ipblocks; + +DROP TABLE /*_*/ipblocks; +ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks; +CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); +CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user); +CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); +CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); +CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry); +CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-ipblocks-ipb_reason_id.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-ipblocks-ipb_reason_id.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-ipblocks-ipb_reason_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-ipblocks-ipb_reason_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,47 @@ +BEGIN; + +DROP TABLE IF EXISTS ipblocks_tmp; +CREATE TABLE /*_*/ipblocks_tmp ( + ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, + ipb_address tinyblob NOT NULL, + ipb_user int unsigned NOT NULL default 0, + ipb_by int unsigned NOT NULL default 0, + ipb_by_text varchar(255) binary NOT NULL default '', + ipb_reason varbinary(767) NOT NULL default '', + ipb_reason_id bigint unsigned NOT NULL DEFAULT 0, + ipb_timestamp binary(14) NOT NULL default '', + ipb_auto bool NOT NULL default 0, + ipb_anon_only bool NOT NULL default 0, + ipb_create_account bool NOT NULL default 1, + ipb_enable_autoblock bool NOT NULL default '1', + ipb_expiry varbinary(14) NOT NULL default '', + ipb_range_start tinyblob NOT NULL, + ipb_range_end tinyblob NOT NULL, + ipb_deleted bool NOT NULL default 0, + ipb_block_email bool NOT NULL default 0, + ipb_allow_usertalk bool NOT NULL default 0, + ipb_parent_block_id int default NULL +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/ipblocks_tmp ( + ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, + ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, + ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, + ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id) + SELECT + ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, + ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, + ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, + ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id + FROM /*_*/ipblocks; + +DROP TABLE /*_*/ipblocks; +ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks; +CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); +CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user); +CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); +CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); +CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry); +CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-logging-log_actor.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-logging-log_actor.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-logging-log_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-logging-log_actor.sql 2020-03-26 17:18:23.000000000 +0000 @@ -0,0 +1,45 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/logging_tmp; +CREATE TABLE /*_*/logging_tmp ( + log_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, + log_type varbinary(32) NOT NULL default '', + log_action varbinary(32) NOT NULL default '', + log_timestamp binary(14) NOT NULL default '19700101000000', + log_user int unsigned NOT NULL default 0, + log_user_text varchar(255) binary NOT NULL default '', + log_actor bigint unsigned NOT NULL DEFAULT 0, + log_namespace int NOT NULL default 0, + log_title varchar(255) binary NOT NULL default '', + log_page int unsigned NULL, + log_comment varbinary(767) NOT NULL default '', + log_comment_id bigint unsigned NOT NULL DEFAULT 0, + log_params blob NOT NULL, + log_deleted tinyint unsigned NOT NULL default 0 +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/logging_tmp ( + log_id, log_type, log_action, log_timestamp, log_user, log_user_text, + log_namespace, log_title, log_page, log_comment, log_comment_id, + log_params, log_deleted) + SELECT + log_id, log_type, log_action, log_timestamp, log_user, log_user_text, + log_namespace, log_title, log_page, log_comment, log_comment_id, + log_params, log_deleted + FROM /*_*/logging; + +DROP TABLE /*_*/logging; +ALTER TABLE /*_*/logging_tmp RENAME TO /*_*/logging; +CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp); +CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp); +CREATE INDEX /*i*/actor_time ON /*_*/logging (log_actor, log_timestamp); +CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); +CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp); +CREATE INDEX /*i*/log_user_type_time ON /*_*/logging (log_user, log_type, log_timestamp); +CREATE INDEX /*i*/log_actor_type_time ON /*_*/logging (log_actor, log_type, log_timestamp); +CREATE INDEX /*i*/log_page_id_time ON /*_*/logging (log_page,log_timestamp); +CREATE INDEX /*i*/type_action ON /*_*/logging (log_type, log_action, log_timestamp); +CREATE INDEX /*i*/log_user_text_type_time ON /*_*/logging (log_user_text, log_type, log_timestamp); +CREATE INDEX /*i*/log_user_text_time ON /*_*/logging (log_user_text, log_timestamp); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-logging-log_comment_id.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-logging-log_comment_id.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-logging-log_comment_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-logging-log_comment_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/logging + ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-oldimage-oi_actor.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-oldimage-oi_actor.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-oldimage-oi_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-oldimage-oi_actor.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,43 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/oldimage_tmp; +CREATE TABLE /*_*/oldimage_tmp ( + oi_name varchar(255) binary NOT NULL default '', + oi_archive_name varchar(255) binary NOT NULL default '', + oi_size int unsigned NOT NULL default 0, + oi_width int NOT NULL default 0, + oi_height int NOT NULL default 0, + oi_bits int NOT NULL default 0, + oi_description varbinary(767) NOT NULL default '', + oi_description_id bigint unsigned NOT NULL DEFAULT 0, + oi_user int unsigned NOT NULL default 0, + oi_user_text varchar(255) binary NOT NULL DEFAULT '', + oi_actor bigint unsigned NOT NULL DEFAULT 0, + oi_timestamp binary(14) NOT NULL default '', + oi_metadata mediumblob NOT NULL, + oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, + oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", + oi_minor_mime varbinary(100) NOT NULL default "unknown", + oi_deleted tinyint unsigned NOT NULL default 0, + oi_sha1 varbinary(32) NOT NULL default '' +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/oldimage_tmp ( + oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, + oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, + oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1) + SELECT + oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, + oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, + oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1 + FROM /*_*/oldimage; + +DROP TABLE /*_*/oldimage; +ALTER TABLE /*_*/oldimage_tmp RENAME TO /*_*/oldimage; +CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); +CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); +CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); +CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10)); +CREATE INDEX /*i*/oi_actor_timestamp ON /*_*/oldimage (oi_actor,oi_timestamp); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-oldimage-oi_description_id.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-oldimage-oi_description_id.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-oldimage-oi_description_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-oldimage-oi_description_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,41 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/oldimage_tmp; +CREATE TABLE /*_*/oldimage_tmp ( + oi_name varchar(255) binary NOT NULL default '', + oi_archive_name varchar(255) binary NOT NULL default '', + oi_size int unsigned NOT NULL default 0, + oi_width int NOT NULL default 0, + oi_height int NOT NULL default 0, + oi_bits int NOT NULL default 0, + oi_description varbinary(767) NOT NULL default '', + oi_description_id bigint unsigned NOT NULL DEFAULT 0, + oi_user int unsigned NOT NULL default 0, + oi_user_text varchar(255) binary NOT NULL, + oi_timestamp binary(14) NOT NULL default '', + oi_metadata mediumblob NOT NULL, + oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL, + oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown", + oi_minor_mime varbinary(100) NOT NULL default "unknown", + oi_deleted tinyint unsigned NOT NULL default 0, + oi_sha1 varbinary(32) NOT NULL default '' +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/oldimage_tmp ( + oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, + oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, + oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1) + SELECT + oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, + oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, + oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1 + FROM /*_*/oldimage; + +DROP TABLE /*_*/oldimage; +ALTER TABLE /*_*/oldimage_tmp RENAME TO /*_*/oldimage; +CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); +CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); +CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); +CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10)); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-pagelinks-fix-pk.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-pagelinks-fix-pk.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-pagelinks-fix-pk.sql 2019-06-05 20:14:32.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-pagelinks-fix-pk.sql 2019-11-04 18:09:16.000000000 +0000 @@ -13,8 +13,8 @@ PRIMARY KEY (pl_from,pl_namespace,pl_title) ) /*$wgDBTableOptions*/; -INSERT INTO /*_*/pagelinks_tmp - SELECT * FROM /*_*/pagelinks; +INSERT INTO /*_*/pagelinks_tmp (pl_from, pl_from_namespace, pl_namespace, pl_title) + SELECT pl_from, pl_from_namespace, pl_namespace, pl_title FROM /*_*/pagelinks; DROP TABLE /*_*/pagelinks; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-protected_titles-pt_reason_id.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-protected_titles-pt_reason_id.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-protected_titles-pt_reason_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-protected_titles-pt_reason_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,26 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/protected_titles_tmp; +CREATE TABLE /*_*/protected_titles_tmp ( + pt_namespace int NOT NULL, + pt_title varchar(255) binary NOT NULL, + pt_user int unsigned NOT NULL, + pt_reason varbinary(767) default '', + pt_reason_id bigint unsigned NOT NULL DEFAULT 0, + pt_timestamp binary(14) NOT NULL, + pt_expiry varbinary(14) NOT NULL default '', + pt_create_perm varbinary(60) NOT NULL +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/protected_titles_tmp ( + pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm) + SELECT + pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm + FROM /*_*/protected_titles; + +DROP TABLE /*_*/protected_titles; +ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles; +CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title); +CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-recentchanges-rc_actor.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-recentchanges-rc_actor.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-recentchanges-rc_actor.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-recentchanges-rc_actor.sql 2020-03-26 16:54:29.000000000 +0000 @@ -0,0 +1,61 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/recentchanges_tmp; +CREATE TABLE /*_*/recentchanges_tmp ( + rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, + rc_timestamp varbinary(14) NOT NULL default '', + rc_user int unsigned NOT NULL default 0, + rc_user_text varchar(255) binary NOT NULL DEFAULT '', + rc_actor bigint unsigned NOT NULL DEFAULT 0, + rc_namespace int NOT NULL default 0, + rc_title varchar(255) binary NOT NULL default '', + rc_comment varbinary(767) NOT NULL default '', + rc_comment_id bigint unsigned NOT NULL DEFAULT 0, + rc_minor tinyint unsigned NOT NULL default 0, + rc_bot tinyint unsigned NOT NULL default 0, + rc_new tinyint unsigned NOT NULL default 0, + rc_cur_id int unsigned NOT NULL default 0, + rc_this_oldid int unsigned NOT NULL default 0, + rc_last_oldid int unsigned NOT NULL default 0, + rc_type tinyint unsigned NOT NULL default 0, + rc_source varchar(16) binary not null default '', + rc_patrolled tinyint unsigned NOT NULL default 0, + rc_ip varbinary(40) NOT NULL default '', + rc_old_len int, + rc_new_len int, + rc_deleted tinyint unsigned NOT NULL default 0, + rc_logid int unsigned NOT NULL default 0, + rc_log_type varbinary(255) NULL default NULL, + rc_log_action varbinary(255) NULL default NULL, + rc_params blob NULL +) /*$wgDBTableOptions*/; + +INSERT OR IGNORE INTO /*_*/recentchanges_tmp ( + rc_id, rc_timestamp, rc_user, rc_user_text, rc_namespace, rc_title, + rc_comment, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id, + rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, + rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, + rc_params) + SELECT + rc_id, rc_timestamp, rc_user, rc_user_text, rc_namespace, rc_title, + rc_comment, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id, + rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, + rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, + rc_params + FROM /*_*/recentchanges; + +DROP TABLE /*_*/recentchanges; +ALTER TABLE /*_*/recentchanges_tmp RENAME TO /*_*/recentchanges; +CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp); +CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); +CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id); +CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); +CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip); +CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); +CREATE INDEX /*i*/rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor); +CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); +CREATE INDEX /*i*/rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp); +CREATE INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp); + +COMMIT; + diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-recentchanges-rc_comment_id.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-recentchanges-rc_comment_id.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-recentchanges-rc_comment_id.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-recentchanges-rc_comment_id.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/recentchanges + ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-revision-rev_comment-default.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-revision-rev_comment-default.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-revision-rev_comment-default.sql 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-revision-rev_comment-default.sql 2019-11-04 18:09:16.000000000 +0000 @@ -0,0 +1,40 @@ +BEGIN; + +DROP TABLE IF EXISTS /*_*/revision_tmp; +CREATE TABLE /*_*/revision_tmp ( + rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, + rev_page int unsigned NOT NULL, + rev_text_id int unsigned NOT NULL, + rev_comment varbinary(767) NOT NULL default '', + rev_user int unsigned NOT NULL default 0, + rev_user_text varchar(255) binary NOT NULL default '', + rev_timestamp binary(14) NOT NULL default '', + rev_minor_edit tinyint unsigned NOT NULL default 0, + rev_deleted tinyint unsigned NOT NULL default 0, + rev_len int unsigned, + rev_parent_id int unsigned default NULL, + rev_sha1 varbinary(32) NOT NULL default '', + rev_content_model varbinary(32) DEFAULT NULL, + rev_content_format varbinary(64) DEFAULT NULL +) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024; + +INSERT OR IGNORE INTO /*_*/revision_tmp ( + rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text, + rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, + rev_sha1, rev_content_model, rev_content_format) + SELECT + rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text, + rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, + rev_sha1, rev_content_model, rev_content_format + FROM /*_*/revision; + +DROP TABLE /*_*/revision; +ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision; +CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id); +CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp); +CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp); +CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp); +CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp); +CREATE INDEX /*i*/page_user_timestamp ON /*_*/revision (rev_page,rev_user,rev_timestamp); + +COMMIT; diff -Nru mediawiki-1.31.2/maintenance/sqlite/archives/patch-templatelinks-fix-pk.sql mediawiki-1.31.7/maintenance/sqlite/archives/patch-templatelinks-fix-pk.sql --- mediawiki-1.31.2/maintenance/sqlite/archives/patch-templatelinks-fix-pk.sql 2019-06-05 20:14:32.000000000 +0000 +++ mediawiki-1.31.7/maintenance/sqlite/archives/patch-templatelinks-fix-pk.sql 2019-11-04 18:09:16.000000000 +0000 @@ -13,8 +13,8 @@ PRIMARY KEY (tl_from,tl_namespace,tl_title) ) /*$wgDBTableOptions*/; -INSERT INTO /*_*/templatelinks_tmp - SELECT * FROM /*_*/templatelinks; +INSERT INTO /*_*/templatelinks_tmp (tl_from, tl_from_namespace, tl_namespace, tl_title) + SELECT tl_from, tl_from_namespace, tl_namespace, tl_title FROM /*_*/templatelinks; DROP TABLE /*_*/templatelinks; diff -Nru mediawiki-1.31.2/maintenance/view.php mediawiki-1.31.7/maintenance/view.php --- mediawiki-1.31.2/maintenance/view.php 2019-06-05 20:18:08.000000000 +0000 +++ mediawiki-1.31.7/maintenance/view.php 2020-03-26 17:18:23.000000000 +0000 @@ -39,6 +39,10 @@ $title = Title::newFromText( $this->getArg() ); if ( !$title ) { $this->fatalError( "Invalid title" ); + } elseif ( $title->isSpecialPage() ) { + $this->fatalError( "Special Pages not supported" ); + } elseif ( !$title->exists() ) { + $this->fatalError( "Page does not exist" ); } $page = WikiPage::factory( $title ); diff -Nru mediawiki-1.31.2/RELEASE-NOTES-1.31 mediawiki-1.31.7/RELEASE-NOTES-1.31 --- mediawiki-1.31.2/RELEASE-NOTES-1.31 2019-06-05 20:18:04.000000000 +0000 +++ mediawiki-1.31.7/RELEASE-NOTES-1.31 2020-03-26 17:18:20.000000000 +0000 @@ -1,3 +1,79 @@ +== MediaWiki 1.31.7 == + +This is a security and maintenance release of the MediaWiki 1.31 branch. + +=== Changes since MediaWiki 1.31.6 === +* (T193565, T234022) Re-add DB domain sanity checks to LoadBalancer. +* Use proper SemVer comparison in CheckComposerLockUpToDate. +* (T212738) Add the MW_VERSION constant, global $wgVersion is soft deprecated. +* Update comment about PHP versions supported by The PHP Group. +* (T247215) Fix output of RecountCategories::doWork(). +* Add check for page existence to view.php maintenance script. +* (T247580) Disable some broken Selenium tests. +* (T236509) SECURITY: Fix HTML escaping in UserGroupMembership::getLink(). +* (T246602) SECURITY: jquery.makeCollapsible allows applying event handler to any + CSS selector. + +== MediaWiki 1.31.6 == + +This is a security and maintenance release of the MediaWiki 1.31 branch. + +=== Changes since MediaWiki 1.31.5 === +* (T181658) Do not insert page titles into querycache.qc_value. +* (T206013) Suppress errors when reading invalid XML file properties. +* (T237931) Remove references to pg_attrdef.adsrc in Postgres code. +* Use correct value for 'sslmode' in DatabasePostgres. +* (T232866) Fix support for HTTP/2 in MultiHttpClient. +* (T227461) Stop calling deprecated Redis delete functions. +* (T239561) Mark options as requiring parameters in addSite.php. +* (T239734) Replace deprecated lSize with lLen in Redis code. +* (T192134) SECURITY: Do not allow user scripts on Special:PasswordReset. +* (T239428) ApiEditPage: Test for bad redirect targets. +* (T233342) rdbms: Log debug message traces as 'exception.trace' instead of + 'trace'. +* (T226751) media: Log and fail gracefully on invalid EXIF coordinates. +* (T212067) Work around PHP bug in parse_url. + +== MediaWiki 1.31.5 == + +This is a maintenance release of the MediaWiki 1.31 branch. + +=== Changes since MediaWiki 1.31.4 === +* Fix extra newlines in installer. +* Followup T230402, PermissionManager doesn't exist until 1.33, so fix the + backported patches to use User::isAllowed() instead. + +== MediaWiki 1.31.4 == + +This is a security and maintenance release of the MediaWiki 1.31 branch. + +=== Changes since MediaWiki 1.31.3 === +* (T207100) Updated LanguageTr for dotted and dotless I in PHP 7.3. +* The ImgAuthModifyHeaders hook was added to img_auth.php to allow modification + of headers in private wikis. +* (T230402) SECURITY: Add permission check for suppressed account to + Special:Redirect. +* Add helper for HTTPFileStreamer header syntax. +* (T118799) Fix XMP parser errors due to trailing nullchar. +* (T233119) Improve documentation for the MinimumPasswordLengthToLogin policy. +* (T202183) Give more specific error messages on Special:Redirect. +* Cache redirects from Special:Redirect. +* (T231386) dispatchUser() should use a 302 http status code. +* (T227662) Split down patch-comment-table.sql and patch-actor-table.sql into + separate files to help allieviate potential migration problems. +* Make SQLite's patch-add-3d.sql a no-op to prevent clobbering other database + updates. + +== MediaWiki 1.31.3 == + +This is a maintenance release of the MediaWiki 1.31 branch. + +=== Changes since MediaWiki 1.31.2 === +* (T225558) Update installer link to PHP intl. +* (T225496) Detect APC for MainCacheType in CLI installer. +* (T226766) Remove jetbrains/phpstorm-stubs from composer dev dependancies. +* (T202211) Fix SQLite patch-(image|page|template)links-fix-pk.sql column order. + == MediaWiki 1.31.2 == This is a security and maintenance release of the MediaWiki 1.31 branch. @@ -84,7 +160,7 @@ * FormSpecialPage::execute() will now call checkLoginSecurityLevel() if getLoginSecurityLevel() returns non-false. * (T197279) SECURITY: Fix reauth in Special:ChangeEmail. -* T208881) SECURITY: blacklist CSS var(). +* (T208881) SECURITY: blacklist CSS var(). * (T209794) SECURITY: rate-limit and prevent blocked users from changing email. * (T199540) SECURITY: API: Respect $wgBlockCIDRLimit in action=block. * (T212118) SECURITY: Fix cache mode for (un)patrolled recent changes query. diff -Nru mediawiki-1.31.2/resources/src/jquery/jquery.makeCollapsible.js mediawiki-1.31.7/resources/src/jquery/jquery.makeCollapsible.js --- mediawiki-1.31.2/resources/src/jquery/jquery.makeCollapsible.js 2019-06-05 20:18:09.000000000 +0000 +++ mediawiki-1.31.7/resources/src/jquery/jquery.makeCollapsible.js 2020-03-26 17:18:24.000000000 +0000 @@ -279,6 +279,7 @@ } else { collapsibleId = $collapsible.attr( 'id' ) || ''; if ( collapsibleId.indexOf( 'mw-customcollapsible-' ) === 0 ) { + collapsibleId = $.escapeSelector( collapsibleId ); $customTogglers = $( '.' + collapsibleId.replace( 'mw-customcollapsible', 'mw-customtoggle' ) ) .addClass( 'mw-customtoggle' ); } Binary files /tmp/tmpnqP3fw/whcsF1Q5s7/mediawiki-1.31.2/tests/phpunit/data/media/jpeg-xmp-nullchar.jpg and /tmp/tmpnqP3fw/AbWCV_sB0S/mediawiki-1.31.7/tests/phpunit/data/media/jpeg-xmp-nullchar.jpg differ diff -Nru mediawiki-1.31.2/tests/phpunit/includes/api/ApiBlockTest.php mediawiki-1.31.7/tests/phpunit/includes/api/ApiBlockTest.php --- mediawiki-1.31.2/tests/phpunit/includes/api/ApiBlockTest.php 2019-06-05 20:18:09.000000000 +0000 +++ mediawiki-1.31.7/tests/phpunit/includes/api/ApiBlockTest.php 2020-03-26 17:18:24.000000000 +0000 @@ -236,53 +236,6 @@ ); } - /** - * @expectedException ApiUsageException - * @expectedExceptionMessage Invalid value "127.0.0.1/64" for user parameter "user". - */ - public function testBlockWithLargeRange() { - $tokens = $this->getTokens(); - - $this->doApiRequest( - [ - 'action' => 'block', - 'user' => '127.0.0.1/64', - 'reason' => 'Some reason', - 'token' => $tokens['blocktoken'], - ], - null, - false, - self::$users['sysop']->getUser() - ); - } - - /** - * @expectedException ApiUsageException - * @expectedExceptionMessage Too many values supplied for parameter "pagerestrictions". The - * limit is 10. - */ - public function testBlockingToManyPageRestrictions() { - $this->setMwGlobals( [ - 'wgEnablePartialBlocks' => true, - ] ); - - $tokens = $this->getTokens(); - - $this->doApiRequest( - [ - 'action' => 'block', - 'user' => $this->mUser->getName(), - 'reason' => 'Some reason', - 'partial' => true, - 'pagerestrictions' => 'One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|Eleven', - 'token' => $tokens['blocktoken'], - ], - null, - false, - self::$users['sysop']->getUser() - ); - } - public function testRangeBlock() { $this->mUser = User::newFromName( '128.0.0.0/16', false ); $this->doBlock(); diff -Nru mediawiki-1.31.2/tests/phpunit/includes/filebackend/HTTPFileStreamerTest.php mediawiki-1.31.7/tests/phpunit/includes/filebackend/HTTPFileStreamerTest.php --- mediawiki-1.31.2/tests/phpunit/includes/filebackend/HTTPFileStreamerTest.php 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/tests/phpunit/includes/filebackend/HTTPFileStreamerTest.php 2019-11-04 18:09:17.000000000 +0000 @@ -0,0 +1,36 @@ +assertSame( $expectedRaw, $actualRaw ); + $this->assertSame( $expectedOpt, $actualOpt ); + } + + public function providePreprocessHeaders() { + return [ + [ + [ 'Vary' => 'cookie', 'Cache-Control' => 'private' ], + [ 'Vary: cookie', 'Cache-Control: private' ], + [], + ], + [ + [ + 'Range' => 'bytes=(123-456)', + 'Content-Type' => 'video/mp4', + 'If-Modified-Since' => 'Wed, 21 Oct 2015 07:28:00 GMT', + ], + [ 'Content-Type: video/mp4' ], + [ 'range' => 'bytes=(123-456)', 'if-modified-since' => 'Wed, 21 Oct 2015 07:28:00 GMT' ], + ], + ]; + } + +} diff -Nru mediawiki-1.31.2/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php mediawiki-1.31.7/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php --- mediawiki-1.31.2/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php 2018-12-12 23:21:38.000000000 +0000 +++ mediawiki-1.31.7/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php 2020-03-26 16:54:29.000000000 +0000 @@ -152,6 +152,46 @@ 'invalid://test/', false ], + // T212067 + [ + '//evil.com?example.org/foo/bar', + [ + 'scheme' => '', + 'delimiter' => '//', + 'host' => 'evil.com', + 'query' => 'example.org/foo/bar', + ] + ], + [ + '//evil.com?example.org/foo/bar?baz#quux', + [ + 'scheme' => '', + 'delimiter' => '//', + 'host' => 'evil.com', + 'query' => 'example.org/foo/bar?baz', + 'fragment' => 'quux', + ] + ], + [ + '//evil.com?example.org?baz#quux', + [ + 'scheme' => '', + 'delimiter' => '//', + 'host' => 'evil.com', + 'query' => 'example.org?baz', + 'fragment' => 'quux', + ] + ], + [ + '//evil.com?example.org#quux', + [ + 'scheme' => '', + 'delimiter' => '//', + 'host' => 'evil.com', + 'query' => 'example.org', + 'fragment' => 'quux', + ] + ], ]; } } diff -Nru mediawiki-1.31.2/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php mediawiki-1.31.7/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php --- mediawiki-1.31.2/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php 2019-06-05 20:18:09.000000000 +0000 +++ mediawiki-1.31.7/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php 2020-03-26 17:18:24.000000000 +0000 @@ -130,4 +130,87 @@ $this->assertSame( null, $domain->getSchema() ); $this->assertSame( '', $domain->getTablePrefix() ); } + + public static function provideIsCompatible() { + return [ + 'Basic' => + [ 'foo', 'foo', null, '', true ], + 'db+prefix' => + [ 'foo-bar', 'foo', null, 'bar', true ], + 'db+schema+prefix' => + [ 'foo-bar-baz', 'foo', 'bar', 'baz', true ], + 'db+dontcare_schema+prefix' => + [ 'foo-bar-baz', 'foo', null, 'baz', false ], + '?h -> -' => + [ 'foo?hbar-baz-baa', 'foo-bar', 'baz', 'baa', true ], + '?? -> ?' => + [ 'foo??bar-baz-baa', 'foo?bar', 'baz', 'baa', true ], + 'Nothing' => + [ '', null, null, '', true ], + 'dontcaredb+dontcaredbschema+prefix' => + [ 'mywiki-mediawiki-prefix', null, null, 'prefix', false ], + 'dontcaredb+schema+prefix' => + [ 'mywiki-schema-prefix', null, 'schema', 'prefix', false ], + 'db+dontcareschema+prefix' => + [ 'mywiki-schema-prefix', 'mywiki', null, 'prefix', false ], + 'postgres-db-jobqueue' => + [ 'postgres-mediawiki-', 'postgres', null, '', false ] + ]; + } + + /** + * @dataProvider provideIsCompatible + * @covers Wikimedia\Rdbms\DatabaseDomain::isCompatible + */ + public function testIsCompatible( $id, $db, $schema, $prefix, $transitive ) { + $compareIdObj = DatabaseDomain::newFromId( $id ); + $this->assertInstanceOf( DatabaseDomain::class, $compareIdObj ); + + $fromId = new DatabaseDomain( $db, $schema, $prefix ); + + $this->assertTrue( $fromId->isCompatible( $id ), 'constructed equals string' ); + $this->assertTrue( $fromId->isCompatible( $compareIdObj ), 'fromId equals string' ); + + $this->assertEquals( $transitive, $compareIdObj->isCompatible( $fromId ), + 'test transitivity of nulls components' ); + } + + public static function provideIsCompatible2() { + return [ + 'db+schema+prefix' => + [ 'mywiki-schema-prefix', 'thatwiki', 'schema', 'prefix' ], + 'dontcaredb+dontcaredbschema+prefix' => + [ 'thatwiki-mediawiki-otherprefix', null, null, 'prefix' ], + 'dontcaredb+schema+prefix' => + [ 'mywiki-otherschema-prefix', null, 'schema', 'prefix' ], + 'db+dontcareschema+prefix' => + [ 'notmywiki-schema-prefix', 'mywiki', null, 'prefix' ], + ]; + } + + /** + * @dataProvider provideIsCompatible2 + * @covers Wikimedia\Rdbms\DatabaseDomain::isCompatible + */ + public function testIsCompatible2( $id, $db, $schema, $prefix ) { + $compareIdObj = DatabaseDomain::newFromId( $id ); + $this->assertInstanceOf( DatabaseDomain::class, $compareIdObj ); + + $fromId = new DatabaseDomain( $db, $schema, $prefix ); + + $this->assertFalse( $fromId->isCompatible( $id ), 'constructed equals string' ); + $this->assertFalse( $fromId->isCompatible( $compareIdObj ), 'fromId equals string' ); + } + + /** + * @covers Wikimedia\Rdbms\DatabaseDomain::isUnspecified + */ + public function testIsUnspecified() { + $domain = new DatabaseDomain( null, null, '' ); + $this->assertTrue( $domain->isUnspecified() ); + $domain = new DatabaseDomain( 'mywiki', null, '' ); + $this->assertFalse( $domain->isUnspecified() ); + $domain = new DatabaseDomain( 'mywiki', null, '' ); + $this->assertFalse( $domain->isUnspecified() ); + } } diff -Nru mediawiki-1.31.2/tests/phpunit/includes/media/JpegMetadataExtractorTest.php mediawiki-1.31.7/tests/phpunit/includes/media/JpegMetadataExtractorTest.php --- mediawiki-1.31.2/tests/phpunit/includes/media/JpegMetadataExtractorTest.php 2019-06-05 20:18:09.000000000 +0000 +++ mediawiki-1.31.7/tests/phpunit/includes/media/JpegMetadataExtractorTest.php 2020-03-26 17:15:37.000000000 +0000 @@ -1,7 +1,7 @@ assertEquals( $expected, bin2hex( $res['PSIR'][0] ) ); } + public function testXMPExtractionNullChar() { + $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-nullchar.jpg' ); + $expected = file_get_contents( $this->filePath . 'jpeg-xmp-psir.xmp' ); + $this->assertEquals( $expected, $res['XMP'] ); + } + public function testXMPExtractionAltAppId() { $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-alt.jpg' ); $expected = file_get_contents( $this->filePath . 'jpeg-xmp-psir.xmp' ); diff -Nru mediawiki-1.31.2/tests/phpunit/includes/MediaWikiVersionFetcherTest.php mediawiki-1.31.7/tests/phpunit/includes/MediaWikiVersionFetcherTest.php --- mediawiki-1.31.2/tests/phpunit/includes/MediaWikiVersionFetcherTest.php 2019-06-05 20:18:09.000000000 +0000 +++ mediawiki-1.31.7/tests/phpunit/includes/MediaWikiVersionFetcherTest.php 2020-03-26 17:18:24.000000000 +0000 @@ -16,7 +16,7 @@ public function testReturnsResult() { $versionFetcher = new MediaWikiVersionFetcher(); - $this->assertInternalType( 'string', $versionFetcher->fetchVersion() ); + $this->assertSame( MW_VERSION, $versionFetcher->fetchVersion() ); } } diff -Nru mediawiki-1.31.2/tests/phpunit/includes/specials/SpecialRedirectTest.php mediawiki-1.31.7/tests/phpunit/includes/specials/SpecialRedirectTest.php --- mediawiki-1.31.2/tests/phpunit/includes/specials/SpecialRedirectTest.php 1970-01-01 00:00:00.000000000 +0000 +++ mediawiki-1.31.7/tests/phpunit/includes/specials/SpecialRedirectTest.php 2019-11-04 18:09:17.000000000 +0000 @@ -0,0 +1,70 @@ +addToDatabase(); + $value = $user->getId(); + } + + $page->setParameter( $type . '/' . $value ); + + $status = $page->$method(); + $this->assertSame( + $status->isGood(), $expectedStatus === 'good', + $method . ' does not return expected status "' . $expectedStatus . '"' + ); + } + + public static function provideDispatch() { + foreach ( [ + [ 'nonumeric', 'fatal' ], + [ '3', 'fatal' ], + [ self::CREATE_USER, 'good' ], + ] as $dispatchUser ) { + yield [ 'dispatchUser', 'user', $dispatchUser[0], $dispatchUser[1] ]; + } + foreach ( [ + [ 'bad [ 'namespace' => 'page_namespace', 'title' => 'page_title', - 'value' => 'page_title', ], 'conds' => [ 0 => 'cl_from IS NULL', diff -Nru mediawiki-1.31.2/tests/selenium/specs/page.js mediawiki-1.31.7/tests/selenium/specs/page.js --- mediawiki-1.31.2/tests/selenium/specs/page.js 2019-06-05 20:18:09.000000000 +0000 +++ mediawiki-1.31.7/tests/selenium/specs/page.js 2020-03-26 17:18:24.000000000 +0000 @@ -27,7 +27,8 @@ name = getTestString(); } ); - it( 'should be creatable', function () { + // Disable due to broken/flakiness (T247580) + it.skip( 'should be creatable', function () { // create EditPage.edit( name, content ); @@ -38,7 +39,8 @@ } ); - it( 'should be re-creatable', function () { + // Disable due to broken/flakiness (T247580) + it.skip( 'should be re-creatable', function () { let initialContent = getTestString(); // create @@ -60,7 +62,8 @@ } ); - it( 'should be editable', function () { + // Disable due to broken/flakiness (T247580) + it.skip( 'should be editable', function () { // create browser.call( function () { @@ -89,7 +92,8 @@ } ); - it( 'should be deletable', function () { + // Disable due to broken/flakiness (T247580) + it.skip( 'should be deletable', function () { // login UserLoginPage.loginAdmin(); @@ -110,7 +114,8 @@ } ); - it( 'should be restorable', function () { + // Disable due to broken/flakiness (T247580) + it.skip( 'should be restorable', function () { // login UserLoginPage.loginAdmin(); diff -Nru mediawiki-1.31.2/tests/selenium/specs/user.js mediawiki-1.31.7/tests/selenium/specs/user.js --- mediawiki-1.31.2/tests/selenium/specs/user.js 2019-06-05 20:14:33.000000000 +0000 +++ mediawiki-1.31.7/tests/selenium/specs/user.js 2020-03-26 17:18:24.000000000 +0000 @@ -21,7 +21,8 @@ password = Math.random().toString(); } ); - it( 'should be able to create account', function () { + // Disable due to broken/flakiness (T247580) + it.skip( 'should be able to create account', function () { // create CreateAccountPage.createAccount( username, password ); @@ -31,7 +32,8 @@ } ); - it( 'should be able to log in', function () { + // Disable due to broken/flakiness (T247580) + it.skip( 'should be able to log in', function () { // create browser.call( function () { @@ -46,8 +48,8 @@ } ); - it( 'should be able to change preferences', function () { - + // Disabled due to flakiness (T199446) + it.skip( 'should be able to change preferences', function () { var realName = Math.random().toString(); // create