jenkins-bot has submitted this change and it was merged. Change subject: New Wikidata Build - 2015-08-30T10:00:01+0000 ......................................................................
New Wikidata Build - 2015-08-30T10:00:01+0000 Change-Id: I55c491d04c4c5aeb6cdbb3c99b0e47af1ee95433 --- M composer.lock M extensions/Quality/i18n/fr.json A extensions/Quality/i18n/ja.json M extensions/Quality/i18n/ksh.json M extensions/Quality/i18n/pl.json M extensions/Wikibase/client/i18n/kk-cyrl.json M extensions/Wikibase/client/i18n/sq.json A extensions/Wikibase/lib/i18n/myv.json M extensions/Wikibase/repo/i18n/as.json M extensions/Wikibase/repo/i18n/dty.json M extensions/Wikibase/repo/i18n/kk-cyrl.json M extensions/Wikibase/repo/i18n/ksh.json M extensions/Wikibase/repo/i18n/sq.json M extensions/Wikibase/repo/includes/specials/SpecialListProperties.php M extensions/Wikibase/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php M vendor/composer/installed.json 16 files changed, 196 insertions(+), 91 deletions(-) Approvals: JanZerebecki: Looks good to me, approved jenkins-bot: Verified diff --git a/composer.lock b/composer.lock index 9bacb01..37dba54 100644 --- a/composer.lock +++ b/composer.lock @@ -1293,7 +1293,7 @@ "source": { "type": "git", "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQuality", - "reference": "2ceb7c57f5fb8239eb56f339254caf2ce19161e6" + "reference": "619c61d0cbf0f8c36804f820dc0570581eb0d42d" }, "require": { "php": ">=5.3.0", @@ -1337,7 +1337,7 @@ "support": { "issues": "https://phabricator.wikimedia.org/project/profile/989/" }, - "time": "2015-08-27 19:40:19" + "time": "2015-08-29 19:48:01" }, { "name": "wikibase/serialization-javascript", @@ -1386,12 +1386,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "645cfd6694a107df376a6722d44199c6f26900c4" + "reference": "ab33b656d538b4bd0faec99d9e82ce0eda28cda5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/645cfd6694a107df376a6722d44199c6f26900c4", - "reference": "645cfd6694a107df376a6722d44199c6f26900c4", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/ab33b656d538b4bd0faec99d9e82ce0eda28cda5", + "reference": "ab33b656d538b4bd0faec99d9e82ce0eda28cda5", "shasum": "" }, "require": { @@ -1460,7 +1460,7 @@ "wikibaserepo", "wikidata" ], - "time": "2015-08-28 09:39:42" + "time": "2015-08-29 19:47:55" }, { "name": "wikibase/wikimedia-badges", diff --git a/extensions/Quality/i18n/fr.json b/extensions/Quality/i18n/fr.json index 0895ff1..7ff82dc 100644 --- a/extensions/Quality/i18n/fr.json +++ b/extensions/Quality/i18n/fr.json @@ -47,7 +47,7 @@ "apihelp-wbqmodifyviolation-param-constraintid": "Identifiant de la contrainte concernant la violation de données qui doit être modifiée. C’est, avec le ''claimguid'', ce qui permet d’identifier la violation.", "apihelp-wbqmodifyviolation-param-status": "Le nouvel état, qui doit être défini pour cette violation.", "apihelp-wbqmodifyviolation-examples-exception": "Changer le statut de la violation identifiée par l'identificateur de contrainte et avertir le GUID de l'exception.", - "apihelp-wbqmodifyviolation-examples-violation": "Changer l’état de la violation identifiée par l’identificateur de contrainte le GUID de la demande à violation.", + "apihelp-wbqmodifyviolation-examples-violation": "Changer l’état de la violation identifiée par l’identificateur de contrainte avertir le GUID de la violation.", "apihelp-wbqgetviolationtypes-description": "Renvoie une liste de toutes les types de violation reconnus.", "apihelp-wbqgetviolationtypes-param-groupid": "Un paramètre facultatif qui limite les types de violation à ceux qui sont associés au groupe indiqué.", "apihelp-wdqgetviolationtypes-examples-1": "Retourne tous les types de violation, sans restrictions.", diff --git a/extensions/Quality/i18n/ja.json b/extensions/Quality/i18n/ja.json new file mode 100644 index 0000000..eba79f6 --- /dev/null +++ b/extensions/Quality/i18n/ja.json @@ -0,0 +1,10 @@ +{ + "@metadata": { + "authors": [ + "Sujiniku" + ] + }, + "wbq-violations-invalid-entity-id": "その与えられたエンティティIDは無効です。", + "wbq-violations-invalid-property-id": "その与えられたプロパティIDは無効です。", + "wbq-violations-not-existent-property": "与えられた ID のプロパティが存在しません。" +} diff --git a/extensions/Quality/i18n/ksh.json b/extensions/Quality/i18n/ksh.json index e7d5c28..394e70c 100644 --- a/extensions/Quality/i18n/ksh.json +++ b/extensions/Quality/i18n/ksh.json @@ -14,9 +14,9 @@ "wbq-violations-exceptions-checkbox-label": "Ußnahme aanzeije", "wbq-violations-submit-button-label": "Verläzonge aanzeije", "wbq-violations-invalid-entity-id": "De aanjejovve Kännong es nit jöltesch.", - "wbq-violations-not-existent-entity": "En Saach met dä aanjejovve Kännong jidd_et nit!", + "wbq-violations-not-existent-entity": "En Saach met dä aanjejovve Kännong jidd_et nit.", "wbq-violations-invalid-property-id": "De aanjejovve Kännong för en Eijeschavv es nit jöltesch.", - "wbq-violations-not-existent-property": "En Eijeschaff met dä aanjejovve Kännong jidd_et nit!", + "wbq-violations-not-existent-property": "En Eijeschaff met dä aanjejovve Kännong jidd_et nit.", "wbq-violations-table-header-claim": "Behouptong", "wbq-violations-table-header-constraint-type": "Zoot", "wbq-violations-table-header-updated-at": "Et läz obb ene neue Schtand jebraat", @@ -31,7 +31,7 @@ "wbq-violations-prev-page": "← De Sigg dovör", "apihelp-wbqgetviolationmessages-param-entityid": "De Kännong vun en entity, woh de Verläzonge vun de Beschrängkonge vun de Wääte vun de Dahte opjeleß wähde sulle.", "apihelp-wbqgetviolationmessages-example": "Holl de Meddeijlonge för de Verläzonge vun de Dahte for dä item „<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\">Q76</code>“.", - "apihelp-wbqmodifyviolation-description": "Deihjt en beschtemmte Verläzong vun de Beschrängkonge vun de Wääte vun de Dahte änndere. Dat künne ävver blohß de Metmaacher med zopaß Rääschte maache.", + "apihelp-wbqmodifyviolation-description": "Deihjt en beschtemmte Verläzong vun de Beschrängkonge vun de Wääte vun de Dahte änndere. Dat künne ävver blohß de Metmaacher med zopaß Rääschde maache.", "apihelp-wbqmodifyviolation-param-status": "Dä neuje Zohschtand, dä för heh di Verläzong jesaz wähde sull.", "apihelp-wbqgetviolationtypes-description": "Livvert en Leß met alle ongeschtötß Zoote vun Verläzonge.", "apihelp-wbqgetviolationtypes-param-groupid": "Ene Parramehter, dä mer och fott lohße kann, dä de Zoote Verläzong op dat beschrängk, di met dä aanjejovve Jropp zersamme hange.", diff --git a/extensions/Quality/i18n/pl.json b/extensions/Quality/i18n/pl.json index b9ea956..42a6609 100644 --- a/extensions/Quality/i18n/pl.json +++ b/extensions/Quality/i18n/pl.json @@ -7,7 +7,7 @@ }, "wbq-violations-group-label": "Grupa:", "wbq-violations-exceptions-checkbox-label": "Pokaż wyjątki", - "wbq-violations-invalid-entity-id": "Dany identyfikator encji nie jest nieprawidłowy.", + "wbq-violations-invalid-entity-id": "Dany identyfikator encji jest nieprawidłowy.", "wbq-violations-invalid-property-id": "Dany identyfikator właściwości jest nieprawidłowy.", "wbq-violations-not-existent-property": "Właściwość o podanym identyfikatorze nie istnieje.", "wbq-violations-table-header-status": "Status", @@ -15,6 +15,5 @@ "wbq-violations-status-exception": "Wyjątek", "wbq-violations-mark-as-exception": "Oznacz jako wyjątek", "wbq-violations-next-page": "Następna strona >>", - "wbq-violations-prev-page": "<< Poprzednia strona", - "wbq-violations-permission-denied": "Nie masz uprawnień do zmiany tego nadużycia!" + "wbq-violations-prev-page": "<< Poprzednia strona" } diff --git a/extensions/Wikibase/client/i18n/kk-cyrl.json b/extensions/Wikibase/client/i18n/kk-cyrl.json index 55fe368..6fc8f34 100644 --- a/extensions/Wikibase/client/i18n/kk-cyrl.json +++ b/extensions/Wikibase/client/i18n/kk-cyrl.json @@ -13,7 +13,7 @@ "wikibase-comment-linked": "{{WBREPONAME}} данасы бұл бетке сілтенді.", "wikibase-comment-unlink": "Бұл бет {{WBREPONAME}} данасымен сілтенбеді. Тіл сілтемелері аласталды.", "wikibase-comment-restore": "Байланысқан {{WBREPONAME}} данасы жойылмады. Тіл сілтемелері қалпына келтірілді.", - "wikibase-comment-update": "{{WBREPONAME}} данасын өзгерті", + "wikibase-comment-update": "{{WBREPONAME}} данасын өзгертті", "wikibase-comment-sitelink-add": "Тіл сілтемесі қосылды: $1", "wikibase-comment-sitelink-change": "Тіл сілтемесін $1 дегеннен $2 дегенге өзгертті", "wikibase-comment-sitelink-remove": "Тіл сілтемесін аласталды: $1", @@ -42,8 +42,7 @@ "wikibase-rc-wikibase-edit-letter": "Д", "wikibase-rc-wikibase-edit-title": "{{WBREPONAME}} өңдемесі", "wikibase-watchlist-show-changes-pref": "{{WBREPONAME}} өңдемелерін бақылау тізіміңізден көрсету", - "special-unconnectedpages": "Беттер даналарға байланыспады", - "wikibase-unconnectedpages-legend": "Байланыспаған беттер параметрлері", + "unconnectedpages": "Беттер даналарға байланыспады", "wikibase-unconnectedpages-page": "Беттегі тізім нәтижелерін бастау:", "wikibase-unconnectedpages-submit": "Өту", "wikibase-unconnectedpages-invalid-language": "\"$1\" жарамды тіл коды емес.", diff --git a/extensions/Wikibase/client/i18n/sq.json b/extensions/Wikibase/client/i18n/sq.json index 82ae436..218bf92 100644 --- a/extensions/Wikibase/client/i18n/sq.json +++ b/extensions/Wikibase/client/i18n/sq.json @@ -1,9 +1,11 @@ { "@metadata": { "authors": [ - "Liridon" + "Liridon", + "Olsi" ] }, + "tooltip-t-wikibase": "Link deri tek artikulli i depos të të dhënave të lidhura", "wikibase-comment-update": "Artikulli {{WBREPONAME}} u ndryshua", "wikibase-dataitem": "Artikulli {{WBREPONAME}}", "wikibase-editlinks": "Redakto lidhjet", @@ -12,6 +14,6 @@ "wikibase-rc-hide-wikidata-hide": "Fshih", "wikibase-rc-hide-wikidata-show": "Shfaq", "wikibase-rc-wikibase-edit-letter": "D", - "wikibase-rc-wikibase-edit-title": "Redakto {{WBREPONAME}}", + "wikibase-rc-wikibase-edit-title": "Redaktim {{WBREPONAME}}", "wikibase-otherprojects": "Projekte të tjera" } diff --git a/extensions/Wikibase/lib/i18n/myv.json b/extensions/Wikibase/lib/i18n/myv.json new file mode 100644 index 0000000..27b26eb --- /dev/null +++ b/extensions/Wikibase/lib/i18n/myv.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Denö" + ] + }, + "wikibase-sitelinks-wikipedia": "Википеди" +} diff --git a/extensions/Wikibase/repo/i18n/as.json b/extensions/Wikibase/repo/i18n/as.json index 7b58b56..0e141de 100644 --- a/extensions/Wikibase/repo/i18n/as.json +++ b/extensions/Wikibase/repo/i18n/as.json @@ -3,13 +3,14 @@ "authors": [ "Gitartha.bordoloi", "Psneog", - "IKHazarika" + "IKHazarika", + "Dibya Dutta" ] }, "wikibase-edit": "সম্পাদনা", "wikibase-add": "যোগ কৰক", "wikibase-label-empty": "কোনো লেবেলৰ সংজ্ঞা প্ৰদান কৰা হোৱা নাই", - "wikibase-description-empty": "এতিয়ালৈকে বিবৰণৰ সংজ্ঞা প্ৰদান কৰা হোৱা নাই", + "wikibase-description-empty": "কোনো বিবৰণৰ সংজ্ঞা প্ৰদান কৰা হোৱা নাই", "wikibase-statements": "বিবৃতিসমূহ", "wikibase-sitelinks-special": "আন চাইটসমূহ", "wikibase-aliases-empty": "কোনো উপনামৰ সংজ্ঞা প্ৰদান কৰা হোৱা নাই।", diff --git a/extensions/Wikibase/repo/i18n/dty.json b/extensions/Wikibase/repo/i18n/dty.json index d01232c..f5ed7fb 100644 --- a/extensions/Wikibase/repo/i18n/dty.json +++ b/extensions/Wikibase/repo/i18n/dty.json @@ -10,6 +10,7 @@ "wikibase-add": "जोड्या", "wikibase-entitytermsview-entitytermsforlanguagelistview-toggler": "अन्य भाषामी", "wikibase-label-empty": "नामपत्र परिभाषित कोई", + "wikibase-description-empty": "कसैलै बिवरणलाई परिभाषित नगरया |", "wikibase-statements": "बयान", "wikibase-terms": "अन्य भाषामी", "wikibase-sitelinks-special": "और साइटहरू", diff --git a/extensions/Wikibase/repo/i18n/kk-cyrl.json b/extensions/Wikibase/repo/i18n/kk-cyrl.json index 16b3146..4db8d18 100644 --- a/extensions/Wikibase/repo/i18n/kk-cyrl.json +++ b/extensions/Wikibase/repo/i18n/kk-cyrl.json @@ -59,7 +59,6 @@ "wikibase-propertyedittool-counter-pending-tooltip": "{{PLURAL:$1|бір мән|$1 мәндер}} сақталмады", "wikibase-propertyedittool-counter-entrieslabel": "{{PLURAL:$1|енгізілім|енгізілім}}", "wikibase-disambiguation-title": "\"$1\" үшін айрық бет", - "wikibase-aliases-label": "Сондай-ақ, ретінде белгілі:", "wikibase-propertypage-datatype": "Дерек түрі", "wikibase-statementview-rank-preferred": "Қалаған ранк", "wikibase-statementview-rank-normal": "Жай ранк", @@ -173,7 +172,7 @@ "wikibase-item-summary-wbeditentity-create": "also", "wikibase-item-summary-wbeditentity-update": "Элемент өзгертілді", "wikibase-item-summary-wbsetlabel-add": "[$2] шені қосылды", - "wikibase-item-summary-wbsetlabel-set": "[$2] деңгейін өзгерті", + "wikibase-item-summary-wbsetlabel-set": "[$2] деңгейін өзгертті", "wikibase-item-summary-wbsetlabel-remove": "[$2] деңгейі алынып тасталды", "wikibase-item-summary-wbsetdescription-add": "[$2] сипаттамасы қосылды", "wikibase-item-summary-wbsetdescription-set": "[$2] сипаттамасы өзгертілді", diff --git a/extensions/Wikibase/repo/i18n/ksh.json b/extensions/Wikibase/repo/i18n/ksh.json index 48373dc..6418074 100644 --- a/extensions/Wikibase/repo/i18n/ksh.json +++ b/extensions/Wikibase/repo/i18n/ksh.json @@ -121,7 +121,7 @@ "wikibase-redirectentity-submit": "Ömleide", "wikibase-mylanguagefallbackchain-babel": "Do kanns se ändere. Don derför <nowiki>{{#babel:}}</nowiki> en {{GENDER:$1|Ding}} [[Special:MyPage|Metmaachersigg]] enboue.", "wikibase-mylanguagefallbackchain-converted-item": "$1 - $2, ömjewanndelt vun $3 - $4", - "wikibase-api-unresolved-redirect": "De aanjejovve Kännong betrick sesch obb_en Ömleidong, wat heh en däm Zosammehang nit ongerschtöz weed.", + "wikibase-api-unresolved-redirect": "De aanjejovve Kännong betrek sesch obb_en Ömleidong, wat heh en däm Zosammehang nit ongerschtöz weed.", "wikibase-api-target-is-redirect": "Dä Omleidong ier zihl darf sällver kein Ömleidong sin.", "wikibase-restoreold": "zeröckholle", "wikibase-restore-summary": "Holl de Väsjohn $1 {{GENDER:$2|dä|dat|dä Metmaacher|de|dat}} [[Special:Contributions/$2|$2]] zerök.", diff --git a/extensions/Wikibase/repo/i18n/sq.json b/extensions/Wikibase/repo/i18n/sq.json index d205908..16eac09 100644 --- a/extensions/Wikibase/repo/i18n/sq.json +++ b/extensions/Wikibase/repo/i18n/sq.json @@ -1,13 +1,15 @@ { "@metadata": { "authors": [ - "Liridon" + "Liridon", + "Ammartivari" ] }, "wikibase-edit": "redakto", "wikibase-add": "shto", + "wikibase-label-empty": "Nuk ka emërtim të përkufizuar", "wikibase-description-empty": "Asnjë përshkrim i përcaktuar", - "wikibase-statements": "Deklaratat", + "wikibase-statements": "Qëndrime", "wikibase-sitelinks-special": "Faqe të tjera", "wikibase-aliases-empty": "Nuk ka emërtim të përkufizuar", "wikibase-statementview-rank-normal": "Rangimi normal", diff --git a/extensions/Wikibase/repo/includes/specials/SpecialListProperties.php b/extensions/Wikibase/repo/includes/specials/SpecialListProperties.php index 2d55c3c..d6c5513 100644 --- a/extensions/Wikibase/repo/includes/specials/SpecialListProperties.php +++ b/extensions/Wikibase/repo/includes/specials/SpecialListProperties.php @@ -4,11 +4,19 @@ use DataTypes\DataTypeFactory; use Html; +use OutOfBoundsException; +use Title; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\Services\EntityId\EntityIdFormatter; +use Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup; use Wikibase\DataTypeSelector; +use Wikibase\LanguageFallbackChainFactory; +use Wikibase\Lib\Store\EntityTitleLookup; +use Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookup; use Wikibase\PropertyInfoStore; -use Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory; use Wikibase\Repo\WikibaseRepo; +use Wikibase\Store\BufferingTermLookup; use Wikibase\View\EntityIdFormatterFactory; /** @@ -17,6 +25,7 @@ * @since 0.5 * @licence GNU GPL v2+ * @author Bene* < benestar.wikime...@gmail.com > + * @author Adam Shorland */ class SpecialListProperties extends SpecialWikibaseQueryPage { @@ -38,19 +47,29 @@ private $propertyInfoStore; /** - * @var EntityIdFormatterFactory + * @var LanguageFallbackLabelDescriptionLookup */ - private $entityIdFormatterFactory; - - /** - * @var LanguageFallbackLabelDescriptionLookupFactory - */ - private $labelDescriptionLookupFactory; + private $labelDescriptionLookup; /** * @var string */ private $dataType; + + /** + * @var EntityIdFormatter + */ + private $entityIdFormatter; + + /** + * @var EntityTitleLookup + */ + private $titleLookup; + + /** + * @var BufferingTermLookup + */ + private $bufferingTermLookup; public function __construct() { parent::__construct( 'ListProperties' ); @@ -61,7 +80,9 @@ $wikibaseRepo->getDataTypeFactory(), $wikibaseRepo->getStore()->getPropertyInfoStore(), $wikibaseRepo->getEntityIdHtmlLinkFormatterFactory(), - $wikibaseRepo->getLanguageFallbackLabelDescriptionLookupFactory() + $wikibaseRepo->getLanguageFallbackChainFactory(), + $wikibaseRepo->getEntityTitleLookup(), + $wikibaseRepo->getBufferingTermLookup() ); } @@ -73,12 +94,27 @@ DataTypeFactory $dataTypeFactory, PropertyInfoStore $propertyInfoStore, EntityIdFormatterFactory $entityIdFormatterFactory, - LanguageFallbackLabelDescriptionLookupFactory $labelDescriptionLookupFactory + LanguageFallbackChainFactory $languageFallbackChainFactory, + EntityTitleLookup $titleLookup, + BufferingTermLookup $bufferingTermLookup ) { + $this->labelDescriptionLookup = new LanguageFallbackLabelDescriptionLookup( + $bufferingTermLookup, + $languageFallbackChainFactory->newFromLanguage( + $this->getLanguage(), + LanguageFallbackChainFactory::FALLBACK_SELF + | LanguageFallbackChainFactory::FALLBACK_VARIANTS + | LanguageFallbackChainFactory::FALLBACK_OTHERS + ) + ); + $this->dataTypeFactory = $dataTypeFactory; $this->propertyInfoStore = $propertyInfoStore; - $this->entityIdFormatterFactory = $entityIdFormatterFactory; - $this->labelDescriptionLookupFactory = $labelDescriptionLookupFactory; + $this->entityIdFormatter = $entityIdFormatterFactory->getEntityIdFormater( + $this->labelDescriptionLookup + ); + $this->titleLookup = $titleLookup; + $this->bufferingTermLookup = $bufferingTermLookup; } /** @@ -173,29 +209,50 @@ ); } - protected function showQuery( array $query = array() ) { - $propertyIds = $this->getResult(); - - if ( empty( $propertyIds ) ) { - $this->getOutput()->addWikiMsg( 'specialpage-empty' ); - return; + /** + * Formats a row for display. + * + * @param PropertyId $propertyId + * + * @return string + */ + protected function formatRow( $propertyId ) { + $title = $this->titleLookup->getTitleForId( $propertyId ); + if ( !$title->exists() ) { + return $this->entityIdFormatter->formatEntityId( $propertyId ); } - $labelDescriptionLookup = $this->labelDescriptionLookupFactory->newLabelDescriptionLookup( - $this->getLanguage(), - $propertyIds + $row = $this->getIdHtml( $propertyId, $title ); + try { + $label = $this->labelDescriptionLookup->getLabel( $propertyId )->getText(); + $row .= wfMessage( 'colon-separator' )->escaped() . $label; + } catch ( OutOfBoundsException $e ) { + // If there is no label do not add it + } + + return $row; + } + + /** + * Returns HTML representing the label in the display language (or an appropriate fallback). + * + * @param EntityId|null $entityId + * @param Title|null $title + * + * @return string HTML + */ + private function getIdHtml( EntityId $entityId = null, $title ) { + $idElement = Html::element( + 'a', + array( + 'title' => $title ? $title->getPrefixedText() : $entityId->getSerialization(), + 'href' => $title ? $title->getLocalURL() : '', + 'class' => 'wb-itemlink-id' + ), + $entityId->getSerialization() ); - $formatter = $this->entityIdFormatterFactory->getEntityIdFormater( $labelDescriptionLookup ); - - $html = Html::openElement( 'ul' ); - - foreach ( $propertyIds as $propertyId ) { - $html .= Html::rawElement( 'li', array(), $formatter->formatEntityId( $propertyId ) ); - } - - $html .= Html::closeElement( 'ul' ); - $this->getOutput()->addHTML( $html ); + return $idElement; } /** @@ -205,19 +262,34 @@ * @return PropertyId[] */ protected function getResult( $offset = 0, $limit = 0 ) { - if ( $this->dataType === '' ) { - $propertyInfoForDataType = $this->propertyInfoStore->getAllPropertyInfo(); - } else { - $propertyInfoForDataType = $this->propertyInfoStore->getPropertyInfoForDataType( $this->dataType ); - } + $propertyInfo = array_slice( $this->getPropertyInfo(), $offset, $limit, true ); $propertyIds = array(); - foreach ( $propertyInfoForDataType as $numericId => $info ) { + foreach ( $propertyInfo as $numericId => $info ) { $propertyIds[] = PropertyId::newFromNumber( $numericId ); } + $this->bufferingTermLookup->prefetchTerms( $propertyIds ); + return $propertyIds; } + /** + * @return array[] An associative array mapping property IDs to info arrays. + */ + private function getPropertyInfo() { + if ( $this->dataType === '' ) { + $propertyInfo = $this->propertyInfoStore->getAllPropertyInfo(); + } else { + $propertyInfo = $this->propertyInfoStore->getPropertyInfoForDataType( + $this->dataType + ); + } + + // NOTE: $propertyInfo uses numerical property IDs as keys! + ksort( $propertyInfo ); + return $propertyInfo; + } + } diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php index 0b486d1..c769b06 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php @@ -8,12 +8,14 @@ use Title; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\Services\Lookup\TermLookup; use Wikibase\LanguageFallbackChainFactory; use Wikibase\Lib\LanguageNameLookup; +use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\PropertyInfoStore; use Wikibase\Repo\EntityIdHtmlLinkFormatterFactory; -use Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory; use Wikibase\Repo\Specials\SpecialListProperties; +use Wikibase\Store\BufferingTermLookup; /** * @covers Wikibase\Repo\Specials\SpecialListProperties @@ -25,6 +27,7 @@ * * @licence GNU GPL v2+ * @author Bene* < benestar.wikime...@gmail.com > + * @author Adam Shorland */ class SpecialListPropertiesTest extends SpecialPageTestBase { @@ -50,8 +53,8 @@ $propertyInfoStore = new MockPropertyInfoStore(); $propertyInfoStore->setPropertyInfo( - new PropertyId( 'P123' ), - array( PropertyInfoStore::KEY_DATA_TYPE => 'wikibase-item' ) + new PropertyId( 'P789' ), + array( PropertyInfoStore::KEY_DATA_TYPE => 'string' ) ); $propertyInfoStore->setPropertyInfo( @@ -60,32 +63,33 @@ ); $propertyInfoStore->setPropertyInfo( - new PropertyId( 'P789' ), - array( PropertyInfoStore::KEY_DATA_TYPE => 'string' ) + new PropertyId( 'P123' ), + array( PropertyInfoStore::KEY_DATA_TYPE => 'wikibase-item' ) ); return $propertyInfoStore; } - private function getTermLookup() { - $termLookup = $this->getMock( 'Wikibase\DataModel\Services\Lookup\TermLookup' ); - $termLookup->expects( $this->any() ) + /** + * @return BufferingTermLookup + */ + private function getBufferingTermLookup() { + $lookup = $this->getMockBuilder( 'Wikibase\Store\BufferingTermLookup' ) + ->disableOriginalConstructor() + ->getMock(); + $lookup->expects( $this->any() ) + ->method( 'prefetchTerms' ); + $lookup->expects( $this->any() ) ->method( 'getLabels' ) ->will( $this->returnCallback( function( PropertyId $propertyId ) { return array( 'en' => 'Property with label ' . $propertyId->getSerialization() ); } ) ); - - return $termLookup; + return $lookup; } - private function getTermBuffer() { - $termBuffer = $this->getMock( 'Wikibase\Store\TermBuffer' ); - $termBuffer->expects( $this->any() ) - ->method( 'prefetchTerms' ); - - return $termBuffer; - } - + /** + * @return EntityTitleLookup + */ private function getEntityTitleLookup() { $entityTitleLookup = $this->getMock( 'Wikibase\Lib\Store\EntityTitleLookup' ); $entityTitleLookup->expects( $this->any() ) @@ -106,11 +110,9 @@ $this->getDataTypeFactory(), $this->getPropertyInfoStore(), new EntityIdHtmlLinkFormatterFactory( $this->getEntityTitleLookup(), new LanguageNameLookup() ), - new LanguageFallbackLabelDescriptionLookupFactory( - new LanguageFallbackChainFactory(), - $this->getTermLookup(), - $this->getTermBuffer() - ) + new LanguageFallbackChainFactory(), + $this->getEntityTitleLookup(), + $this->getBufferingTermLookup() ); return $specialPage; @@ -125,6 +127,16 @@ $this->assertContains( 'wikibase-listproperties-summary', $output ); $this->assertContains( 'wikibase-listproperties-legend', $output ); $this->assertNotContains( 'wikibase-listproperties-invalid-datatype', $output ); + $this->assertRegExp( '/P123.*P456.*P789/', $output ); // order is relevant + } + + public function testOffsetAndLimit() { + $request = new \FauxRequest( array( 'limit' => '1', 'offset' => '1' ) ); + list( $output, ) = $this->executeSpecialPage( '', $request ); + + $this->assertNotContains( 'P123', $output ); + $this->assertContains( 'P456', $output ); + $this->assertNotContains( 'P789', $output ); } public function testExecute_empty() { diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index f815430..a6057df 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1279,12 +1279,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "645cfd6694a107df376a6722d44199c6f26900c4" + "reference": "ab33b656d538b4bd0faec99d9e82ce0eda28cda5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/645cfd6694a107df376a6722d44199c6f26900c4", - "reference": "645cfd6694a107df376a6722d44199c6f26900c4", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/ab33b656d538b4bd0faec99d9e82ce0eda28cda5", + "reference": "ab33b656d538b4bd0faec99d9e82ce0eda28cda5", "shasum": "" }, "require": { @@ -1315,7 +1315,7 @@ "require-dev": { "squizlabs/php_codesniffer": "~2.1" }, - "time": "2015-08-28 09:39:42", + "time": "2015-08-29 19:47:55", "type": "mediawiki-extension", "installation-source": "dist", "autoload": { @@ -1448,7 +1448,7 @@ "source": { "type": "git", "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQuality", - "reference": "2ceb7c57f5fb8239eb56f339254caf2ce19161e6" + "reference": "619c61d0cbf0f8c36804f820dc0570581eb0d42d" }, "require": { "php": ">=5.3.0", @@ -1460,7 +1460,7 @@ "phpunit/phpunit": "^3.7.37|~4.5", "satooshi/php-coveralls": "master-dev" }, - "time": "2015-08-27 19:40:19", + "time": "2015-08-29 19:48:01", "type": "mediawiki-extension", "installation-source": "source", "autoload": { -- To view, visit https://gerrit.wikimedia.org/r/234841 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I55c491d04c4c5aeb6cdbb3c99b0e47af1ee95433 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikidata Gerrit-Branch: master Gerrit-Owner: WikidataBuilder <wikidata-servi...@wikimedia.de> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: JanZerebecki <jan.wikime...@zerebecki.de> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits