From: jenkins-bot Date: Sun, 21 Oct 2018 17:33:31 +0000 (+0000) Subject: Merge "Don't pass a MailAddress pass the email to mail()" into REL1_31 X-Git-Tag: 1.31.2~77 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=051d2e9aca28cc3baff42b79ba7d8e23cc05e855;hp=6bc0e36d8b33b6d0602b912fba75938368e09406 Merge "Don't pass a MailAddress pass the email to mail()" into REL1_31 --- diff --git a/includes/import/ImportableUploadRevisionImporter.php b/includes/import/ImportableUploadRevisionImporter.php index b64114cf87..515cdd5e95 100644 --- a/includes/import/ImportableUploadRevisionImporter.php +++ b/includes/import/ImportableUploadRevisionImporter.php @@ -85,7 +85,8 @@ class ImportableUploadRevisionImporter implements UploadRevisionImporter { return $this->newNotOkStatus(); } - $user = $importableRevision->getUserObj() ?: User::newFromName( $importableRevision->getUser() ); + $user = $importableRevision->getUserObj() + ?: User::newFromName( $importableRevision->getUser(), false ); # Do the actual upload if ( $archiveName ) { diff --git a/includes/installer/i18n/en.json b/includes/installer/i18n/en.json index 5f0fea9918..f1cb4bae2f 100644 --- a/includes/installer/i18n/en.json +++ b/includes/installer/i18n/en.json @@ -304,7 +304,7 @@ "config-help": "help", "config-help-tooltip": "click to expand", "config-nofile": "File \"$1\" could not be found. Has it been deleted?", - "config-extension-link": "Did you know that your wiki supports [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions extensions]?\n\nYou can browse [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensions by category] or the [https://www.mediawiki.org/wiki/Extension_Matrix Extension Matrix] to see the full list of extensions.", + "config-extension-link": "Did you know that your wiki supports [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions extensions]?\n\nYou can browse [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensions by category].", "config-skins-screenshots": "$1 (screenshots: $2)", "config-skins-screenshot": "$1 ($2)", "config-extensions-requires": "$1 (requires $2)", diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 896774f16c..2b5aaf59da 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1503,14 +1503,14 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $options = [ $options ]; } - $res = $this->select( $table, $var, $cond, $fname, $options, $join_conds ); + $res = $this->select( $table, [ 'value' => $var ], $cond, $fname, $options, $join_conds ); if ( $res === false ) { return false; } $values = []; foreach ( $res as $row ) { - $values[] = $row->$var; + $values[] = $row->value; } return $values; diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php index cf10801c49..ab2f11b5ea 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php @@ -2047,4 +2047,21 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase { $this->assertLastSql( 'BEGIN; SELECT 1; COMMIT' ); $this->assertEquals( 0, $this->database->trxLevel() ); } + + /** + * @covers Wikimedia\Rdbms\Database::selectFieldValues() + */ + public function testSelectFieldValues() { + $this->database->forceNextResult( [ + (object)[ 'value' => 'row1' ], + (object)[ 'value' => 'row2' ], + (object)[ 'value' => 'row3' ], + ] ); + + $this->assertSame( + [ 'row1', 'row2', 'row3' ], + $this->database->selectFieldValues( 'table', 'table.field', 'conds', __METHOD__ ) + ); + $this->assertLastSql( 'SELECT table.field AS value FROM table WHERE conds' ); + } } diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php index e328cba6aa..444a946e39 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php @@ -609,4 +609,5 @@ class DatabaseTest extends PHPUnit\Framework\TestCase { $this->db->dbSchema( $old ); $this->assertNotEquals( 'xxx', $this->db->dbSchema() ); } + }