From: jenkins-bot Date: Fri, 10 May 2019 16:59:58 +0000 (+0000) Subject: Merge "Add 'avoidhours' option to Language#formatTimePeriod" X-Git-Tag: 1.34.0-rc.0~1723 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=9f5c319b091fc84796c1e841699cc70c7566bef7;hp=-c Merge "Add 'avoidhours' option to Language#formatTimePeriod" --- 9f5c319b091fc84796c1e841699cc70c7566bef7 diff --combined RELEASE-NOTES-1.34 index 786dae21df,2b22d92bb8..7738adb28f --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@@ -25,7 -25,6 +25,7 @@@ Some specific notes for MediaWiki 1.34 For notes on 1.33.x and older releases, see HISTORY. === Configuration changes for system administrators in 1.34 === + ==== New configuration ==== * … @@@ -39,10 -38,10 +39,11 @@@ * … === 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 === + ==== New external libraries ==== * … @@@ -55,10 -54,7 +56,10 @@@ * … === Bug fixes in 1.34 === -* … +* (T222529) If a log entry or page revision is recorded in the database with an + empty username, attempting to display it will log an error and return a "no + username available" to the user instead of silently displaying nothing or + invalid links. === Action API changes in 1.34 === * The 'recenteditcount' response property from action=query list=allusers, @@@ -112,41 -108,14 +113,41 @@@ because of Phabricator reports * wfArrayFilter() and wfArrayFilterByKey(), deprecated in 1.32, have been removed. * wfMakeUrlIndexes() function, deprecated in 1.33, have been removed. +* Method signatures in WatchedItemQueryServiceExtension have changed from taking + User objects to taking UserIdentity objects. Extensions implementing this + interface need to be changed accordingly. * User::getGroupPage() and ::makeGroupLinkHTML(), deprecated in 1.29, have been removed. Use UserGroupMembership::getGroupPage and ::getLink instead. * User::makeGroupLinkWiki(), deprecated in 1.29, has been removed. Use UserGroupMembership::getLink() instead. +* SavepointPostgres, deprecated in 1.31, has been removed. +* Output::sectionEditLinksEnabled(), ParserOutput::getEditSectionTokens, + ::getTOCEnabled, ::setEditSectionTokens, ::setTOCEnabled, deprecated in 1.31, + have been removed. +* EditPage::safeUnicodeInput() and ::safeUnicodeOutput(), deprecated in 1.30, + have been removed. +* Four methods in OutputPage, deprecated in 1.32, have been removed. You should + use OutputPage::showFatalError or throw a FatalError instead. The methods are + ::showFileCopyError(), ::showFileRenameError(), ::showFileDeleteError(), and + ::showFileNotFoundError(). +* ApiBase::truncateArray(), deprecated in 1.32, has been removed. +* IcuCollation::getICUVersion(), deprecated in 1.32, has been removed. Use PHP's + INTL_ICU_VERSION constant directly. +* HTMLForm::setSubmitProgressive(), deprecated in 1.32, has been removed. +* ResourceLoaderStartUpModules::getStartupModules() and ::getLegacyModules(), + both deprecated in 1.32, have been removed. +* BaseTemplate::msgHtml() and QuickTemplate::msgHtml(), deprecated in 1.32, have + been removed. Use ->msg() or ->getMsg() instead. +* WatchAction::getUnwatchToken(), deprecated in 1.32, has been removed. Instead, + use WatchAction::getWatchToken() with action 'unwatch' directly. +* Language::initEncoding(), ::recodeForEdit(), and recodeInput(), deprecated in + 1.28, have been removed. +* PageArchive::getTextFromRow(), ::listAllPages(), and ::getLastRevisionText(), + deprecated in 1.32, have been removed. * … === Deprecations in 1.34 === -* The MWNamespace class is deprecated. Use MediaWikiServices::getNamespaceInfo. +* The MWNamespace class is deprecated. Use NamespaceInfo. * ExtensionRegistry->load() is deprecated, as it breaks dependency checking. Instead, use ->queue(). * User::isBlocked() is deprecated since it does not tell you if the user is @@@ -158,26 -127,6 +159,26 @@@ instead. * The Config argument to ChangesListSpecialPage::checkStructuredFilterUiEnabled is deprecated. Pass only the User argument. +* WatchedItem::getUser is deprecated. Use getUserIdentity. +* Passing a Title as the first parameter to the getTimestampById method of + RevisionStore is deprecated. Omit it, passing only the remaining parameters. +* Title::getPreviousRevisionId and Title::getNextRevisionId are deprecated. Use + RevisionLookup::getPreviousRevision and RevisionLookup::getNextRevision. +* The Title parameter to RevisionLookup::getPreviousRevision and + RevisionLookup::getNextRevision is deprecated and should be omitted. +* MWHttpRequest::factory is deprecated. Use HttpRequestFactory. +* The Http class is deprecated. For the request, get, and post methods, use + HttpRequestFactory. For isValidURI, use MWHttpRequest::isValidURI. For + getProxy, use (string)$wgHTTPProxy. For createMultiClient, construct a + MultiHttpClient directly. +* Http::$httpEngine is deprecated and has no replacement. The default 'guzzle' + engine will eventually be made the only engine for HTTP requests. +* RepoGroup::singleton(), RepoGroup::destroySingleton(), + RepoGroup::setSingleton(), wfFindFile(), and wfLocalFile() are all + deprecated. Use MediaWikiServices instead. +* The getSubjectPage, getTalkPage, and getOtherPage of Title are deprecated. + Use NamespaceInfo's getSubjectPage, getTalkPage, and getAssociatedPage. +* MWMessagePack class, no longer used, has been deprecated in 1.34. === Other changes in 1.34 === * … diff --combined languages/Language.php index 3a12439e6e,17018c7d36..2262fa775e --- a/languages/Language.php +++ b/languages/Language.php @@@ -27,7 -27,6 +27,7 @@@ */ use CLDRPluralRuleParser\Evaluator; +use MediaWiki\MediaWikiServices; use Wikimedia\Assert\Assert; /** @@@ -507,8 -506,7 +507,8 @@@ class Language if ( is_null( $this->namespaceNames ) ) { global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces; - $validNamespaces = MWNamespace::getCanonicalNamespaces(); + $validNamespaces = MediaWikiServices::getInstance()->getNamespaceInfo()-> + getCanonicalNamespaces(); $this->namespaceNames = $wgExtraNamespaces + self::$dataCache->getItem( $this->mCode, 'namespaceNames' ); @@@ -746,8 -744,7 +746,8 @@@ */ public function getNsIndex( $text ) { $lctext = $this->lc( $text ); - $ns = MWNamespace::getCanonicalIndex( $lctext ); + $ns = MediaWikiServices::getInstance()->getNamespaceInfo()-> + getCanonicalIndex( $lctext ); if ( $ns !== null ) { return $ns; } @@@ -3033,6 -3030,34 +3033,6 @@@ } } - /** - * @deprecated No-op since 1.28 - */ - function initEncoding() { - wfDeprecated( __METHOD__, '1.28' ); - // No-op. - } - - /** - * @param string $s - * @return string - * @deprecated No-op since 1.28 - */ - function recodeForEdit( $s ) { - wfDeprecated( __METHOD__, '1.28' ); - return $s; - } - - /** - * @param string $s - * @return string - * @deprecated No-op since 1.28 - */ - function recodeInput( $s ) { - wfDeprecated( __METHOD__, '1.28' ); - return $s; - } - /** * Convert a UTF-8 string to normal form C. In Malayalam and Arabic, this * also cleans up certain backwards-compatible sequences, converting them @@@ -4658,6 -4683,7 +4658,7 @@@ * * @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 -4742,19 +4717,19 @@@ $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;