WikidataBuilder has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/367374 )
Change subject: New Wikidata Build - 2017-07-24T10:00:02+0000 ...................................................................... New Wikidata Build - 2017-07-24T10:00:02+0000 Change-Id: I7a02af92fd7d2f610a39a59c6b8bda8fb46a477d --- M composer.lock M extensions/ArticlePlaceholder/i18n/pt-br.json M extensions/Constraints/extension.json M extensions/Constraints/i18n/ar.json M extensions/Constraints/i18n/ast.json A extensions/Constraints/i18n/be.json M extensions/Constraints/i18n/de.json M extensions/Constraints/i18n/en.json M extensions/Constraints/i18n/es.json M extensions/Constraints/i18n/eu.json M extensions/Constraints/i18n/fr.json M extensions/Constraints/i18n/he.json M extensions/Constraints/i18n/ko.json M extensions/Constraints/i18n/lb.json M extensions/Constraints/i18n/pt-br.json M extensions/Constraints/i18n/pt.json M extensions/Constraints/i18n/qqq.json M extensions/Constraints/i18n/zh-hans.json M extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php M extensions/Constraints/includes/ConstraintCheck/Helper/ConstraintParameterParser.php M extensions/Constraints/includes/ConstraintCheck/Result/CheckResult.php M extensions/Constraints/includes/ConstraintRepository.php M extensions/Constraints/modules/SpecialConstraintReportPage.css M extensions/Constraints/modules/gadget.js M extensions/Constraints/tests/phpunit/Api/CheckConstraintsTest.php M extensions/Constraints/tests/phpunit/DelegatingConstraintCheckerTest.php M extensions/Constraints/tests/phpunit/Helper/ConstraintParameterParserTest.php M extensions/Constraints/tests/phpunit/Specials/SpecialConstraintReportTest.php M extensions/Wikibase/client/i18n/pt-br.json M extensions/Wikibase/client/i18n/skr-arab.json M extensions/Wikibase/composer.json M extensions/Wikibase/lib/i18n/pt-br.json M extensions/Wikibase/lib/includes/Store/WikiPagePropertyOrderProvider.php M extensions/Wikibase/repo/Wikibase.hooks.php M extensions/Wikibase/repo/Wikibase.php M extensions/Wikibase/repo/i18n/en.json M extensions/Wikibase/repo/i18n/qqq.json M extensions/Wikibase/repo/i18n/skr-arab.json M extensions/Wikibase/repo/includes/Api/ApiErrorReporter.php M extensions/Wikibase/repo/includes/Api/EntityLoadingHelper.php M extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php M extensions/Wikibase/repo/includes/Api/GetEntities.php M extensions/Wikibase/repo/includes/ChangeOp/Deserialization/SiteLinkBadgeChangeOpSerializationValidator.php M extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputGenerator.php M extensions/Wikibase/repo/includes/Store/Sql/SqlStore.php M extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php M extensions/Wikibase/repo/maintenance/dispatchChanges.php M extensions/Wikibase/repo/tests/phpunit/includes/Api/EntityLoadingHelperTest.php M extensions/Wikibase/repo/tests/phpunit/includes/RepoHooksTest.php M extensions/Wikibase/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php M vendor/composer/installed.json 51 files changed, 494 insertions(+), 86 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata refs/changes/74/367374/1 diff --git a/composer.lock b/composer.lock index 8098f23..b47ff09 100644 --- a/composer.lock +++ b/composer.lock @@ -756,12 +756,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-ArticlePlaceholder.git", - "reference": "31e27f4c8eb0e94c042b985ffe574c6fcfb5113f" + "reference": "71904258618ca4818790cc71b0e965d3bb9bfe7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/31e27f4c8eb0e94c042b985ffe574c6fcfb5113f", - "reference": "31e27f4c8eb0e94c042b985ffe574c6fcfb5113f", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/71904258618ca4818790cc71b0e965d3bb9bfe7a", + "reference": "71904258618ca4818790cc71b0e965d3bb9bfe7a", "shasum": "" }, "require": { @@ -790,7 +790,7 @@ ], "description": "Provides a special page with Wikibase information about a certain topic, with invitation to create an article for the topic", "homepage": "https://www.mediawiki.org/wiki/Extension:ArticlePlaceholder", - "time": "2017-07-20 20:33:52" + "time": "2017-07-22 20:26:23" }, { "name": "propertysuggester/property-suggester", @@ -966,7 +966,7 @@ "source": { "type": "git", "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQualityConstraints", - "reference": "5c1eaffb37a25649621c9a3388387f84f3ca3f0d" + "reference": "dcb71e325e2e8b4e390ccbc676b22c0090a0acc8" }, "require": { "php": ">=5.5.9", @@ -1027,7 +1027,7 @@ "support": { "issues": "https://phabricator.wikimedia.org/project/profile/1202/" }, - "time": "2017-07-20 23:29:02" + "time": "2017-07-22 21:03:19" }, { "name": "wikibase/data-model", @@ -1540,12 +1540,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "0dcf45a2c0ca49f6ef18daade6944e636cac7ad8" + "reference": "de6d3c795b8e0f5d255f47006817b34fe0ad1c2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/0dcf45a2c0ca49f6ef18daade6944e636cac7ad8", - "reference": "0dcf45a2c0ca49f6ef18daade6944e636cac7ad8", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/de6d3c795b8e0f5d255f47006817b34fe0ad1c2c", + "reference": "de6d3c795b8e0f5d255f47006817b34fe0ad1c2c", "shasum": "" }, "require": { @@ -1568,7 +1568,7 @@ "wikibase/internal-serialization": "^2.2.0", "wikibase/javascript-api": "^2.2.2", "wikibase/serialization-javascript": "^2.0.8", - "wikimedia/purtle": "^1.0.3" + "wikimedia/purtle": "^1.0.6" }, "conflict": { "mediawiki/mediawiki": "<1.25" @@ -1621,7 +1621,7 @@ "wikibaserepo", "wikidata" ], - "time": "2017-07-21 07:21:50" + "time": "2017-07-23 12:04:25" }, { "name": "wikibase/wikimedia-badges", diff --git a/extensions/ArticlePlaceholder/i18n/pt-br.json b/extensions/ArticlePlaceholder/i18n/pt-br.json index 4dd2d62..ef7a5e6 100644 --- a/extensions/ArticlePlaceholder/i18n/pt-br.json +++ b/extensions/ArticlePlaceholder/i18n/pt-br.json @@ -19,5 +19,6 @@ "articleplaceholder-abouttopic-lua-entity": "Entidade", "articleplaceholder-abouttopic-lua-reference": "Referência", "articleplaceholder-abouttopic-lua-identifier": "Recursos externos", + "articleplaceholder-search-header": "Descobrir dados no tópico", "articleplaceholder-createpage-title": "Criado $1" } diff --git a/extensions/Constraints/extension.json b/extensions/Constraints/extension.json index d4088bc..8ec7705 100644 --- a/extensions/Constraints/extension.json +++ b/extensions/Constraints/extension.json @@ -61,7 +61,9 @@ "wbqc-badparameters-short", "wbqc-badparameters-long", "wbqc-parameterissues-short", - "wbqc-parameterissues-long" + "wbqc-parameterissues-long", + "wbqc-problems-short", + "wbqc-problems-long" ], "scripts": [ "modules/ui/module.js", @@ -136,6 +138,16 @@ "description": "The property ID of the 'exception to constraint' property (data type: item), which specifies the exceptions of a constraint.", "public": true }, + "WBQualityConstraintsConstraintStatusId": { + "value": "P2316", + "description": "The property ID of the 'constraint status' property (data type: item), which specifies the constraint status of a constraint statement. Currently, only one constraint status is known (see WBQualityConstraintsMandatoryConstraintId), and the default status is signified by the absence of a 'constraint status' qualifier.", + "public": true + }, + "WBQualityConstraintsMandatoryConstraintId": { + "value": "Q21502408", + "description": "The item ID of the 'mandatory constraint' item, which, when used in a 'constraint status' qualifier of a 'property constraint' statement on a property, indicates that the constraint is mandatory and should have no violations except for the known exceptions.", + "public": true + }, "WBQualityConstraintsDistinctValuesConstraintId": { "value": "Q21502410", "description": "The item ID of the 'distinct values constraint' item, which, when used in a 'property constraint' statement on a property, indicates that all values for this property should differ from each other, or, equivalently, that each value for this property should be unique to one item.", diff --git a/extensions/Constraints/i18n/ar.json b/extensions/Constraints/i18n/ar.json index 0b6dc54..7fd745c 100644 --- a/extensions/Constraints/i18n/ar.json +++ b/extensions/Constraints/i18n/ar.json @@ -8,8 +8,31 @@ "wbqc-constraintreport-explanation-part-one": "هذه الصفحة الخاصة تقوم بتدقيق القيود المفروضة على الخواص المستخدمة في أي عنصر ويكي بيانات ترغب بفحصه، أي قيمة يتم إصلاحها سيتم إزالتها من القائمة فوراً.", "wbqc-constraintreport-explanation-part-two": "يتم تحليل قيود استخدام الخواص من صفحات نقاشها مرة واحدة في الأسبوع، لذت إذا قمت بإضافة أو حذف أو تعديل تلك القيود فإن ذلك ربما يستغرق أسبوعاً حتى يتم العمل به في هذه الصفحة الخاصة.\nهناك حالياً عمل قيد التنفيذ يهدف لترحيل تلك القيود إلى بيانات تضاف إلى الخواص مباشرة، وذلك لتمكين هذه الصفحة الخاصة من القيام بعملية التدقيق بشكل مباشر.", "wbqc-constraintreport-form-section": "تحقق من قيود عنصر", + "wbqc-constraintreport-form-submit-label": "فحص", "wbqc-constraintreport-form-entityid-label": "معرف العنصر:", "wbqc-constraintreport-result-headline": "النتيجة لـ", + "wbqc-constraintreport-invalid-entity-id": "معرف الكيان غير صالح.", + "wbqc-constraintreport-not-existent-entity": "الكيان غير موجود.", + "wbqc-constraintreport-empty-result": "لا توجد قيود محددة على هذا الكيان.", + "wbqc-constraintreport-status-violation": "مخالف", "wbqc-constraintreport-status-compliance": "مطابق", - "wbqc-constraintreport-status-todo": "بحاجة للعمل" + "wbqc-constraintreport-status-exception": "استثناء", + "wbqc-constraintreport-status-todo": "بحاجة للعمل", + "wbqc-constraintreport-status-bad-parameters": "معلمات سيئة", + "wbqc-constraintreport-status-deprecated": "مستغنى عنه", + "wbqc-constraintreport-status-warning": "تحذير", + "wbqc-constraintreport-result-table-header-status": "الحالة", + "wbqc-constraintreport-result-table-header-claim": "ادعاء", + "wbqc-constraintreport-result-table-header-constraint": "محددات", + "wbqc-constraintreport-result-link-to-claim": "اذهب إلى الادعاء", + "wbqc-constraintreport-result-link-to-constraint": "اذهب إلى المحددات", + "wbqc-constraintreport-no-parameter": "لا شيء", + "wbqc-potentialissues-short": "قضايا محتملة", + "wbqc-potentialissues-long": "يحتوي هذا البيان على بعض القضايا المحتملة.", + "wbqc-badparameters-short": "معلمات سيئة", + "wbqc-badparameters-long": "يحتوي بيان المحددات على بعض المعلمات غير صالحة.", + "wbqc-problems-short": "مشاكل", + "wbqc-problems-long": "هذا البيان لديه بعض المشاكل.", + "wbq-subextension-name-wbqc": "محددات", + "wbqc-violations-group": "محددات" } diff --git a/extensions/Constraints/i18n/ast.json b/extensions/Constraints/i18n/ast.json index a8cbdf5..a637d4c 100644 --- a/extensions/Constraints/i18n/ast.json +++ b/extensions/Constraints/i18n/ast.json @@ -7,7 +7,7 @@ "wbqc-constraintreport": "Informe de torgues", "wbqc-desc": "Comprueba les torgues nos elementos y propiedaes y amuesa los resultaos n'una páxina especial", "wbqc-constraintreport-explanation-part-one": "Esta páxina especial fai comprobaciones de torgues na entidá que quieras. Les entidaes sáquense del sistema real, de mou que cada violación de torgues qu'igües desaniciaráse nel intre d'esta llista.", - "wbqc-constraintreport-explanation-part-two": "Les torgues analícense dende les páxines d'alderique de les propiedaes una vez por selmana, polo que si amiestes, desanicies o camudes una torga, podría tardar fasta una selmana pa que se tenga en cuenta nesti informe de torgues. Anguaño hai trabayos en marcha pa migrar de les torgues a declaraciones nes propiedaes, pa permitir qu'esta páxina especial faiga comprobaciones en vivo.", + "wbqc-constraintreport-explanation-part-two": "Les torgues analícense dende les declaraciones de les propiedaes cada vegada que s'editen eses declaraciones, de vezu a los pocos minutos.", "wbqc-constraintreport-form-section": "Comprobar les torgues d'entidá", "wbqc-constraintreport-form-submit-label": "Comprobar", "wbqc-constraintreport-form-entityid-label": "ID de la entidá:", @@ -19,6 +19,9 @@ "wbqc-constraintreport-status-compliance": "Cumple", "wbqc-constraintreport-status-exception": "Esceición", "wbqc-constraintreport-status-todo": "Pendiente", + "wbqc-constraintreport-status-bad-parameters": "Parámetros incorreutos", + "wbqc-constraintreport-status-deprecated": "Desusao", + "wbqc-constraintreport-status-warning": "Avisu", "wbqc-constraintreport-result-table-header-status": "Estáu", "wbqc-constraintreport-result-table-header-claim": "Declaración", "wbqc-constraintreport-result-table-header-constraint": "Torga", @@ -27,6 +30,10 @@ "wbqc-constraintreport-no-parameter": "nengunu", "wbqc-potentialissues-short": "Problemes en potencia", "wbqc-potentialissues-long": "Esta declaración tien posibles incidencies.", + "wbqc-badparameters-short": "Parámetros incorreutos", + "wbqc-badparameters-long": "Esta declaración de torga tien dellos parámetros inválidos.", + "wbqc-problems-short": "Problemes", + "wbqc-problems-long": "Esta declaración tien dellos problemes.", "wbq-subextension-name-wbqc": "Torgues", "wbqc-violation-header-parameters": "Parámetros:", "wbqc-violations-group": "Torgues", diff --git a/extensions/Constraints/i18n/be.json b/extensions/Constraints/i18n/be.json new file mode 100644 index 0000000..c3c8dc2 --- /dev/null +++ b/extensions/Constraints/i18n/be.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Da voli" + ] + }, + "wbqc-constraintreport-status-warning": "Папярэджанне" +} diff --git a/extensions/Constraints/i18n/de.json b/extensions/Constraints/i18n/de.json index 234f9bb..3757d2d 100644 --- a/extensions/Constraints/i18n/de.json +++ b/extensions/Constraints/i18n/de.json @@ -22,6 +22,8 @@ "wbqc-constraintreport-status-exception": "Ausnahme", "wbqc-constraintreport-status-todo": "Todo", "wbqc-constraintreport-status-bad-parameters": "Ungültige Parameter", + "wbqc-constraintreport-status-deprecated": "Veraltet", + "wbqc-constraintreport-status-warning": "Warnung", "wbqc-constraintreport-result-table-header-status": "Status", "wbqc-constraintreport-result-table-header-claim": "Behauptung", "wbqc-constraintreport-result-table-header-constraint": "Beschränkung", @@ -34,6 +36,8 @@ "wbqc-badparameters-long": "Diese Beschränkungsaussage hat einige ungültige Parameter.", "wbqc-parameterissues-short": "Erweiterte Probleme", "wbqc-parameterissues-long": "Dies sind Probleme mit der Beschränkungsdefinition zu der Eigenschaft, nicht mit dieser Aussage.", + "wbqc-problems-short": "Probleme", + "wbqc-problems-long": "Diese Aussage hat einige Probleme.", "apihelp-wbcheckconstraints-description": "Führt Beschränkungsprüfungen zu jedem gewünschten Objekt aus und gibt das Ergebnis zurück.", "apihelp-wbcheckconstraints-param-id": "Kennung der Objektliste, von der die Daten abgerufen werden sollen. Mehrere Werte mit „|“ oder Ähnlichem trennen.", "apihelp-wbcheckconstraints-param-claimid": "GUID-Liste, die eine Behauptung erkennt, um einen Beschränkungsbericht zu prüfen. Mehrere Werte mit „|“ trennen.", diff --git a/extensions/Constraints/i18n/en.json b/extensions/Constraints/i18n/en.json index fae7f77..7801d81 100644 --- a/extensions/Constraints/i18n/en.json +++ b/extensions/Constraints/i18n/en.json @@ -22,6 +22,8 @@ "wbqc-constraintreport-status-exception": "Exception", "wbqc-constraintreport-status-todo": "Todo", "wbqc-constraintreport-status-bad-parameters": "Bad parameters", + "wbqc-constraintreport-status-deprecated": "Deprecated", + "wbqc-constraintreport-status-warning": "Warning", "wbqc-constraintreport-result-table-header-status": "Status", "wbqc-constraintreport-result-table-header-claim": "Claim", "wbqc-constraintreport-result-table-header-constraint": "Constraint", @@ -35,6 +37,8 @@ "wbqc-badparameters-long": "This constraint statement has some invalid parameters.", "wbqc-parameterissues-short": "Advanced issues", "wbqc-parameterissues-long": "These issues are problems with the constraint definition on the property, not with this statement.", + "wbqc-problems-short": "Problems", + "wbqc-problems-long": "This statement has some problems.", "apihelp-wbcheckconstraints-description": "Performs constraint checks on any entity you want and returns the result.", "apihelp-wbcheckconstraints-summary": "Performs constraint checks on any entity you want and returns the result.", diff --git a/extensions/Constraints/i18n/es.json b/extensions/Constraints/i18n/es.json index 13622a3..6fb5359 100644 --- a/extensions/Constraints/i18n/es.json +++ b/extensions/Constraints/i18n/es.json @@ -18,11 +18,17 @@ "wbqc-constraintreport-status-exception": "Excepción", "wbqc-constraintreport-status-todo": "Pendiente", "wbqc-constraintreport-status-bad-parameters": "Parámetros incorrectos", + "wbqc-constraintreport-status-deprecated": "En desuso", + "wbqc-constraintreport-status-warning": "Advertencia", "wbqc-constraintreport-result-table-header-status": "Estado", "wbqc-constraintreport-result-link-to-claim": "ir a reclamar", "wbqc-constraintreport-no-parameter": "ninguno", "wbqc-potentialissues-short": "Potenciales incidencias", "wbqc-potentialissues-long": "Esta oración tiene potenciales incidencias.", + "wbqc-badparameters-short": "Parámetros incorrectos", + "wbqc-parameterissues-short": "Incidencias avanzadas", + "wbqc-problems-short": "Problemas", + "wbqc-problems-long": "Esta declaración tiene algunos problemas.", "wbqc-violation-header-parameters": "Parámetros:", "wbqc-violations-group": "Restricciones", "wbqc-violation-message": "La verificación de restricciones ha señalado una violación. Pulsa el icono para obtener más información.", diff --git a/extensions/Constraints/i18n/eu.json b/extensions/Constraints/i18n/eu.json index 2ee23bc..9de0219 100644 --- a/extensions/Constraints/i18n/eu.json +++ b/extensions/Constraints/i18n/eu.json @@ -7,8 +7,13 @@ }, "wbqc-constraintreport-explanation-part-two": "Mugaketak esaldien jabetzaren arabera aztertzen dira, aldi bakoitzean hauek aldatu egiten dira, gehienetan minutu gutxitan.", "wbqc-constraintreport-status-bad-parameters": "Parametro txarrak", + "wbqc-constraintreport-status-deprecated": "Zaharkitua", + "wbqc-constraintreport-status-warning": "Oharra", "wbqc-constraintreport-result-table-header-status": "Egoera", "wbqc-badparameters-short": "Parametro txarrak", + "wbqc-parameterissues-short": "Aurreratutako kontuak", + "wbqc-problems-short": "Arazoak", + "wbqc-problems-long": "Aitorpen honek ez dauka arazorik.", "apihelp-wbcheckconstraintparameters-extended-description": "<var>property</var> eta <var>constraintid</var>, bata edo biak, parametroak zehaztu behar dira: aukeratutako mugaketa guztiak parametroek aztertuko dituzte.", "apihelp-wbcheckconstraintparameters-example-propertyid-1": "Jabetzeko murrizte guztien murrizte parametroak aztertu.", "apihelp-wbcheckconstraintparameters-example-constraintid-2": "Bi murrizte zehatzen murrizte parametroak aztertu.", diff --git a/extensions/Constraints/i18n/fr.json b/extensions/Constraints/i18n/fr.json index 80f5384..6f02c27 100644 --- a/extensions/Constraints/i18n/fr.json +++ b/extensions/Constraints/i18n/fr.json @@ -27,6 +27,8 @@ "wbqc-constraintreport-status-exception": "Exception", "wbqc-constraintreport-status-todo": "En attente", "wbqc-constraintreport-status-bad-parameters": "Mauvais paramètres", + "wbqc-constraintreport-status-deprecated": "Désuet", + "wbqc-constraintreport-status-warning": "Attention", "wbqc-constraintreport-result-table-header-status": "État", "wbqc-constraintreport-result-table-header-claim": "Déclaration", "wbqc-constraintreport-result-table-header-constraint": "Contrainte", @@ -37,6 +39,10 @@ "wbqc-potentialissues-long": "Cette instruction présente quelques problèmes potentiels.", "wbqc-badparameters-short": "Mauvais paramètres", "wbqc-badparameters-long": "Cette déclaration de contrainte a certains paramètres non valides.", + "wbqc-parameterissues-short": "Problèmes complexes", + "wbqc-parameterissues-long": "Ces problèmes sont relatifs à la définition de la contrainte sur la propriété, et non à cette déclaration.", + "wbqc-problems-short": "Problèmes", + "wbqc-problems-long": "Cette déclaration a quelques problèmes.", "apihelp-wbcheckconstraints-description": "Réalise les contrôles de contraintes sur n'importe quelle entité que vous désirez et retourne les résultats.", "apihelp-wbcheckconstraints-summary": "Réalise les contrôles de contraintes sur toute entité que vous désirez et retourne le résultat.", "apihelp-wbcheckconstraints-param-id": "Liste d'ID des entités pour lesquelles ont veux les informations. Séparez les valeurs avec '|' ou similaire.", diff --git a/extensions/Constraints/i18n/he.json b/extensions/Constraints/i18n/he.json index 4060969..5ebb8ed 100644 --- a/extensions/Constraints/i18n/he.json +++ b/extensions/Constraints/i18n/he.json @@ -20,14 +20,22 @@ "wbqc-constraintreport-status-exception": "יוצא־דופן", "wbqc-constraintreport-status-todo": "מטלות", "wbqc-constraintreport-status-bad-parameters": "פרמטרים גרועים", + "wbqc-constraintreport-status-deprecated": "מיושן", + "wbqc-constraintreport-status-warning": "אזהרה", "wbqc-constraintreport-result-table-header-status": "מצב", "wbqc-constraintreport-result-table-header-claim": "טענה", "wbqc-constraintreport-result-table-header-constraint": "אילוץ", "wbqc-constraintreport-result-link-to-claim": "ללכת אל טענה", "wbqc-constraintreport-result-link-to-constraint": "ללכת על אילוץ", "wbqc-constraintreport-no-parameter": "אין", - "wbqc-potentialissues-short": "בעיות אפשריות", - "wbqc-potentialissues-long": "בקביעה הזאת יש בעיות אפשריות.", + "wbqc-potentialissues-short": "סוגיות אפשריות", + "wbqc-potentialissues-long": "בקביעה הזאת יש סוגיות אפשריות.", + "wbqc-badparameters-short": "פרמטרים גרועים", + "wbqc-badparameters-long": "לקביעת האילוץ הזאת יש מספר פרמטרים בלתי־תקינים.", + "wbqc-parameterissues-short": "סוגיות מתקדמות", + "wbqc-parameterissues-long": "הסוגיות האלו הן בעיות עם הגדרת האילוצים על המאפיין, לא עם הקביעה הזאת.", + "wbqc-problems-short": "בעיות", + "wbqc-problems-long": "בקביעה הזאת יש בעיות מסוימות.", "apihelp-wbcheckconstraints-description": "ביצוע בדיקות אילוצים על ישות כלשהי והחזרת התוצאה.", "apihelp-wbcheckconstraints-summary": "ביצוע בדיקת אילוצים על כל ישות והחזרת התוצאה.", "apihelp-wbcheckconstraints-param-id": "רשימת מזהי ישויות שמהן צריך לקבל נתונים. יש להפריד את הערכים בתו '|' או חלופות.", diff --git a/extensions/Constraints/i18n/ko.json b/extensions/Constraints/i18n/ko.json index b87cbab..e72bb9a 100644 --- a/extensions/Constraints/i18n/ko.json +++ b/extensions/Constraints/i18n/ko.json @@ -22,8 +22,13 @@ "wbqc-constraintreport-status-exception": "예외", "wbqc-constraintreport-status-todo": "검사 불가", "wbqc-constraintreport-status-bad-parameters": "잘못된 변수", + "wbqc-constraintreport-status-deprecated": "사용되지 않음", + "wbqc-constraintreport-status-warning": "경고", "wbqc-constraintreport-result-table-header-status": "상태", "wbqc-potentialissues-short": "잠재적인 문제", + "wbqc-badparameters-short": "잘못된 변수", + "wbqc-problems-short": "문제", + "wbqc-problems-long": "이 문에 일부 문제가 있습니다.", "wbqc-violation-header-parameters": "변수:", "wbqc-violation-message-not-yet-implemented": "기술적 이유로, \"$1\" 제약에 대한 검사는 도입되지 않았습니다.", "wbqc-violation-message-security-reason": "보안상의 이유로, \"$1\" 제약에 대한 검사는 현재 불가능합니다. 개발자들이 해결책을 찾기 위해 작업 중입니다.", diff --git a/extensions/Constraints/i18n/lb.json b/extensions/Constraints/i18n/lb.json index 8a3b720..3542a7e 100644 --- a/extensions/Constraints/i18n/lb.json +++ b/extensions/Constraints/i18n/lb.json @@ -10,9 +10,13 @@ "wbqc-constraintreport-empty-result": "Et gëtt keng Limitatiounen déi fir dësen Objet definéiert sinn.", "wbqc-constraintreport-status-exception": "Ausnahm", "wbqc-constraintreport-status-bad-parameters": "Falsch Parameteren", + "wbqc-constraintreport-status-deprecated": "Net méi aktuell", + "wbqc-constraintreport-status-warning": "Warnung", "wbqc-constraintreport-no-parameter": "keng", "wbqc-potentialissues-short": "Potenziell Problemer", "wbqc-badparameters-short": "Falsch Parameteren", + "wbqc-problems-short": "Problemer", + "wbqc-problems-long": "Dës Deklaratioun huet e puer Problemer.", "wbqc-violation-header-parameters": "Parameteren:", "wbqc-violations-group": "Limitatiounen", "wbqc-violation-message-parameter-value": "De Parameter \"$1\" muss e personaliséierte Wäert hunn an net \"kee Wäert\" oder \"onbekannte Wäert\".", diff --git a/extensions/Constraints/i18n/pt-br.json b/extensions/Constraints/i18n/pt-br.json index f33660a..723897c 100644 --- a/extensions/Constraints/i18n/pt-br.json +++ b/extensions/Constraints/i18n/pt-br.json @@ -15,6 +15,8 @@ "wbqc-constraintreport-status-exception": "Exceção", "wbqc-constraintreport-status-todo": "Todo", "wbqc-constraintreport-status-bad-parameters": "Parâmetros incorretos", + "wbqc-constraintreport-status-deprecated": "Obsoleto", + "wbqc-constraintreport-status-warning": "Aviso", "wbqc-constraintreport-result-table-header-status": "Estado", "wbqc-constraintreport-result-table-header-claim": "Reivindicar", "wbqc-constraintreport-result-table-header-constraint": "Limitação", @@ -23,7 +25,10 @@ "wbqc-constraintreport-no-parameter": "nenhum", "wbqc-potentialissues-short": "Problemas potenciais", "wbqc-badparameters-short": "Parâmetros incorretos", + "wbqc-parameterissues-short": "Problemas avançados", + "wbqc-problems-short": "Problemas", "wbq-subextension-name-wbqc": "Restrições", "wbqc-violation-header-parameters": "Parâmetros:", - "wbqc-violations-group": "Restrições" + "wbqc-violations-group": "Restrições", + "wbqc-violation-message-commons-link-no-existent": "Link Commons deve existir." } diff --git a/extensions/Constraints/i18n/pt.json b/extensions/Constraints/i18n/pt.json index 01a553e..f2f95b2 100644 --- a/extensions/Constraints/i18n/pt.json +++ b/extensions/Constraints/i18n/pt.json @@ -22,6 +22,8 @@ "wbqc-constraintreport-status-exception": "Exceção", "wbqc-constraintreport-status-todo": "Pendente", "wbqc-constraintreport-status-bad-parameters": "Parâmetros incorretos", + "wbqc-constraintreport-status-deprecated": "Descontinuada", + "wbqc-constraintreport-status-warning": "Aviso", "wbqc-constraintreport-result-table-header-status": "Estado", "wbqc-constraintreport-result-table-header-claim": "Alegação", "wbqc-constraintreport-result-table-header-constraint": "Restrição", @@ -32,6 +34,10 @@ "wbqc-potentialissues-long": "Esta declaração tem alguns possíveis problemas.", "wbqc-badparameters-short": "Parâmetros incorretos", "wbqc-badparameters-long": "Esta declaração de restrição tem alguns parâmetros inválidos.", + "wbqc-parameterissues-short": "Problemas avançados", + "wbqc-parameterissues-long": "Estes problemas estão relacionados com a definição da restrição sobre a propriedade, não com esta declaração.", + "wbqc-problems-short": "Problemas", + "wbqc-problems-long": "Esta declaração tem alguns problemas.", "apihelp-wbcheckconstraints-description": "Realiza a verificação das restrições de qualquer entidade que queira e devolve o resultado.", "apihelp-wbcheckconstraints-summary": "Realiza a verificação das restrições de qualquer entidade que queira e devolve o resultado.", "apihelp-wbcheckconstraints-param-id": "Lista de identificadores das entidades de que serão obtidos os dados. Separar os valores com '|' ou alternativa.", diff --git a/extensions/Constraints/i18n/qqq.json b/extensions/Constraints/i18n/qqq.json index cea1bb9..afab359 100644 --- a/extensions/Constraints/i18n/qqq.json +++ b/extensions/Constraints/i18n/qqq.json @@ -4,7 +4,8 @@ "Liuxinyu970226", "Raymond", "Metalhead64", - "Amire80" + "Amire80", + "Robby" ] }, "wbqc-constraintreport": "{{doc-special|ConstraintReport}}", @@ -24,18 +25,22 @@ "wbqc-constraintreport-status-exception": "Status for claims that were marked as a exception", "wbqc-constraintreport-status-todo": "Status for constraints which cannot be checked yet.\n{{Identical|Todo}}", "wbqc-constraintreport-status-bad-parameters": "Status for constraints that have missing or invalid constraint parameters.", + "wbqc-constraintreport-status-deprecated": "Status for constraint checks that have been skipped because the statement is deprecated.", + "wbqc-constraintreport-status-warning": "Status for statements that violate a non-mandatory constraint.\n{{Identical|Warning}}", "wbqc-constraintreport-result-table-header-status": "Header of the column that tells whether the check found a violation or something else.\n{{Identical|Status}}", "wbqc-constraintreport-result-table-header-claim": "Header of the column that displays a link to the claim, the used property and its value.\n{{Identical|Claim}}", "wbqc-constraintreport-result-table-header-constraint": "Header of the column that gives information about which constraint was checked.\n{{Identical|Constraint}}", "wbqc-constraintreport-result-link-to-claim": "Text for the link to a claim group on the entity page.", "wbqc-constraintreport-result-link-to-constraint": "Text for the link to a constraint on the property page.", "wbqc-constraintreport-no-parameter": "Text that is displayed when there was no value for a parameter given.\n{{Identical|None}}", - "wbqc-potentialissues-short": "Headline of the constraint report popup shown on statements with constraint violations. Should be easy to understand for users, and convey that the reported violations are not always errors, but should be thought of as hints to the user that something might be wrong.\n\n{{Related|wbqc-constraintreport}}", - "wbqc-potentialissues-long": "Title for the icon shown on statements with constraint violations, usually displayed by the browser when the user hovers over the icon with the mouse cursor.{{Related|wbqc-potentialissues-short}}", + "wbqc-potentialissues-short": "Headline of the constraint report popup section for violations of non-mandatory constraints. Should be easy to understand for users, and convey that the reported violations are not always errors, but should be thought of as hints to the user that something might be wrong.\n\n{{Related|wbqc-constraintreport}}", + "wbqc-potentialissues-long": "Title for the icon shown on statements with non-mandatory constraint violations, usually displayed by the browser when the user hovers over the icon with the mouse cursor.{{Related|wbqc-potentialissues-short}}", "wbqc-badparameters-short": "Headline of the constraint parameter report popup shown on constraint statements with invalid constraint parameters.", "wbqc-badparameters-long": "Title for the icon shown on constraint statements with invalid constraint parameters, usually displayed by the browser when the user hovers over the icon with the mouse cursor.{{Related|wbqc-badparameters-short}}", "wbqc-parameterissues-short": "Headline of the section of the constraint parameter report popup that contains problems about the constraint parameters. The section is collapsed by default, since these problems are harder to understand and fix than normal constraint violations. The headline should convey that normal users are not expected to deal with these problems.\n\nThese problems are also displayed on property pages in a separate popup: see {{msg-mw|wbqc-badparameters-short}} / {{msg-mw|wbqc-badparameters-long}}.", "wbqc-parameterissues-long": "Longer explanation of the section of the constraint parameter report popup that contains problems about the constraint parameters.\n\n{{Related|wbqc-parameterissues-short}}", + "wbqc-problems-short": "Headline of the constraint report popup section for violations of mandatory constraints.{{Related|wbqc-potentialissues-short}}", + "wbqc-problems-long": "Title for the icon shown on statements with mandatory constraint violations, usually displayed by the browser when the user hovers over the icon with the mouse cursor.\n{{Related|wbqc-problems-short}}\n{{Related|wbqc-potentialissues-long}}", "apihelp-wbcheckconstraints-description": "{{doc-apihelp-description|wbcheckconstraints}}", "apihelp-wbcheckconstraints-summary": "{{doc-apihelp-summary|wbcheckconstraints}}", "apihelp-wbcheckconstraints-param-id": "{{doc-apihelp-param|wbcheckconstraints|id}}", diff --git a/extensions/Constraints/i18n/zh-hans.json b/extensions/Constraints/i18n/zh-hans.json index 0d43c4a..a741bd1 100644 --- a/extensions/Constraints/i18n/zh-hans.json +++ b/extensions/Constraints/i18n/zh-hans.json @@ -20,6 +20,8 @@ "wbqc-constraintreport-status-exception": "例外", "wbqc-constraintreport-status-todo": "待办事项", "wbqc-constraintreport-status-bad-parameters": "错误参数", + "wbqc-constraintreport-status-deprecated": "已弃用", + "wbqc-constraintreport-status-warning": "警告", "wbqc-constraintreport-result-table-header-status": "状态", "wbqc-constraintreport-result-table-header-claim": "声称", "wbqc-constraintreport-result-table-header-constraint": "约束", @@ -30,6 +32,10 @@ "wbqc-potentialissues-long": "此声明有一些潜在问题。", "wbqc-badparameters-short": "错误参数", "wbqc-badparameters-long": "此约束声明存在一些无效参数。", + "wbqc-parameterissues-short": "高级问题", + "wbqc-parameterissues-long": "这些问题是属性上的约束定义问题,而不是此声明的问题。", + "wbqc-problems-short": "问题", + "wbqc-problems-long": "此声明有一些问题。", "apihelp-wbcheckconstraints-description": "在任何您希望执行检查的实体上,执行约束检查并返回结果。", "apihelp-wbcheckconstraints-summary": "在任何您希望执行的实体上执行约束检查,并返回结果。", "apihelp-wbcheckconstraints-param-id": "要获取数据的实体ID列表。使用“|”或替代字符分隔值。", diff --git a/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php b/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php index 265536e..5098895 100644 --- a/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php +++ b/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php @@ -3,6 +3,7 @@ namespace WikibaseQuality\ConstraintReport\ConstraintCheck; use InvalidArgumentException; +use LogicException; use MediaWiki\MediaWikiServices; use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Entity\PropertyId; @@ -340,6 +341,35 @@ ( microtime( true ) - $startTime ) * 1000 ); + try { + $constraintStatus = $this->constraintParameterParser + ->parseConstraintStatusParameter( $constraint->getConstraintParameters() ); + } catch ( ConstraintParameterException $e ) { + $result = new CheckResult( + $entity->getId(), + $statement, + $constraint, + [], + CheckResult::STATUS_BAD_PARAMETERS, + $e->getMessage() + ); + $constraintStatus = null; + } + if ( $constraintStatus === null ) { + // downgrade violation to warning + if ( $result->getStatus() === CheckResult::STATUS_VIOLATION ) { + $result->setStatus( CheckResult::STATUS_WARNING ); + } + } else { + if ( $constraintStatus !== 'mandatory' ) { + throw new LogicException( + "Unknown constraint status '$constraintStatus', " . + "only known status is 'mandatory'" + ); + } + $result->getParameters['constraint_status'] = $constraintStatus; + } + return $result; } else { return new CheckResult( $entity->getId(), $statement, $constraint, [], CheckResult::STATUS_TODO, null ); @@ -357,7 +387,16 @@ } $sortFunction = function ( CheckResult $a, CheckResult $b ) { - $order = [ 'other' => 4, 'compliance' => 3, 'exception' => 2, 'violation' => 1, 'bad-parameters' => 0 ]; + $orderNum = 0; + $order = [ + 'bad-parameters' => $orderNum++, + 'violation' => $orderNum++, + 'warning' => $orderNum++, + 'exception' => $orderNum++, + 'compliance' => $orderNum++, + 'deprecated' => $orderNum++, + 'other' => $orderNum++, + ]; $statusA = $a->getStatus(); $statusB = $b->getStatus(); diff --git a/extensions/Constraints/includes/ConstraintCheck/Helper/ConstraintParameterParser.php b/extensions/Constraints/includes/ConstraintCheck/Helper/ConstraintParameterParser.php index d1423d7..f95f82c 100644 --- a/extensions/Constraints/includes/ConstraintCheck/Helper/ConstraintParameterParser.php +++ b/extensions/Constraints/includes/ConstraintCheck/Helper/ConstraintParameterParser.php @@ -708,4 +708,55 @@ } } + private function parseConstraintStatusParameterFromStatement( array $constraintParameters ) { + $constraintStatusId = $this->config->get( 'WBQualityConstraintsConstraintStatusId' ); + $mandatoryId = $this->config->get( 'WBQualityConstraintsMandatoryConstraintId' ); + $this->requireSingleParameter( $constraintParameters, $constraintStatusId ); + $snak = $this->snakDeserializer->deserialize( $constraintParameters[$constraintStatusId][0] ); + $this->requireValueParameter( $snak, $constraintStatusId ); + $statusId = $snak->getDataValue()->getEntityId()->getSerialization(); + + if ( $statusId === $mandatoryId ) { + return 'mandatory'; + } else { + throw new ConstraintParameterException( + wfMessage( 'wbqc-violation-message-parameter-oneof' ) + ->rawParams( $this->constraintParameterRenderer->formatPropertyId( $constraintStatusId, Role::CONSTRAINT_PARAMETER_PROPERTY ) ) + ->numParams( 1 ) + ->rawParams( $this->constraintParameterRenderer->formatItemIdList( [ $mandatoryId ], Role::CONSTRAINT_PARAMETER_VALUE ) ) + ->escaped() + ); + } + } + + private function parseConstraintStatusParameterFromTemplate( array $constraintParameters ) { + if ( $constraintParameters['constraint_status'] === 'mandatory' ) { + return 'mandatory'; + } else { + throw new ConstraintParameterException( + wfMessage( 'wbqc-violation-message-parameter-oneof' ) + ->rawParams( $this->constraintParameterRenderer->formatPropertyId( 'constraint_status', Role::CONSTRAINT_PARAMETER_PROPERTY ) ) + ->numParams( 1 ) + ->rawParams( $this->constraintParameterRenderer->formatItemIdList( [ 'mandatory' ], Role::CONSTRAINT_PARAMETER_VALUE ) ) + ->escaped() + ); + } + } + + /** + * @param array $constraintParameters see {@link \WikibaseQuality\Constraint::getConstraintParameters()} + * @throws ConstraintParameterException if the parameter is invalid + * @return string|null 'mandatory' or null + */ + public function parseConstraintStatusParameter( array $constraintParameters ) { + $constraintStatusId = $this->config->get( 'WBQualityConstraintsConstraintStatusId' ); + if ( array_key_exists( $constraintStatusId, $constraintParameters ) ) { + return $this->parseConstraintStatusParameterFromStatement( $constraintParameters ); + } elseif ( array_key_exists( 'constraint_status', $constraintParameters ) ) { + return $this->parseConstraintStatusParameterFromTemplate( $constraintParameters ); + } else { + return null; + } + } + } diff --git a/extensions/Constraints/includes/ConstraintCheck/Result/CheckResult.php b/extensions/Constraints/includes/ConstraintCheck/Result/CheckResult.php index 355354f..d1bbbff 100644 --- a/extensions/Constraints/includes/ConstraintCheck/Result/CheckResult.php +++ b/extensions/Constraints/includes/ConstraintCheck/Result/CheckResult.php @@ -44,6 +44,13 @@ * The constraint has not been checked because the statement is deprecated. */ const STATUS_DEPRECATED = 'deprecated'; + /** + * The statement violates the constraint, but the constraint is not mandatory. + * + * DelegatingConstraintChecker downgrades violations to warnings automatically based on the constraint parameters; + * constraint checkers should not assign this status directly. + */ + const STATUS_WARNING = 'warning'; /** * @var EntityId @@ -164,6 +171,13 @@ } /** + * @param string $status + */ + public function setStatus( $status ) { + $this->status = $status; + } + + /** * @return string (sanitized HTML) */ public function getMessage() { diff --git a/extensions/Constraints/includes/ConstraintRepository.php b/extensions/Constraints/includes/ConstraintRepository.php index 29fbd93..497e5c1 100644 --- a/extensions/Constraints/includes/ConstraintRepository.php +++ b/extensions/Constraints/includes/ConstraintRepository.php @@ -3,6 +3,7 @@ namespace WikibaseQuality\ConstraintReport; use InvalidArgumentException; +use MediaWiki\Logger\LoggerFactory; use Wikimedia\Rdbms\DBUnexpectedError; use Wikimedia\Rdbms\LikeMatch; use Wikibase\DataModel\Entity\PropertyId; @@ -137,6 +138,17 @@ $constraintTypeItemId = $result->constraint_type_qid; $constraintParameters = json_decode( $result->constraint_parameters, true ); + if ( $constraintParameters === null ) { + // T171295 + LoggerFactory::getInstance( 'WikibaseQualityConstraints' ) + ->warning( 'Constraint {constraintId} has invalid constraint parameters.', [ + 'method' => __METHOD__, + 'constraintId' => $result->constraint_guid, + 'constraintParameters' => $result->constraint_parameters, + ] ); + $constraintParameters = []; + } + $constraints[] = new Constraint( $result->constraint_guid, PropertyId::newFromNumber( $result->pid ), diff --git a/extensions/Constraints/modules/SpecialConstraintReportPage.css b/extensions/Constraints/modules/SpecialConstraintReportPage.css index 831949f..deb2ff2 100644 --- a/extensions/Constraints/modules/SpecialConstraintReportPage.css +++ b/extensions/Constraints/modules/SpecialConstraintReportPage.css @@ -25,7 +25,7 @@ } .wbqc-status-exception { - color: #ac6600; /* Yellow30 */ + color: #14866d; /* Green30 */ } .wbqc-status-violation { @@ -40,6 +40,14 @@ color: #b32424; /* Red30 */ } +.wbqc-status-deprecated { + color: #72777d; /* Base30 */ +} + +.wbqc-status-warning { + color: #ac6600; /* Yellow30 */ +} + /* Tooltip */ .wbqc-indicator { color: #72777d; /* Base30 */ diff --git a/extensions/Constraints/modules/gadget.js b/extensions/Constraints/modules/gadget.js index d10b811..d036b2c 100644 --- a/extensions/Constraints/modules/gadget.js +++ b/extensions/Constraints/modules/gadget.js @@ -3,10 +3,10 @@ var entityId; - function buildPopup( $content, messageKey, flags /* = '' */ ) { + function buildPopup( $content, icon, iconTitleMessageKey, flags /* = '' */ ) { var widget = new OO.ui.PopupButtonWidget( { - icon: 'alert', - iconTitle: mw.message( 'wbqc-' + messageKey + '-long' ).text(), + icon: icon, + iconTitle: mw.message( iconTitleMessageKey ).text(), flags: flags || '', framed: false, classes: [ 'wbqc-reports-button' ], @@ -59,7 +59,8 @@ i, report, list, - $target; + $target, + haveMandatoryViolations; if ( !( propertyId in entityData && statementId in entityData[ propertyId ] ) ) { return; @@ -81,6 +82,10 @@ statuses: [ { status: 'violation', + label: mw.message( 'wbqc-problems-short' ).text() + }, + { + status: 'warning', label: mw.message( 'wbqc-potentialissues-short' ).text() }, { @@ -99,11 +104,17 @@ // ...and doesn't only contain collapsed items either list.items[ 0 ].status !== 'bad-parameters' ) { + haveMandatoryViolations = list.items[ 0 ].status === 'violation'; + $target = $statement.find( '.valueview-instaticmode' ); if ( $target.length === 0 ) { $target = $statement; } - $target.append( buildPopup( list.$element, 'potentialissues' ).$element ); + $target.append( buildPopup( + list.$element, + haveMandatoryViolations ? 'alert' : 'info', + haveMandatoryViolations ? 'wbqc-problems-long' : 'wbqc-potentialissues-long' + ).$element ); } } @@ -149,7 +160,7 @@ if ( $target.length === 0 ) { $target = $statement; } - $target.append( buildPopup( list.$element, 'badparameters', 'warning' ).$element ); + $target.append( buildPopup( list.$element, 'alert', 'wbqc-badparameters-long', 'warning' ).$element ); } } diff --git a/extensions/Constraints/tests/phpunit/Api/CheckConstraintsTest.php b/extensions/Constraints/tests/phpunit/Api/CheckConstraintsTest.php index d30d45a..5d1e399 100644 --- a/extensions/Constraints/tests/phpunit/Api/CheckConstraintsTest.php +++ b/extensions/Constraints/tests/phpunit/Api/CheckConstraintsTest.php @@ -102,6 +102,7 @@ $config = new HashConfig( [ 'WBQualityConstraintsPropertyConstraintId' => 'P1', 'WBQualityConstraintsExceptionToConstraintId' => 'P2', + 'WBQualityConstraintsConstraintStatusId' => 'P3', ] ); $entityIdParser = new ItemIdParser(); $constraintParameterRenderer = new ConstraintParameterRenderer( $entityIdFormatter, $valueFormatter ); @@ -233,7 +234,7 @@ 'some guid', $propertyId, 'violationConstraint', - [] + [ 'constraint_status' => 'mandatory' ] ); } diff --git a/extensions/Constraints/tests/phpunit/DelegatingConstraintCheckerTest.php b/extensions/Constraints/tests/phpunit/DelegatingConstraintCheckerTest.php index 12ee7a8..fa38054 100644 --- a/extensions/Constraints/tests/phpunit/DelegatingConstraintCheckerTest.php +++ b/extensions/Constraints/tests/phpunit/DelegatingConstraintCheckerTest.php @@ -273,7 +273,22 @@ 'pid' => 3, 'constraint_type_qid' => 'Is not inside', 'constraint_parameters' => '{}' - ] + ], + [ + 'constraint_guid' => 'P6$ad792000-6a12-413d-9fe5-11d2467b7a92', + 'pid' => 6, + 'constraint_type_qid' => 'Qualifier', + 'constraint_parameters' => json_encode( + [ + 'constraint_status' => 'mandatory' + ] ) + ], + [ + 'constraint_guid' => 'P7$a3f746e7-66a0-46fd-96ab-6ff6638332a4', + 'pid' => 7, + 'constraint_type_qid' => 'Qualifier', + 'constraint_parameters' => '{}' + ], ] ); } @@ -322,6 +337,22 @@ $this->assertEquals( 'bad-parameters', $result[ 0 ]->getStatus(), 'Should be a bad parameter but not throw an exception' ); } + public function testCheckAgainstConstraintsWithMandatoryConstraint() { + $entity = NewItem::withId( 'Q6' ) + ->andStatement( NewStatement::noValueFor( 'P6' ) ) + ->build(); + $result = $this->constraintChecker->checkAgainstConstraints( $entity ); + $this->assertEquals( 'violation', $result[ 0 ]->getStatus(), 'Should be a violation' ); + } + + public function testCheckAgainstConstraintsWithNonMandatoryConstraint() { + $entity = NewItem::withId( 'Q7' ) + ->andStatement( NewStatement::noValueFor( 'P7' ) ) + ->build(); + $result = $this->constraintChecker->checkAgainstConstraints( $entity ); + $this->assertEquals( 'warning', $result[ 0 ]->getStatus(), 'Should be a warning' ); + } + public function testCheckAgainstConstraints_ByClaims() { $result = $this->constraintChecker->checkAgainstConstraintsOnClaimId( 'Q1$c0f25a6f-9e33-41c8-be34-c86a730ff30b' ); diff --git a/extensions/Constraints/tests/phpunit/Helper/ConstraintParameterParserTest.php b/extensions/Constraints/tests/phpunit/Helper/ConstraintParameterParserTest.php index 6105589..e0e77f6 100644 --- a/extensions/Constraints/tests/phpunit/Helper/ConstraintParameterParserTest.php +++ b/extensions/Constraints/tests/phpunit/Helper/ConstraintParameterParserTest.php @@ -898,4 +898,51 @@ ); } + public function testParseConstraintStatusParameter() { + $constraintStatusId = $this->getDefaultConfig()->get( 'WBQualityConstraintsConstraintStatusId' ); + $mandatoryId = $this->getDefaultConfig()->get( 'WBQualityConstraintsMandatoryConstraintId' ); + $snak = new PropertyValueSnak( new PropertyId( $constraintStatusId ), new EntityIdValue( new ItemId( $mandatoryId ) ) ); + + $parsed = $this->getConstraintParameterParser()->parseConstraintStatusParameter( + [ $constraintStatusId => [ $this->snakSerializer->serialize( $snak ) ] ] + ); + + $this->assertEquals( 'mandatory', $parsed ); + } + + public function testParseConstraintStatusParameterMissing() { + $parsed = $this->getConstraintParameterParser()->parseConstraintStatusParameter( + [] + ); + + $this->assertNull( $parsed ); + } + + public function testParseConstraintStatusParameterFromTemplate() { + $parsed = $this->getConstraintParameterParser()->parseConstraintStatusParameter( + [ 'constraint_status' => 'mandatory' ] + ); + + $this->assertEquals( 'mandatory', $parsed ); + } + + public function testParseConstraintStatusParameterInvalid() { + $constraintStatusId = $this->getDefaultConfig()->get( 'WBQualityConstraintsConstraintStatusId' ); + $snak = new PropertyValueSnak( new PropertyId( $constraintStatusId ), new EntityIdValue( new ItemId( 'Q1' ) ) ); + + $this->assertThrowsConstraintParameterException( + 'parseConstraintStatusParameter', + [ [ $constraintStatusId => [ $this->snakSerializer->serialize( $snak ) ] ] ], + 'wbqc-violation-message-parameter-oneof' + ); + } + + public function testParseConstraintStatusParameterFromTemplateInvalid() { + $this->assertThrowsConstraintParameterException( + 'parseConstraintStatusParameter', + [ [ 'constraint_status' => 'other' ] ], + 'wbqc-violation-message-parameter-oneof' + ); + } + } diff --git a/extensions/Constraints/tests/phpunit/Specials/SpecialConstraintReportTest.php b/extensions/Constraints/tests/phpunit/Specials/SpecialConstraintReportTest.php index 49e74f1..4b793bd 100644 --- a/extensions/Constraints/tests/phpunit/Specials/SpecialConstraintReportTest.php +++ b/extensions/Constraints/tests/phpunit/Specials/SpecialConstraintReportTest.php @@ -127,13 +127,13 @@ 'constraint_guid' => '1', 'pid' => self::$idMap[ 'P1' ]->getNumericId(), 'constraint_type_qid' => 'Multi value', - 'constraint_parameters' => '{}' + 'constraint_parameters' => '{"constraint_status":"mandatory"}' ], [ 'constraint_guid' => '3', 'pid' => self::$idMap[ 'P1' ]->getNumericId(), 'constraint_type_qid' => 'Single value', - 'constraint_parameters' => '{}' + 'constraint_parameters' => '{"constraint_status":"mandatory"}' ] ] ); diff --git a/extensions/Wikibase/client/i18n/pt-br.json b/extensions/Wikibase/client/i18n/pt-br.json index 7c6c9d2..b9da8ea 100644 --- a/extensions/Wikibase/client/i18n/pt-br.json +++ b/extensions/Wikibase/client/i18n/pt-br.json @@ -68,6 +68,7 @@ "wikibase-unconnectedpages-format-row": "($1 {{PLURAL:$1|interlanguage link|links interlíngua}} na página)", "wikibase-unconnectedpages-submit": "Mostrar páginas", "pageswithbadges": "Páginas com emblemas", + "wikibase-pageswithbadges-invalid-id": "$1 não é um ID de um item válido", "wikibase-pageswithbadges-badge": "Emblema:", "wikibase-pageswithbadges-submit": "Mostrar páginas", "entityusage": "Uso da entidade", diff --git a/extensions/Wikibase/client/i18n/skr-arab.json b/extensions/Wikibase/client/i18n/skr-arab.json index a929c1b..5c945ed 100644 --- a/extensions/Wikibase/client/i18n/skr-arab.json +++ b/extensions/Wikibase/client/i18n/skr-arab.json @@ -10,7 +10,9 @@ "wikibase-editlinks": "روابط وچ ترمیم کرو", "wikibase-editlinkstitle": "بین اللسانی روابط وچ ترمیم کرو", "wikibase-rc-hide-wikidata": "$1 {{WBREPONAME}}", + "wikibase-rc-hide-wikidata-hide": "لُکاؤ", "wikibase-rc-hide-wikidata-show": "ݙیکھاؤ", "wikibase-rc-wikibase-edit-letter": "ڈاٹا", - "wikibase-rc-wikibase-edit-title": "{{WBREPONAME}} لکھت" + "wikibase-rc-wikibase-edit-title": "{{WBREPONAME}} لکھت", + "wikibase-otherprojects": "ٻنھاں منصوبیاں وچ" } diff --git a/extensions/Wikibase/composer.json b/extensions/Wikibase/composer.json index be1b4dc..76ec147 100644 --- a/extensions/Wikibase/composer.json +++ b/extensions/Wikibase/composer.json @@ -40,7 +40,7 @@ "wikibase/javascript-api": "^2.2.2", "wikibase/serialization-javascript": "^2.0.8", "diff/diff": "^2.0.0", - "wikimedia/purtle": "^1.0.3" + "wikimedia/purtle": "^1.0.6" }, "require-dev": { "jakub-onderka/php-parallel-lint": ">=0.3 <0.10", diff --git a/extensions/Wikibase/lib/i18n/pt-br.json b/extensions/Wikibase/lib/i18n/pt-br.json index 106b2fe..57d0b52 100644 --- a/extensions/Wikibase/lib/i18n/pt-br.json +++ b/extensions/Wikibase/lib/i18n/pt-br.json @@ -55,6 +55,7 @@ "wikibase-validator-bad-type": "$2 em vez de $1", "wikibase-validator-malformed-value": "Entrada mal formatada: $1", "wikibase-validator-bad-entity-id": "ID inválido: $1.", + "wikibase-validator-bad-entity-type": "Tipo da entidade inesperada $1", "wikibase-validator-no-such-entity": "$1 não encontrado", "wikibase-validator-no-such-property": "Propriedade $1 não encontrada", "wikibase-validator-bad-value": "Valor de dados corrompido: $1", @@ -89,6 +90,7 @@ "wikibase-entity-summary-wbeditentity-override": "Eliminada uma entidade", "wikibase-entity-summary-wbsetreference": "Definir um referência", "wikibase-entity-summary-wbsetreference-add": "Incluída referência para a afirmação", + "wikibase-entity-summary-wbsetreference-set": "Modificada referência da reinvindicação", "wikibase-entity-summary-wbsetlabel-add": "Adicionado [$2] legenda", "wikibase-entity-summary-wbsetlabel-set": "Alterado o rótulo [$2]", "wikibase-entity-summary-wbsetlabel-remove": "Removido o rótulo [$2]", diff --git a/extensions/Wikibase/lib/includes/Store/WikiPagePropertyOrderProvider.php b/extensions/Wikibase/lib/includes/Store/WikiPagePropertyOrderProvider.php index c7c86ce..10ce97d 100644 --- a/extensions/Wikibase/lib/includes/Store/WikiPagePropertyOrderProvider.php +++ b/extensions/Wikibase/lib/includes/Store/WikiPagePropertyOrderProvider.php @@ -20,8 +20,6 @@ private $pageTitle; /** - * Constructor of the WikiPageOrderProvider - * * @param Title $pageTitle page name the ordered property list is on */ public function __construct( Title $pageTitle ) { diff --git a/extensions/Wikibase/repo/Wikibase.hooks.php b/extensions/Wikibase/repo/Wikibase.hooks.php index d6563a1..66c20dd 100644 --- a/extensions/Wikibase/repo/Wikibase.hooks.php +++ b/extensions/Wikibase/repo/Wikibase.hooks.php @@ -57,6 +57,22 @@ } /** + * Handler for the BeforePageDisplayMobile hook that adds the wikibase mobile styles. + * + * @param OutputPage $out + * @param Skin $skin + */ + public static function onBeforePageDisplayMobile( OutputPage &$out, Skin &$skin ) { + $title = $out->getTitle(); + $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()->getEntityNamespaceLookup(); + $isEntityTitle = $entityNamespaceLookup->isEntityNamespace( $title->getNamespace() ); + + if ( $isEntityTitle ) { + $out->addModules( 'wikibase.mobile' ); + } + } + + /** * Handler for the SetupAfterCache hook, completing the content and namespace setup. * This updates the $wgContentHandlers and $wgNamespaceContentModels registries * according to information provided by entity type definitions and the entityNamespaces diff --git a/extensions/Wikibase/repo/Wikibase.php b/extensions/Wikibase/repo/Wikibase.php index 0fb4aa9..8cd2f3e 100644 --- a/extensions/Wikibase/repo/Wikibase.php +++ b/extensions/Wikibase/repo/Wikibase.php @@ -1008,6 +1008,7 @@ $wgHooks['ResourceLoaderRegisterModules'][] = 'Wikibase\RepoHooks::onResourceLoaderRegisterModules'; $wgHooks['BeforeDisplayNoArticleText'][] = 'Wikibase\ViewEntityAction::onBeforeDisplayNoArticleText'; $wgHooks['InfoAction'][] = '\Wikibase\RepoHooks::onInfoAction'; + $wgHooks['BeforePageDisplayMobile'][] = '\Wikibase\RepoHooks::onBeforePageDisplayMobile'; // update hooks $wgHooks['LoadExtensionSchemaUpdates'][] = '\Wikibase\Repo\Store\Sql\ChangesSubscriptionSchemaUpdater::onSchemaUpdate'; diff --git a/extensions/Wikibase/repo/i18n/en.json b/extensions/Wikibase/repo/i18n/en.json index cc72ee3..317fcc2 100644 --- a/extensions/Wikibase/repo/i18n/en.json +++ b/extensions/Wikibase/repo/i18n/en.json @@ -342,7 +342,7 @@ "wikibase-api-no-external-page": "The external client site \"$1\" did not provide page information for page \"$2\".", "wikibase-api-nosuchrevid": "Revision with ID not found.", "wikibase-api-no-such-claim": "Could not find such a claim.", - "wikibase-api-no-such-entity": "Could not find such an entity.", + "wikibase-api-no-such-entity": "Could not find an entity with the ID \"$1\".", "wikibase-api-no-such-entity-link": "Could not find an item containing a sitelink to the provided site and page name.", "wikibase-api-no-such-reference": "Could not find such a reference.", "wikibase-api-no-such-site": "Could not find such a site.", diff --git a/extensions/Wikibase/repo/i18n/qqq.json b/extensions/Wikibase/repo/i18n/qqq.json index 401a104..68eb75d 100644 --- a/extensions/Wikibase/repo/i18n/qqq.json +++ b/extensions/Wikibase/repo/i18n/qqq.json @@ -375,7 +375,7 @@ "wikibase-api-no-external-page": "This is an error message where the external client did reply, but either because of a faulty reply or because the page title could not be unwound, it was not possible to identify an external page.\n* $1 - the site id\n* $2 - the page id\n{{Related|Wikibase-no-external-page}}", "wikibase-api-nosuchrevid": "!!DO NOT TRANSLATE!! Page or entity with this revision id could not be found in the database", "wikibase-api-no-such-claim": "!!DO NOT TRANSLATE!! Could not find such a claim on wikidata, this could be to the user entering the wrong data", - "wikibase-api-no-such-entity": "!!DO NOT TRANSLATE!! Could not find such an entity, this could be to the user entering the wrong data", + "wikibase-api-no-such-entity": "Error message shown when an entity ID was requested that does not exist in the database. This could be to the user entering the wrong data.\n* $1 - the entity ID", "wikibase-api-no-such-entity-link": "Error message when the user provides a site and page name combination (usually referred to as a \"sitelink\") not contained in any item.", "wikibase-api-no-such-reference": "!!DO NOT TRANSLATE!! Could not find such a reference, this could be to the user entering the wrong data", "wikibase-api-no-such-site": "!!DO NOT TRANSLATE!! Could not find such a site, this could be to the user entering the wrong data", diff --git a/extensions/Wikibase/repo/i18n/skr-arab.json b/extensions/Wikibase/repo/i18n/skr-arab.json index 9fe809e..8477404 100644 --- a/extensions/Wikibase/repo/i18n/skr-arab.json +++ b/extensions/Wikibase/repo/i18n/skr-arab.json @@ -6,5 +6,8 @@ }, "wikibase-edit": "لکھو", "wikibase-add": "جوڑو", - "wikibase-sitelinks-special": "ٻیاں سائٹاں" + "wikibase-label-empty": "کوئی سرخی کائنی", + "wikibase-description-empty": "کوئی وضاحت کائنی", + "wikibase-sitelinks-special": "ٻیاں سائٹاں", + "wikibase-statementview-rank-normal": "عام درجہ" } diff --git a/extensions/Wikibase/repo/includes/Api/ApiErrorReporter.php b/extensions/Wikibase/repo/includes/Api/ApiErrorReporter.php index d61ad01..5165cc8 100644 --- a/extensions/Wikibase/repo/includes/Api/ApiErrorReporter.php +++ b/extensions/Wikibase/repo/includes/Api/ApiErrorReporter.php @@ -216,7 +216,6 @@ $this->addMessageToResult( $msg, $extraData ); $this->trackAndDieWithError( $msg, $errorCode, $extraData, $httpRespCode ); - throw new LogicException( 'ApiUsageException not thrown' ); } diff --git a/extensions/Wikibase/repo/includes/Api/EntityLoadingHelper.php b/extensions/Wikibase/repo/includes/Api/EntityLoadingHelper.php index e8538bb..0170f5f 100644 --- a/extensions/Wikibase/repo/includes/Api/EntityLoadingHelper.php +++ b/extensions/Wikibase/repo/includes/Api/EntityLoadingHelper.php @@ -181,8 +181,7 @@ $entityRevision = $this->loadEntityRevision( $entityId ); if ( !$entityRevision ) { - $this->errorReporter->dieError( - 'Entity ' . $entityId->getSerialization() . ' not found', + $this->errorReporter->dieWithError( [ 'no-such-entity', $entityId ], 'no-such-entity' ); } diff --git a/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php b/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php index 51d488a..9bc4ff8 100644 --- a/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php +++ b/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php @@ -175,8 +175,7 @@ 'no-entity-id' ); } else { - $this->errorReporter->dieError( - 'Could not find entity ' . $entityId, + $this->errorReporter->dieWithError( [ 'no-such-entity', $entityId ], 'no-such-entity' ); } @@ -190,8 +189,7 @@ } if ( $entityId && !$this->entityStore->canCreateWithCustomId( $entityId ) ) { - $this->errorReporter->dieError( - 'Could not find entity ' . $entityId . ', and it cannot be created from this ID.', + $this->errorReporter->dieWithError( [ 'no-such-entity', $entityId ], 'no-such-entity' ); } diff --git a/extensions/Wikibase/repo/includes/Api/GetEntities.php b/extensions/Wikibase/repo/includes/Api/GetEntities.php index 449d1c2..a6e5805 100644 --- a/extensions/Wikibase/repo/includes/Api/GetEntities.php +++ b/extensions/Wikibase/repo/includes/Api/GetEntities.php @@ -162,15 +162,21 @@ * @return EntityId[] */ private function getEntityIdsFromIdParam( array $params ) { + if ( !isset( $params['ids'] ) ) { + return []; + } + $ids = []; - if ( isset( $params['ids'] ) ) { - foreach ( $params['ids'] as $id ) { - try { - $ids[] = $this->idParser->parse( $id ); - } catch ( EntityIdParsingException $e ) { - $this->errorReporter->dieError( - "Invalid id: $id", 'no-such-entity', 0, [ 'id' => $id ] ); - } + foreach ( $params['ids'] as $id ) { + try { + $ids[] = $this->idParser->parse( $id ); + } catch ( EntityIdParsingException $e ) { + $this->errorReporter->dieWithError( + [ 'no-such-entity', $id ], + 'no-such-entity', + 0, + [ 'id' => $id ] + ); } } return $ids; diff --git a/extensions/Wikibase/repo/includes/ChangeOp/Deserialization/SiteLinkBadgeChangeOpSerializationValidator.php b/extensions/Wikibase/repo/includes/ChangeOp/Deserialization/SiteLinkBadgeChangeOpSerializationValidator.php index 9f61e7c..dad0e75 100644 --- a/extensions/Wikibase/repo/includes/ChangeOp/Deserialization/SiteLinkBadgeChangeOpSerializationValidator.php +++ b/extensions/Wikibase/repo/includes/ChangeOp/Deserialization/SiteLinkBadgeChangeOpSerializationValidator.php @@ -65,7 +65,8 @@ if ( is_null( $itemTitle ) || !$itemTitle->exists() ) { throw new ChangeOpDeserializationException( 'Badges: no item found matching id "' . $badgeSerialization . '"', - 'no-such-entity' + 'no-such-entity', + [ $badgeSerialization ] ); } } diff --git a/extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputGenerator.php b/extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputGenerator.php index 73b1528..0829638 100644 --- a/extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputGenerator.php +++ b/extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputGenerator.php @@ -371,10 +371,6 @@ // Then load JavaScript accordingly depending on $editable. $parserOutput->addModules( 'wikibase.ui.entityViewInit' ); $parserOutput->addModules( 'wikibase.entityPage.entityLoaded' ); - - // Load mobile styles, which have targets => mobile - // and will only be loaded on mobile devices - $parserOutput->addModules( 'wikibase.mobile' ); } /** diff --git a/extensions/Wikibase/repo/includes/Store/Sql/SqlStore.php b/extensions/Wikibase/repo/includes/Store/Sql/SqlStore.php index 837706d..4cc5508 100644 --- a/extensions/Wikibase/repo/includes/Store/Sql/SqlStore.php +++ b/extensions/Wikibase/repo/includes/Store/Sql/SqlStore.php @@ -434,7 +434,7 @@ $contentFactory = WikibaseRepo::getDefaultInstance()->getEntityContentFactory(); $idGenerator = $this->newIdGenerator(); - $store = new WikiPageEntityStore( $contentFactory, $idGenerator ); + $store = new WikiPageEntityStore( $contentFactory, $idGenerator, $this->entityIdComposer ); $store->registerWatcher( $this->getEntityStoreWatcher() ); return $store; } diff --git a/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php b/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php index cdcfddd..5fbd30a 100644 --- a/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php +++ b/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php @@ -15,6 +15,7 @@ use Wikibase\EntityContent; use Wikibase\EntityRevision; use Wikibase\IdGenerator; +use Wikibase\Lib\EntityIdComposer; use Wikibase\Lib\Store\EntityStore; use Wikibase\Lib\Store\EntityStoreWatcher; use Wikibase\Lib\Store\StorageException; @@ -47,14 +48,22 @@ */ private $dispatcher; + /** + * @var EntityIdComposer + */ + private $entityIdComposer; + public function __construct( EntityContentFactory $contentFactory, - IdGenerator $idGenerator + IdGenerator $idGenerator, + EntityIdComposer $entityIdComposer ) { $this->contentFactory = $contentFactory; $this->idGenerator = $idGenerator; $this->dispatcher = new GenericEventDispatcher( EntityStoreWatcher::class ); + + $this->entityIdComposer = $entityIdComposer; } /** @@ -92,8 +101,8 @@ $contentModelId = $handler->getModelID(); $numericId = $this->idGenerator->getNewId( $contentModelId ); - // FIXME: this relies on setId() accepting numeric IDs! Use an EntityIdComposer instead. - $entity->setId( $numericId ); + $entityId = $this->entityIdComposer->composeEntityId( '', $type, $numericId ); + $entity->setId( $entityId ); } /** diff --git a/extensions/Wikibase/repo/maintenance/dispatchChanges.php b/extensions/Wikibase/repo/maintenance/dispatchChanges.php index c507954..0dfc063 100644 --- a/extensions/Wikibase/repo/maintenance/dispatchChanges.php +++ b/extensions/Wikibase/repo/maintenance/dispatchChanges.php @@ -200,6 +200,7 @@ break; } + $wikiState = null; $runStartTime = microtime( true ); $c++; @@ -233,6 +234,9 @@ } else { $this->log( "ERROR: $ex" ); } + if ( $wikiState ) { + $dispatcher->getDispatchCoordinator()->releaseClient( $wikiState ); + } } $t = ( microtime( true ) - $startTime ); diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/Api/EntityLoadingHelperTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/Api/EntityLoadingHelperTest.php index fe61e97..a95b1bc 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/Api/EntityLoadingHelperTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/Api/EntityLoadingHelperTest.php @@ -90,31 +90,29 @@ $mock = $this->getMockBuilder( ApiErrorReporter::class ) ->disableOriginalConstructor() ->getMock(); + $apiUsageException = ApiUsageException::newWithMessage( null, 'mockApiUsageException' ); if ( $expectedExceptionCode ) { $mock->expects( $this->once() ) ->method( 'dieException' ) ->with( $this->isInstanceOf( Exception::class ), $expectedExceptionCode ) - ->will( $this->throwException( ApiUsageException::newWithMessage( - null, - 'mockApiUsageException' - ) ) ); + ->will( $this->throwException( $apiUsageException ) ); } else { $mock->expects( $this->never() ) ->method( 'dieException' ); } + // TODO: Remove the deprecated dieError when it is not used any more. + $dieWithErrorCodeMethods = $this->logicalOr( 'dieWithError', 'dieError' ); + if ( $expectedErrorCode ) { $mock->expects( $this->once() ) - ->method( 'dieError' ) - ->with( $this->isType( 'string' ), $expectedErrorCode ) - ->will( $this->throwException( ApiUsageException::newWithMessage( - null, - 'mockApiUsageException' - ) ) ); + ->method( $dieWithErrorCodeMethods ) + ->with( $this->anything(), $expectedErrorCode ) + ->will( $this->throwException( $apiUsageException ) ); } else { $mock->expects( $this->never() ) - ->method( 'dieError' ); + ->method( $dieWithErrorCodeMethods ); } return $mock; diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/RepoHooksTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/RepoHooksTest.php index bcc1330..c3d0caf 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/RepoHooksTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/RepoHooksTest.php @@ -11,6 +11,7 @@ use OutputPage; use ParserOutput; use RequestContext; +use SkinTemplate; use stdClass; use Title; use Wikibase\Repo\WikibaseRepo; @@ -53,6 +54,50 @@ return WikibaseRepo::getDefaultInstance()->getSettings(); } + public function onBeforePageDisplayProviderMobile() { + $wikibaseMobile = [ 'wikibase.mobile' ]; + + return [ + 'Mobile entity page' => [ + $wikibaseMobile, + true, + ], + 'Mobile non-entity page' => [ + [], + false + ], + ]; + } + + /** + * @dataProvider onBeforePageDisplayProviderMobile + */ + public function testOnBeforePageDisplayMobile( $expectedModules, $isEntityNamespace ) { + if ( $isEntityNamespace ) { + $namespace = array_values( WikibaseRepo::getDefaultInstance()->getEntityNamespaces() )[0]; + } else { + $namespace = NS_TALK; + } + + $title = $this->getMock( Title::class ); + $title->expects( $this->once() ) + ->method( 'getNamespace' ) + ->willReturn( $namespace ); + + $context = new DerivativeContext( RequestContext::getMain() ); + $context->setTitle( $title ); + + $outputPage = new OutputPage( $context ); + + $skin = $this->getMock( SkinTemplate::class ); + RepoHooks::onBeforePageDisplayMobile( + $outputPage, + $skin + ); + + $this->assertSame( $expectedModules, $outputPage->getModules() ); + } + public function testOnAPIQuerySiteInfoGeneralInfo() { $api = $this->getMockBuilder( ApiQuerySiteinfo::class ) ->disableOriginalConstructor() diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php index 9343d4c..8687262 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php @@ -108,7 +108,8 @@ }, ] ), - new SqlIdGenerator( wfGetLB() ) + new SqlIdGenerator( wfGetLB() ), + $wikibaseRepo->getEntityIdComposer() ); return [ $store, $lookup ]; diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index e90f0d0..4e8e4a1 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -122,12 +122,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-ArticlePlaceholder.git", - "reference": "31e27f4c8eb0e94c042b985ffe574c6fcfb5113f" + "reference": "71904258618ca4818790cc71b0e965d3bb9bfe7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/31e27f4c8eb0e94c042b985ffe574c6fcfb5113f", - "reference": "31e27f4c8eb0e94c042b985ffe574c6fcfb5113f", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/71904258618ca4818790cc71b0e965d3bb9bfe7a", + "reference": "71904258618ca4818790cc71b0e965d3bb9bfe7a", "shasum": "" }, "require": { @@ -138,7 +138,7 @@ "jakub-onderka/php-parallel-lint": "0.9.2", "wikibase/wikibase-codesniffer": "^0.1.0" }, - "time": "2017-07-20 20:33:52", + "time": "2017-07-22 20:26:23", "type": "mediawiki-extension", "installation-source": "dist", "autoload": { @@ -1380,12 +1380,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "0dcf45a2c0ca49f6ef18daade6944e636cac7ad8" + "reference": "de6d3c795b8e0f5d255f47006817b34fe0ad1c2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/0dcf45a2c0ca49f6ef18daade6944e636cac7ad8", - "reference": "0dcf45a2c0ca49f6ef18daade6944e636cac7ad8", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/de6d3c795b8e0f5d255f47006817b34fe0ad1c2c", + "reference": "de6d3c795b8e0f5d255f47006817b34fe0ad1c2c", "shasum": "" }, "require": { @@ -1408,7 +1408,7 @@ "wikibase/internal-serialization": "^2.2.0", "wikibase/javascript-api": "^2.2.2", "wikibase/serialization-javascript": "^2.0.8", - "wikimedia/purtle": "^1.0.3" + "wikimedia/purtle": "^1.0.6" }, "conflict": { "mediawiki/mediawiki": "<1.25" @@ -1418,7 +1418,7 @@ "jakub-onderka/php-parallel-lint": ">=0.3 <0.10", "wikibase/wikibase-codesniffer": "^0.1.0" }, - "time": "2017-07-21 07:21:50", + "time": "2017-07-23 12:04:25", "type": "mediawiki-extension", "installation-source": "dist", "autoload": { @@ -1771,7 +1771,7 @@ "source": { "type": "git", "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQualityConstraints", - "reference": "5c1eaffb37a25649621c9a3388387f84f3ca3f0d" + "reference": "dcb71e325e2e8b4e390ccbc676b22c0090a0acc8" }, "require": { "php": ">=5.5.9", @@ -1787,7 +1787,7 @@ "satooshi/php-coveralls": "master-dev", "wikibase/wikibase-codesniffer": "^0.1.0" }, - "time": "2017-06-13 14:18:55", + "time": "2017-07-22 21:03:19", "type": "mediawiki-extension", "installation-source": "source", "autoload": { -- To view, visit https://gerrit.wikimedia.org/r/367374 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7a02af92fd7d2f610a39a59c6b8bda8fb46a477d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikidata Gerrit-Branch: master Gerrit-Owner: WikidataBuilder <wikidata-servi...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits