Page MenuHomePhabricator

raw-paste-data.txt

Authored By
Reedy
Sep 25 2020, 7:37 PM
Size
16 KB
Referenced Files
None
Subscribers
None

raw-paste-data.txt

diff -Nru mediawiki-1.31.8/includes/ActorMigration.php mediawiki-1.31.10/includes/ActorMigration.php
--- mediawiki-1.31.8/includes/ActorMigration.php 2020-09-25 20:34:23.913971610 +0100
+++ mediawiki-1.31.10/includes/ActorMigration.php 2020-09-24 22:51:25.569653500 +0100
@@ -183,6 +183,12 @@
/**
* Get actor ID from UserIdentity, if it exists
+ *
+ * @since 1.31.9
+ *
+ * @param IDatabase $db
+ * @param UserIdentity $user
+ * @return int|false
*/
public function getExistingActorId( IDatabase $db, UserIdentity $user ) {
$row = $db->selectRow(
@@ -202,17 +208,19 @@
* Attempt to assign an actor ID to the given user.
* If it is already assigned, return the existing ID.
*
- * @param IDatabase $dbw
+ * @since 1.31.9
+ *
+ * @param IDatabase|int $dbw Either a database to read from, or the query flags to use
* @param UserIdentity $user
*
* @return int The new actor ID
*/
- public function getNewActorId( IDatabase $dbw, UserIdentity $user ) {
+ public function getNewActorId( $dbw, UserIdentity $user ) {
$q = [
'actor_user' => $user->getId() ?: null,
'actor_name' => (string)$user->getName(),
];
- if ( $dbw ) {
+ if ( $dbw instanceof IDatabase ) {
if ( $q['actor_user'] === null && User::isUsableName( $q['actor_name'] ) ) {
throw new CannotCreateActorException(
'Cannot create an actor for a usable name that is not an existing user'
@@ -240,9 +248,9 @@
);
}
}
- $this->invalidateCache();
+ User::newFromName( (string)$user->getName(), false )->invalidateCache();
} else {
- list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $this->queryFlagsUsed );
+ list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $dbw );
$db = wfGetDB( $index );
$actorId = (int)$db->selectField( 'actor', 'actor_id', $q, __METHOD__, $options );
}
diff -Nru mediawiki-1.31.8/includes/api/ApiMain.php mediawiki-1.31.10/includes/api/ApiMain.php
--- mediawiki-1.31.8/includes/api/ApiMain.php 2020-09-25 20:34:23.913971610 +0100
+++ mediawiki-1.31.10/includes/api/ApiMain.php 2020-09-24 22:51:25.593654000 +0100
@@ -1541,9 +1541,9 @@
if ( $request->getProtocol() === 'http' &&
(
$this->getConfig()->get( 'ForceHTTPS' ) ||
- $request->getSession()->shouldForceHTTPS() ||
- ( $this->getUser()->isLoggedIn() &&
- $this->getUser()->requiresHTTPS() )
+ $request->getSession()->shouldForceHTTPS() ||
+ ( $this->getUser()->isLoggedIn() &&
+ $this->getUser()->requiresHTTPS() )
)
) {
$this->addDeprecation( 'apiwarn-deprecation-httpsexpected', 'https-expected' );
diff -Nru mediawiki-1.31.8/includes/Defines.php mediawiki-1.31.10/includes/Defines.php
--- mediawiki-1.31.8/includes/Defines.php 2020-09-25 20:34:23.913971610 +0100
+++ mediawiki-1.31.10/includes/Defines.php 2020-09-24 22:51:25.573653700 +0100
@@ -37,7 +37,7 @@
*
* @since 1.31.7
*/
-define( 'MW_VERSION', '1.31.9' );
+define( 'MW_VERSION', '1.31.10' );
# Obsolete aliases
/**
diff -Nru mediawiki-1.31.8/includes/MediaWiki.php mediawiki-1.31.10/includes/MediaWiki.php
--- mediawiki-1.31.8/includes/MediaWiki.php 2020-09-25 20:34:23.917971668 +0100
+++ mediawiki-1.31.10/includes/MediaWiki.php 2020-09-24 22:51:25.577653600 +0100
@@ -792,8 +792,8 @@
}
if ( $this->maybeDoHttpsRedirect() ) {
- return;
- }
+ return;
+ }
if ( $title->canExist() && HTMLFileCache::useFileCache( $this->context ) ) {
// Try low-level file cache hit
diff -Nru mediawiki-1.31.8/includes/session/CookieSessionProvider.php mediawiki-1.31.10/includes/session/CookieSessionProvider.php
--- mediawiki-1.31.8/includes/session/CookieSessionProvider.php 2020-09-25 20:34:23.917971668 +0100
+++ mediawiki-1.31.10/includes/session/CookieSessionProvider.php 2020-09-24 22:51:25.729655700 +0100
@@ -356,7 +356,7 @@
if ( $this->useCrossSiteCookies ) {
$value = $request->getCrossSiteCookie( $key, $prefix, $default );
} else {
- $value = $request->getCookie( $key, $prefix, $default );
+ $value = $request->getCookie( $key, $prefix, $default );
}
if ( $value === 'deleted' ) {
// PHP uses this value when deleting cookies. A legitimate cookie will never have
diff -Nru mediawiki-1.31.8/includes/session/ImmutableSessionProviderWithCookie.php mediawiki-1.31.10/includes/session/ImmutableSessionProviderWithCookie.php
--- mediawiki-1.31.8/includes/session/ImmutableSessionProviderWithCookie.php 2020-09-25 20:34:23.917971668 +0100
+++ mediawiki-1.31.10/includes/session/ImmutableSessionProviderWithCookie.php 2020-09-24 22:51:25.729655700 +0100
@@ -115,8 +115,8 @@
if ( $session->shouldForceHTTPS() || $session->getUser()->requiresHTTPS() ) {
// Send a cookie unless $wgForceHTTPS is set (T256095)
if ( !$this->config->get( 'ForceHTTPS' ) ) {
- $response->setCookie( 'forceHTTPS', 'true', null,
- [ 'prefix' => '', 'secure' => false ] + $options );
+ $response->setCookie( 'forceHTTPS', 'true', null,
+ [ 'prefix' => '', 'secure' => false ] + $options );
}
$options['secure'] = true;
}
diff -Nru mediawiki-1.31.8/includes/shell/Command.php mediawiki-1.31.10/includes/shell/Command.php
--- mediawiki-1.31.8/includes/shell/Command.php 2020-09-25 20:34:23.917971668 +0100
+++ mediawiki-1.31.10/includes/shell/Command.php 2020-09-24 22:51:25.729655700 +0100
@@ -400,7 +400,7 @@
// This solves some shell parsing issues, see T207248
$proc = proc_open( $cmd, $desc, $pipes, null, null, [ 'bypass_shell' => true ] );
} else {
- $proc = proc_open( $cmd, $desc, $pipes );
+ $proc = proc_open( $cmd, $desc, $pipes );
}
if ( !$proc ) {
diff -Nru mediawiki-1.31.8/includes/user/User.php mediawiki-1.31.10/includes/user/User.php
--- mediawiki-1.31.8/includes/user/User.php 2020-09-25 20:34:23.921971726 +0100
+++ mediawiki-1.31.10/includes/user/User.php 2020-09-24 22:51:25.749656200 +0100
@@ -2160,16 +2160,16 @@
} else {
// Check for group-specific limits
// If more than one group applies, use the highest allowance (if higher than the default)
- foreach ( $this->getGroups() as $group ) {
- if ( isset( $limits[$group] ) ) {
- if ( $userLimit === false
- || $limits[$group][0] / $limits[$group][1] > $userLimit[0] / $userLimit[1]
- ) {
- $userLimit = $limits[$group];
+ foreach ( $this->getGroups() as $group ) {
+ if ( isset( $limits[$group] ) ) {
+ if ( $userLimit === false
+ || $limits[$group][0] / $limits[$group][1] > $userLimit[0] / $userLimit[1]
+ ) {
+ $userLimit = $limits[$group];
+ }
}
}
}
- }
// Set the user limit key
if ( $userLimit !== false ) {
@@ -2224,12 +2224,12 @@
// phan is confused because &can-bypass's value is a bool, so it assumes
// that $userLimit is also a bool here.
// @phan-suppress-next-line PhanTypeInvalidExpressionArrayDestructuring
- list( $max, $period ) = $limit;
+ list( $max, $period ) = $limit;
$expiry = $now + (int)$period;
$count = 0;
- // Already pinged?
+ // Already pinged?
if ( $data ) {
// NOTE: in order to investigate T246991, we write the expiry time
// into the payload, along with the count.
@@ -2252,13 +2252,13 @@
'expiry' => MWTimestamp::convert( TS_DB, $storedExpiry ),
]
);
- } else {
+ } else {
// NOTE: We'll keep the original expiry when bumping counters,
// resulting in a kind of fixed-window throttle.
$expiry = min( $storedExpiry, $now + (int)$period );
$count = $storedCount;
- }
- }
+ }
+ }
// Limit exceeded!
if ( $count >= $max ) {
@@ -2278,12 +2278,12 @@
}
$triggered = true;
- }
+ }
$count += $incrBy;
$data = "$count|$expiry";
return $data;
- }
+ }
);
}
@@ -2528,11 +2528,17 @@
$this->load();
}
- if ( !$this->mActorId && $dbw ) {
+ if ( $this->mActorId === null || !$this->mActorId && $dbw ) {
$migration = MediaWikiServices::getInstance()->getActorMigration();
+ if ( !$dbw ) {
+ // Read from a database, flags are used for wfGetDB()
+ $dbw = $this->queryFlagsUsed;
+ }
$this->mActorId = $migration->getNewActorId( $dbw, $this );
+ if ( $dbw instanceof IDatabase ) {
$this->invalidateCache();
+ }
$this->setItemLoaded( 'actor' );
}
diff -Nru mediawiki-1.31.8/includes/WebResponse.php mediawiki-1.31.10/includes/WebResponse.php
--- mediawiki-1.31.8/includes/WebResponse.php 2020-09-25 20:34:23.921971726 +0100
+++ mediawiki-1.31.10/includes/WebResponse.php 2020-09-24 22:51:25.589653700 +0100
@@ -177,12 +177,12 @@
'cookie' => $prefixedName,
'data' => [
'name' => $prefixedName,
- 'value' => (string)$value,
- 'expire' => (int)$expire,
- 'path' => (string)$options['path'],
- 'domain' => (string)$options['domain'],
- 'secure' => (bool)$options['secure'],
- 'httpOnly' => (bool)$options['httpOnly'],
+ 'value' => (string)$value,
+ 'expire' => (int)$expire,
+ 'path' => (string)$options['path'],
+ 'domain' => (string)$options['domain'],
+ 'secure' => (bool)$options['secure'],
+ 'httpOnly' => (bool)$options['httpOnly'],
'sameSite' => (string)$options['sameSite']
],
'exception' => new RuntimeException( 'Ignored post-send cookie' ),
@@ -206,33 +206,33 @@
'secure' => (bool)$options['secure'],
'httponly' => (bool)$options['httpOnly'],
'samesite' => (string)$options['sameSite'],
- ];
+ ];
- // Per RFC 6265, key is name + domain + path
+ // Per RFC 6265, key is name + domain + path
$key = "{$prefixedName}\n{$setOptions['domain']}\n{$setOptions['path']}";
- // If this cookie name was in the request, fake an entry in
- // self::$setCookies for it so the deleting check works right.
+ // If this cookie name was in the request, fake an entry in
+ // self::$setCookies for it so the deleting check works right.
if ( isset( $_COOKIE[$prefixedName] ) && !array_key_exists( $key, self::$setCookies ) ) {
- self::$setCookies[$key] = [];
- }
+ self::$setCookies[$key] = [];
+ }
- // PHP deletes if value is the empty string; also, a past expiry is deleting
+ // PHP deletes if value is the empty string; also, a past expiry is deleting
$deleting = ( $value === '' || $setOptions['expires'] > 0 && $setOptions['expires'] <= time() );
$logDesc = "$func: \"$prefixedName\", \"$value\", \"" .
implode( '", "', $setOptions ) . '"';
$optionsForDeduplication = [ $func, $prefixedName, $value, $setOptions ];
- if ( $deleting && !isset( self::$setCookies[$key] ) ) { // isset( null ) is false
+ if ( $deleting && !isset( self::$setCookies[$key] ) ) { // isset( null ) is false
wfDebugLog( 'cookie', "already deleted $logDesc" );
return;
- } elseif ( !$deleting && isset( self::$setCookies[$key] ) &&
+ } elseif ( !$deleting && isset( self::$setCookies[$key] ) &&
self::$setCookies[$key] === $optionsForDeduplication
- ) {
+ ) {
wfDebugLog( 'cookie', "already set $logDesc" );
return;
- }
+ }
wfDebugLog( 'cookie', $logDesc );
if ( $func === 'setrawcookie' ) {
diff -Nru mediawiki-1.31.8/maintenance/dumpCategoriesAsRdf.php mediawiki-1.31.10/maintenance/dumpCategoriesAsRdf.php
--- mediawiki-1.31.8/maintenance/dumpCategoriesAsRdf.php 2020-09-25 20:34:23.921971726 +0100
+++ mediawiki-1.31.10/maintenance/dumpCategoriesAsRdf.php 2020-09-24 22:51:26.157662000 +0100
@@ -157,8 +157,8 @@
(int)$row->cat_subcats
);
if ( $row->page_id ) {
- $pages[$row->page_id] = $row->page_title;
- }
+ $pages[$row->page_id] = $row->page_title;
+ }
}
foreach ( $this->getCategoryLinksIterator( $dbr, array_keys( $pages ) ) as $row ) {
diff -Nru mediawiki-1.31.8/RELEASE-NOTES-1.31 mediawiki-1.31.10/RELEASE-NOTES-1.31
--- mediawiki-1.31.8/RELEASE-NOTES-1.31 2020-09-25 20:34:23.921971726 +0100
+++ mediawiki-1.31.10/RELEASE-NOTES-1.31 2020-09-24 22:51:25.565653600 +0100
@@ -1,3 +1,10 @@
+== MediaWiki 1.31.10 ==
+
+This is a maintenance release of the MediaWiki 1.31 branch.
+
+=== Changes since MediaWiki 1.31.9 ===
+* Fixed issues relating to backporting of changes for T260485.
+
== MediaWiki 1.31.9 ==
This is a security and maintenance release of the MediaWiki 1.31 branch.
diff -Nru mediawiki-1.31.8/tests/phpunit/includes/ActorMigrationTest.php mediawiki-1.31.10/tests/phpunit/includes/ActorMigrationTest.php
--- mediawiki-1.31.8/tests/phpunit/includes/ActorMigrationTest.php 2020-06-24 17:26:43.128212700 +0100
+++ mediawiki-1.31.10/tests/phpunit/includes/ActorMigrationTest.php 2020-09-24 22:51:26.317664400 +0100
@@ -662,7 +662,12 @@
$fields = $m->getInsertValues( $this->db, 'dummy_user', $userIdentity );
$this->assertSame( $user->getId(), $fields['dummy_user'] );
$this->assertSame( $user->getName(), $fields['dummy_user_text'] );
- $this->assertSame( $user->getActorId(), $fields['dummy_actor'] );
+
+ // This no longer works because despite mocking UserIdentiy::getActorId(), that
+ // method is not called, instead the actual database is queried, when $fields are set.
+ // Since dummy_actor has no row in the actor table, when getInsertValues needs to
+ // actor id it creates a new one
+ // $this->assertSame( $user->getActorId(), $fields['dummy_actor'] );
}
public function testConstructor() {
diff -Nru mediawiki-1.31.8/tests/phpunit/includes/session/CookieSessionProviderTest.php mediawiki-1.31.10/tests/phpunit/includes/session/CookieSessionProviderTest.php
--- mediawiki-1.31.8/tests/phpunit/includes/session/CookieSessionProviderTest.php 2020-09-25 20:34:23.921971726 +0100
+++ mediawiki-1.31.10/tests/phpunit/includes/session/CookieSessionProviderTest.php 2020-09-24 22:51:26.337664600 +0100
@@ -456,7 +456,7 @@
if ( $forceHTTPS ) {
$this->assertSame( null, $request->response()->getCookie( 'forceHTTPS' ) );
} else {
- $this->assertSame( '', $request->response()->getCookie( 'forceHTTPS' ) );
+ $this->assertSame( '', $request->response()->getCookie( 'forceHTTPS' ) );
}
$this->assertSame( [], $backend->getData() );
@@ -473,7 +473,7 @@
if ( $forceHTTPS ) {
$this->assertSame( null, $request->response()->getCookie( 'forceHTTPS' ) );
} else {
- $this->assertSame( '', $request->response()->getCookie( 'forceHTTPS' ) );
+ $this->assertSame( '', $request->response()->getCookie( 'forceHTTPS' ) );
}
$this->assertSame( [], $backend->getData() );
@@ -491,7 +491,7 @@
if ( $forceHTTPS ) {
$this->assertSame( null, $request->response()->getCookie( 'forceHTTPS' ) );
} else {
- $this->assertSame( 'true', $request->response()->getCookie( 'forceHTTPS' ) );
+ $this->assertSame( 'true', $request->response()->getCookie( 'forceHTTPS' ) );
}
$this->assertSame( [], $backend->getData() );
}
diff -Nru mediawiki-1.31.8/tests/phpunit/includes/shell/CommandTest.php mediawiki-1.31.10/tests/phpunit/includes/shell/CommandTest.php
--- mediawiki-1.31.8/tests/phpunit/includes/shell/CommandTest.php 2020-09-25 20:34:23.925971783 +0100
+++ mediawiki-1.31.10/tests/phpunit/includes/shell/CommandTest.php 2020-09-24 22:35:10.439604800 +0100
@@ -115,8 +115,8 @@
if ( wfIsWindows() ) {
$this->assertEquals( '"echo" "a" "b" c d', $command->command );
} else {
- $this->assertEquals( "'echo' 'a' 'b' c d", $command->command );
- }
+ $this->assertEquals( "'echo' 'a' 'b' c d", $command->command );
+ }
}
public function testT69870() {
diff -Nru mediawiki-1.31.8/tests/phpunit/includes/shell/FirejailCommandTest.php mediawiki-1.31.10/tests/phpunit/includes/shell/FirejailCommandTest.php
--- mediawiki-1.31.8/tests/phpunit/includes/shell/FirejailCommandTest.php 2020-09-25 20:34:23.925971783 +0100
+++ mediawiki-1.31.10/tests/phpunit/includes/shell/FirejailCommandTest.php 2020-09-24 22:51:26.341664800 +0100
@@ -87,7 +87,7 @@
*/
public function testParamsOutput() {
$this->expectException( RuntimeException::class );
- ( new FirejailCommand( 'firejail' ) )->params( 'echo', 'a', '--output=/tmp/fjout',';id' );
+ ( new FirejailCommand( 'firejail' ) )->params( 'echo', 'a', '--output=/tmp/fjout', ';id' );
}
}
diff -Nru mediawiki-1.31.8/tests/phpunit/includes/shell/ShellTest.php mediawiki-1.31.10/tests/phpunit/includes/shell/ShellTest.php
--- mediawiki-1.31.8/tests/phpunit/includes/shell/ShellTest.php 2020-09-25 20:34:23.925971783 +0100
+++ mediawiki-1.31.10/tests/phpunit/includes/shell/ShellTest.php 2020-09-24 22:51:26.341664800 +0100
@@ -49,10 +49,10 @@
public function testMakeScriptCommand(
$expected,
$expectedWin,
- $script,
- $parameters,
- $options = [],
- $hook = null
+ $script,
+ $parameters,
+ $options = [],
+ $hook = null
) {
// Running tests under Vagrant involves MWMultiVersion that uses the below hook
$this->setMwGlobals( 'wgHooks', [] );
@@ -72,7 +72,7 @@
if ( wfIsWindows() ) {
$this->assertEquals( $expectedWin, $wrapper->command );
} else {
- $this->assertEquals( $expected, $wrapper->command );
+ $this->assertEquals( $expected, $wrapper->command );
}
$this->assertSame( 0, $wrapper->restrictions & Shell::NO_LOCALSETTINGS );
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8576411
Default Alt Text
raw-paste-data.txt (16 KB)

Event Timeline