* …
=== 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 ===
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 ===
}
if ( !$this->mTitle->isUserConfigPage() ) {
- $out->addHTML( self::getEditToolbar( $this->mTitle ) );
+ $out->addHTML( self::getEditToolbar() );
}
if ( $this->blankArticle ) {
/**
* 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 = '<div id="toolbar"></div>';
$toolbar = $startingToolbar;
$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.
*
return $this->mModules;
}
- public function getModuleScripts() {
- wfDeprecated( __METHOD__, '1.33' );
- return [];
- }
-
public function getModuleStyles() {
return $this->mModuleStyles;
}
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
*
*
* @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'
$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;
'defaultsort' => [ 1, 'পূর্বনির্ধারিত_বাছাই', 'পূর্বনির্ধারিতবাছাই', 'DEFAULTSORT:', 'DEFAULTSORTKEY:', 'DEFAULTCATEGORYSORT:' ],
'filepath' => [ 0, 'ফাইলের_পথ:', 'ফাইলেরপথ:', 'FILEPATH:' ],
'tag' => [ 0, 'ট্যাগ', 'tag' ],
- 'hiddencat' => [ 1, '__লà§\81à¦\95ায়িতবিষয়শà§\8dরà§\87ণà§\80__', '__লà§\81à¦\95à§\8dà¦\95ায়িতবিষয়শ্রেণী__', '__HIDDENCAT__' ],
+ 'hiddencat' => [ 1, '__লà§\81à¦\95ানà§\8b_বিষয়শà§\8dরà§\87ণà§\80__', '__লà§\81à¦\95ানà§\8bবিষয়শà§\8dরà§\87ণà§\80__', '__লà§\81à¦\95ায়িতবিষয়শà§\8dরà§\87ণà§\80__', '__লà§\81à¦\95à§\8dà¦\95ায়িতবিষয়শà§\8dরà§\87ণà§\80__', '__লà§\81à¦\95à§\8dà¦\95ায়িত_বিষয়শ্রেণী__', '__HIDDENCAT__' ],
'pagesincategory' => [ 1, 'বিষয়শ্রেণীতেপাতা', 'বিষয়শ্রেণীতেপৃষ্ঠা', 'বিষয়শ্রেণীতে_পাতা', 'বিষয়শ্রেণীতে_পৃষ্ঠা', 'PAGESINCATEGORY', 'PAGESINCAT' ],
'pagesize' => [ 1, 'পাতার_আকার', 'পাতারআকার', 'পৃষ্ঠার_আকার', 'পৃষ্ঠারআকার', 'PAGESIZE' ],
'index' => [ 1, '__নির্ঘণ্ট__', '__INDEX__' ],
* - 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() {
],
],
] );
- $this->hideDeprecated( 'User::getPasswordValidity' );
$user = static::getTestUser()->getUser();
$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' ) );
}
/**
'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',