From: jenkins-bot Date: Fri, 10 May 2019 17:19:18 +0000 (+0000) Subject: Merge "selenium: Add jpeg-js to devDependencies" X-Git-Tag: 1.34.0-rc.0~1719 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=e1d39f7d02c4c22bbdf6d71ae1c4c527e42ff44b;hp=7d9e117d91137889aa481b6f5b32dc71965031d1 Merge "selenium: Add jpeg-js to devDependencies" --- diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index 786dae21df..03a42c2b3c 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -39,7 +39,8 @@ For notes on 1.33.x and older releases, see HISTORY. * … === New developer features in 1.34 === -* … +* Language::formatTimePeriod now supports the new 'avoidhours' option to output + strings like "5 days ago" instead of "5 days 13 hours ago". === External library changes in 1.34 === @@ -143,6 +144,9 @@ because of Phabricator reports. 1.28, have been removed. * PageArchive::getTextFromRow(), ::listAllPages(), and ::getLastRevisionText(), deprecated in 1.32, have been removed. +* OutputPage::getModuleScripts(), ParserOutput::getModuleScripts(), deprecated + in 1.33, have been removed. +* User::getPasswordValidity(), deprecated in 1.33, has been removed. * … === Deprecations in 1.34 === diff --git a/includes/EditPage.php b/includes/EditPage.php index b2044e229f..7908fcc585 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2934,7 +2934,7 @@ ERROR; } if ( !$this->mTitle->isUserConfigPage() ) { - $out->addHTML( self::getEditToolbar( $this->mTitle ) ); + $out->addHTML( self::getEditToolbar() ); } if ( $this->blankArticle ) { @@ -4101,10 +4101,9 @@ ERROR; /** * Allow extensions to provide a toolbar. * - * @param Title|null $title Title object for the page being edited (optional) * @return string|null */ - public static function getEditToolbar( $title = null ) { + public static function getEditToolbar() { $startingToolbar = '
'; $toolbar = $startingToolbar; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 641f0b857b..c45fce7a9d 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -548,15 +548,6 @@ class OutputPage extends ContextSource { $this->mModules = array_merge( $this->mModules, (array)$modules ); } - /** - * @deprecated since 1.33 Use getModules() instead. - * @return array - */ - public function getModuleScripts() { - wfDeprecated( __METHOD__, '1.33' ); - return []; - } - /** * Get the list of style-only modules to load on this page. * diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 9a1653db3d..cc707134b8 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -510,11 +510,6 @@ class ParserOutput extends CacheTime { return $this->mModules; } - public function getModuleScripts() { - wfDeprecated( __METHOD__, '1.33' ); - return []; - } - public function getModuleStyles() { return $this->mModuleStyles; } diff --git a/includes/user/User.php b/includes/user/User.php index 2f6deb5f48..18d62f5a38 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1162,35 +1162,6 @@ class User implements IDBAccessObject, UserIdentity { return $this->checkPasswordValidity( $password )->isGood(); } - /** - * Given unvalidated password input, return error message on failure. - * - * @param string $password Desired password - * @return bool|string|array True on success, string or array of error message on failure - * @deprecated since 1.33, use checkPasswordValidity - */ - public function getPasswordValidity( $password ) { - wfDeprecated( __METHOD__, '1.33' ); - - $result = $this->checkPasswordValidity( $password ); - if ( $result->isGood() ) { - return true; - } - - $messages = []; - foreach ( $result->getErrorsByType( 'error' ) as $error ) { - $messages[] = $error['message']; - } - foreach ( $result->getErrorsByType( 'warning' ) as $warning ) { - $messages[] = $warning['message']; - } - if ( count( $messages ) === 1 ) { - return $messages[0]; - } - - return $messages; - } - /** * Check if this is a valid password for this user * diff --git a/languages/Language.php b/languages/Language.php index 3a12439e6e..2262fa775e 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -4658,6 +4658,7 @@ class Language { * * @param int|float $seconds * @param array $format An optional argument that formats the returned string in different ways: + * If $format['avoid'] === 'avoidhours': don't show hours, just show days * If $format['avoid'] === 'avoidseconds': don't show seconds if $seconds >= 1 hour, * If $format['avoid'] === 'avoidminutes': don't show seconds/minutes if $seconds > 48 hours, * If $format['noabbrevs'] is true: use 'seconds' and friends instead of 'seconds-abbrev' @@ -4716,12 +4717,19 @@ class Language { $s = $hoursMsg->params( $this->formatNum( $hours ) )->text(); $s .= ' '; $s .= $minutesMsg->params( $this->formatNum( $minutes ) )->text(); - if ( !in_array( $format['avoid'], [ 'avoidseconds', 'avoidminutes' ] ) ) { + if ( !in_array( $format['avoid'], [ 'avoidseconds', 'avoidminutes', 'avoidhours' ] ) ) { $s .= ' ' . $secondsMsg->params( $this->formatNum( $secondsPart ) )->text(); } } else { $days = floor( $seconds / 86400 ); - if ( $format['avoid'] === 'avoidminutes' ) { + if ( $format['avoid'] === 'avoidhours' ) { + $hours = round( ( $seconds - $days * 86400 ) / 3600 ); + if ( $hours == 24 ) { + $hours = 0; + $days++; + } + $s = $daysMsg->params( $this->formatNum( $days ) )->text(); + } elseif ( $format['avoid'] === 'avoidminutes' ) { $hours = round( ( $seconds - $days * 86400 ) / 3600 ); if ( $hours == 24 ) { $hours = 0; diff --git a/languages/messages/MessagesBn.php b/languages/messages/MessagesBn.php index 4edce3d49b..eeec6655ce 100644 --- a/languages/messages/MessagesBn.php +++ b/languages/messages/MessagesBn.php @@ -290,7 +290,7 @@ $magicWords = [ 'defaultsort' => [ 1, 'পূর্বনির্ধারিত_বাছাই', 'পূর্বনির্ধারিতবাছাই', 'DEFAULTSORT:', 'DEFAULTSORTKEY:', 'DEFAULTCATEGORYSORT:' ], 'filepath' => [ 0, 'ফাইলের_পথ:', 'ফাইলেরপথ:', 'FILEPATH:' ], 'tag' => [ 0, 'ট্যাগ', 'tag' ], - 'hiddencat' => [ 1, '__লুকায়িতবিষয়শ্রেণী__', '__লুক্কায়িতবিষয়শ্রেণী__', '__HIDDENCAT__' ], + 'hiddencat' => [ 1, '__লুকানো_বিষয়শ্রেণী__', '__লুকানোবিষয়শ্রেণী__', '__লুকায়িতবিষয়শ্রেণী__', '__লুক্কায়িতবিষয়শ্রেণী__', '__লুক্কায়িত_বিষয়শ্রেণী__', '__HIDDENCAT__' ], 'pagesincategory' => [ 1, 'বিষয়শ্রেণীতেপাতা', 'বিষয়শ্রেণীতেপৃষ্ঠা', 'বিষয়শ্রেণীতে_পাতা', 'বিষয়শ্রেণীতে_পৃষ্ঠা', 'PAGESINCATEGORY', 'PAGESINCAT' ], 'pagesize' => [ 1, 'পাতার_আকার', 'পাতারআকার', 'পৃষ্ঠার_আকার', 'পৃষ্ঠারআকার', 'PAGESIZE' ], 'index' => [ 1, '__নির্ঘণ্ট__', '__INDEX__' ], diff --git a/tests/phpunit/includes/user/UserTest.php b/tests/phpunit/includes/user/UserTest.php index aeeae11833..c90e98890e 100644 --- a/tests/phpunit/includes/user/UserTest.php +++ b/tests/phpunit/includes/user/UserTest.php @@ -366,7 +366,6 @@ class UserTest extends MediaWikiTestCase { * - ensure the password is not the same as the username * - ensure the username/password combo isn't forbidden * @covers User::checkPasswordValidity() - * @covers User::getPasswordValidity() * @covers User::isValidPassword() */ public function testCheckPasswordValidity() { @@ -394,7 +393,6 @@ class UserTest extends MediaWikiTestCase { ], ], ] ); - $this->hideDeprecated( 'User::getPasswordValidity' ); $user = static::getTestUser()->getUser(); @@ -405,24 +403,20 @@ class UserTest extends MediaWikiTestCase { $this->assertFalse( $user->isValidPassword( 'a' ) ); $this->assertFalse( $user->checkPasswordValidity( 'a' )->isGood() ); $this->assertTrue( $user->checkPasswordValidity( 'a' )->isOK() ); - $this->assertEquals( 'passwordtooshort', $user->getPasswordValidity( 'a' ) ); // Maximum length $longPass = str_repeat( 'a', 41 ); $this->assertFalse( $user->isValidPassword( $longPass ) ); $this->assertFalse( $user->checkPasswordValidity( $longPass )->isGood() ); $this->assertFalse( $user->checkPasswordValidity( $longPass )->isOK() ); - $this->assertEquals( 'passwordtoolong', $user->getPasswordValidity( $longPass ) ); // Matches username $this->assertFalse( $user->checkPasswordValidity( $user->getName() )->isGood() ); $this->assertTrue( $user->checkPasswordValidity( $user->getName() )->isOK() ); - $this->assertEquals( 'password-name-match', $user->getPasswordValidity( $user->getName() ) ); // On the forbidden list $user = User::newFromName( 'Useruser' ); $this->assertFalse( $user->checkPasswordValidity( 'Passpass' )->isGood() ); - $this->assertEquals( 'password-login-forbidden', $user->getPasswordValidity( 'Passpass' ) ); } /** diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index b9b8306e0c..2f6fa39b36 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -135,6 +135,18 @@ class LanguageTest extends LanguageClassesTestCase { '48 hours 0 minutes', 'formatTimePeriod() rounding (=48h), avoidseconds' ], + [ + 259199.55, + 'avoidhours', + '3 d', + 'formatTimePeriod() rounding (>48h), avoidhours' + ], + [ + 259199.55, + [ 'avoid' => 'avoidhours', 'noabbrevs' => true ], + '3 days', + 'formatTimePeriod() rounding (>48h), avoidhours' + ], [ 259199.55, 'avoidminutes',