Aude has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/345783 )
Change subject: Update Wikidata - fixes for special pages
......................................................................
Update Wikidata - fixes for special pages
Change-Id: I4c410d9c0a94fafe3bbb1302abfc8e462536bbef
---
M composer.lock
M extensions/Wikibase/repo/i18n/en.json
M extensions/Wikibase/repo/i18n/qqq.json
M extensions/Wikibase/repo/includes/Specials/SpecialEntitiesWithoutPage.php
M extensions/Wikibase/repo/includes/Specials/SpecialModifyTerm.php
M extensions/Wikibase/repo/includes/Specials/SpecialSetSiteLink.php
M
extensions/Wikibase/repo/tests/phpunit/includes/Specials/SpecialEntitiesWithoutPageTest.php
M vendor/composer/installed.json
8 files changed, 68 insertions(+), 43 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata
refs/changes/83/345783/1
diff --git a/composer.lock b/composer.lock
index c6b5970..957cdfc 100644
--- a/composer.lock
+++ b/composer.lock
@@ -987,7 +987,7 @@
"support": {
"issues":
"https://phabricator.wikimedia.org/project/profile/1202/"
},
- "time": "2017-03-17 08:42:47"
+ "time": "2017-03-17 08:11:43"
},
{
"name": "wikibase/data-model",
@@ -1436,12 +1436,12 @@
"source": {
"type": "git",
"url":
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git",
- "reference": "0bca144964d2214aba02786e7eb4d384be926988"
+ "reference": "b87735ae4a8f06246497c76883ff0c147afd138a"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/0bca144964d2214aba02786e7eb4d384be926988",
- "reference": "0bca144964d2214aba02786e7eb4d384be926988",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/b87735ae4a8f06246497c76883ff0c147afd138a",
+ "reference": "b87735ae4a8f06246497c76883ff0c147afd138a",
"shasum": ""
},
"require": {
@@ -1515,7 +1515,7 @@
"wikibaserepo",
"wikidata"
],
- "time": "2017-03-26 22:33:16"
+ "time": "2017-03-30 23:11:18"
},
{
"name": "wikibase/wikimedia-badges",
diff --git a/extensions/Wikibase/repo/i18n/en.json
b/extensions/Wikibase/repo/i18n/en.json
index 4cb4e3a..eb628bc 100644
--- a/extensions/Wikibase/repo/i18n/en.json
+++ b/extensions/Wikibase/repo/i18n/en.json
@@ -288,7 +288,6 @@
"wikibase-entitieswithoutlabel-legend": "Get list of entities without
label",
"wikibase-entitieswithoutlabel-label-language": "Language code:",
"wikibase-entitieswithoutlabel-label-type": "Type:",
- "wikibase-entitieswithoutlabel-label-alltypes": "all",
"wikibase-entitieswithoutlabel-submit": "Find",
"wikibase-entitieswithoutlabel-invalid-language": "\"$1\" is not a
valid language code.",
"wikibase-entitieswithoutlabel-invalid-type": "\"$1\" is not a valid
entity type.",
diff --git a/extensions/Wikibase/repo/i18n/qqq.json
b/extensions/Wikibase/repo/i18n/qqq.json
index 1e4d5f2..6605b39 100644
--- a/extensions/Wikibase/repo/i18n/qqq.json
+++ b/extensions/Wikibase/repo/i18n/qqq.json
@@ -320,7 +320,6 @@
"wikibase-entitieswithoutlabel-legend": "Legend of the form that allow
to change the language.",
"wikibase-entitieswithoutlabel-label-language": "Label for the input
field to change the language code.\n{{Identical|Language code}}",
"wikibase-entitieswithoutlabel-label-type": "Label of the entity type
selector that allows to restrict the request to one type.\n{{Identical|Type}}",
- "wikibase-entitieswithoutlabel-label-alltypes": "Label of the entity
type selector entry that allows to output missing labels for all entity
types.\n{{Identical|All}}",
"wikibase-entitieswithoutlabel-submit": "Label for the button that
activate the action.\n{{Identical|Find}}",
"wikibase-entitieswithoutlabel-invalid-language": "Error message shown
when the language code passed in parameter is invalid.\n\nParameters:\n* $1 -
language code\nSee also:\n*
{{msg-mw|Wikibase-unconnectedpages-invalid-language}}",
"wikibase-entitieswithoutlabel-invalid-type": "Parameters:\n* $1 - an
invalid entity type. Valid entity types are: item, property and query.",
diff --git
a/extensions/Wikibase/repo/includes/Specials/SpecialEntitiesWithoutPage.php
b/extensions/Wikibase/repo/includes/Specials/SpecialEntitiesWithoutPage.php
index 70c0ab6..b261005 100644
--- a/extensions/Wikibase/repo/includes/Specials/SpecialEntitiesWithoutPage.php
+++ b/extensions/Wikibase/repo/includes/Specials/SpecialEntitiesWithoutPage.php
@@ -100,7 +100,7 @@
$this->prepareArguments( $subPage );
$this->setForm();
- if ( $this->language !== '' ) {
+ if ( $this->language !== '' && $this->type !== '' ) {
$this->showQuery();
}
}
@@ -125,17 +125,20 @@
$this->language = $request->getText( 'language',
$this->language );
if ( $this->language !== '' &&
!$this->termsLanguages->hasLanguage( $this->language ) ) {
- $this->showErrorHTML( $this->msg(
'wikibase-entitieswithoutlabel-invalid-language', $this->language )->parse() );
+ $this->showErrorHTML( $this->msg(
+
'wikibase-entitieswithoutlabel-invalid-language',
+ wfEscapeWikiText( $this->language )
+ )->parse() );
$this->language = '';
}
$this->type = $request->getText( 'type', $this->type );
- if ( $this->type === '' ) {
- $this->type = null;
- }
- if ( $this->type !== null && !in_array( $this->type,
$this->entityTypes ) ) {
- $this->showErrorHTML( $this->msg(
'wikibase-entitieswithoutlabel-invalid-type', $this->type )->parse() );
- $this->type = null;
+ if ( $this->type !== '' && !in_array( $this->type,
$this->entityTypes ) ) {
+ $this->showErrorHTML( $this->msg(
+ 'wikibase-entitieswithoutlabel-invalid-type',
+ wfEscapeWikiText( $this->type )
+ )->parse() );
+ $this->type = '';
}
}
@@ -157,13 +160,17 @@
* Build the HTML form
*/
private function setForm() {
- $options = array(
- $this->msg(
'wikibase-entitieswithoutlabel-label-alltypes' )->text() => ''
- );
+ $options = array();
foreach ( $this->entityTypes as $type ) {
- // Messages: wikibase-entity-item,
wikibase-entity-property, wikibase-entity-query
+ // Messages: wikibase-entity-item,
wikibase-entity-property
$options[$this->msg( 'wikibase-entity-' . $type
)->text()] = $type;
+ }
+
+ if ( $this->type !== null && $this->type !== '' ) {
+ $defaultType = $this->type;
+ } else {
+ $defaultType = reset( $this->entityTypes );
}
$formDescriptor = array(
@@ -179,7 +186,7 @@
'type' => array(
'name' => 'type',
'options' => $options,
- 'default' => $this->type,
+ 'default' => $defaultType,
'type' => 'select',
'id' => 'wb-entitieswithoutpage-type',
'label-message' =>
'wikibase-entitieswithoutlabel-label-type'
@@ -213,7 +220,7 @@
return $this->entitiesWithoutTerm->getEntitiesWithoutTerm(
$this->termType,
$this->language,
- $this->type === null ? null : [ $this->type ],
+ [ $this->type ],
$limit,
$offset
);
diff --git a/extensions/Wikibase/repo/includes/Specials/SpecialModifyTerm.php
b/extensions/Wikibase/repo/includes/Specials/SpecialModifyTerm.php
index 9c25aa4..3ee17c7 100644
--- a/extensions/Wikibase/repo/includes/Specials/SpecialModifyTerm.php
+++ b/extensions/Wikibase/repo/includes/Specials/SpecialModifyTerm.php
@@ -98,7 +98,7 @@
if ( $this->languageCode !== null &&
!$this->termsLanguages->hasLanguage( $this->languageCode ) ) {
$errorMessage = $this->msg(
'wikibase-wikibaserepopage-invalid-langcode',
- $this->languageCode
+ wfEscapeWikiText( $this->languageCode )
)->parse();
$this->showErrorHTML( $errorMessage );
diff --git a/extensions/Wikibase/repo/includes/Specials/SpecialSetSiteLink.php
b/extensions/Wikibase/repo/includes/Specials/SpecialSetSiteLink.php
index 29bb92e..637cf78 100644
--- a/extensions/Wikibase/repo/includes/Specials/SpecialSetSiteLink.php
+++ b/extensions/Wikibase/repo/includes/Specials/SpecialSetSiteLink.php
@@ -135,7 +135,10 @@
}
if ( $this->site !== null && !$this->isValidSiteId( $this->site
) ) {
- $this->showErrorHTML( $this->msg(
'wikibase-setsitelink-invalid-site', $this->site )->parse() );
+ $this->showErrorHTML( $this->msg(
+ 'wikibase-setsitelink-invalid-site',
+ wfEscapeWikiText( $this->site )
+ )->parse() );
}
$this->page = $request->getVal( 'page' );
diff --git
a/extensions/Wikibase/repo/tests/phpunit/includes/Specials/SpecialEntitiesWithoutPageTest.php
b/extensions/Wikibase/repo/tests/phpunit/includes/Specials/SpecialEntitiesWithoutPageTest.php
index 930e3c3..1de337a 100644
---
a/extensions/Wikibase/repo/tests/phpunit/includes/Specials/SpecialEntitiesWithoutPageTest.php
+++
b/extensions/Wikibase/repo/tests/phpunit/includes/Specials/SpecialEntitiesWithoutPageTest.php
@@ -54,7 +54,7 @@
$this->assertContains(
'(wikibase-entitieswithoutlabel-label-type)', $html );
$this->assertContains( 'name=\'type\'', $html );
$this->assertContains( 'id=\'wb-entitieswithoutpage-type\'',
$html );
- $this->assertContains(
'(wikibase-entitieswithoutlabel-label-alltypes)', $html );
+ $this->assertContains( '(wikibase-entity-item)', $html );
$this->assertContains(
'(wikibase-entitieswithoutlabel-submit)', $html );
$this->assertContains(
'id=\'wikibase-entitieswithoutpage-submit\'', $html );
@@ -62,52 +62,69 @@
public function testRequestParameters() {
$request = new FauxRequest( array(
- 'language' => '<LANGUAGE>',
- 'type' => '<TYPE>',
+ 'language' => "''LANGUAGE''",
+ 'type' => "''TYPE''",
) );
list( $html, ) = $this->executeSpecialPage( '', $request );
- $this->assertContains( '<LANGUAGE>', $html );
- $this->assertContains( '<TYPE>', $html );
- $this->assertNotContains( '<LANGUAGE>', $html );
- $this->assertNotContains( '<TYPE>', $html );
+ $this->assertContains( '''LANGUAGE''', $html );
+ $this->assertContains( '''TYPE''', $html );
+ $this->assertNotContains( "''LANGUAGE''", $html );
+ $this->assertNotContains( "''TYPE''", $html );
$this->assertNotContains( '&', $html, 'no double escaping'
);
}
public function testSubPageParts() {
- list( $html, ) = $this->executeSpecialPage( '<LANGUAGE>/<TYPE>'
);
+ list( $html, ) = $this->executeSpecialPage(
"''LANGUAGE''/''TYPE''" );
- $this->assertContains( '<LANGUAGE>', $html );
- $this->assertContains( '<TYPE>', $html );
+ $this->assertContains( '''LANGUAGE''', $html );
+ $this->assertContains( '''TYPE''', $html );
}
- public function testNoLanguage() {
+ public function testNoParams() {
list( $html, ) = $this->executeSpecialPage( '', null, 'qqx' );
$this->assertNotContains( 'class="mw-spcontent"', $html );
+ $this->assertNotContains( '(htmlform-invalid-input)', $html );
+ }
+
+ public function testNoLanguage() {
+ $request = new FauxRequest( [ 'type' => 'item' ] );
+ list( $html, ) = $this->executeSpecialPage( '', $request, 'qqx'
);
+
+ $this->assertNotContains( 'class="mw-spcontent"', $html );
+ $this->assertNotContains( '(htmlform-invalid-input)', $html );
+ }
+
+ public function testNoType() {
+ list( $html, ) = $this->executeSpecialPage( 'acceptedlanguage',
null, 'qqx' );
+
+ $this->assertNotContains( 'class="mw-spcontent"', $html );
+ $this->assertNotContains( '(htmlform-invalid-input)', $html );
}
public function testInvalidLanguage() {
- list( $html, ) = $this->executeSpecialPage( '<INVALID>', null,
'qqx' );
+ list( $html, ) = $this->executeSpecialPage( "''INVALID''",
null, 'qqx' );
$this->assertContains(
- '(wikibase-entitieswithoutlabel-invalid-language:
<INVALID>)',
+ '(wikibase-entitieswithoutlabel-invalid-language:
''INVALID'')',
$html
);
}
public function testValidLanguage() {
- list( $html, ) = $this->executeSpecialPage( 'acceptedlanguage',
null, 'qqx' );
+ $request = new FauxRequest( [ 'type' => 'item' ] );
+ list( $html, ) = $this->executeSpecialPage( 'acceptedlanguage',
$request, 'qqx' );
$this->assertContains( 'value=\'acceptedlanguage\'', $html );
$this->assertContains( 'class="mw-spcontent"', $html );
}
public function testInvalidType() {
- list( $html, ) = $this->executeSpecialPage(
'acceptedlanguage/<INVALID>', null, 'qqx' );
+ list( $html, ) = $this->executeSpecialPage(
"acceptedlanguage/''INVALID''", null, 'qqx' );
$this->assertContains(
- '(wikibase-entitieswithoutlabel-invalid-type:
<INVALID>)',
+ '(wikibase-entitieswithoutlabel-invalid-type:
''INVALID'')',
$html
);
}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 8bd93e0..d514396 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1628,12 +1628,12 @@
"source": {
"type": "git",
"url":
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git",
- "reference": "0bca144964d2214aba02786e7eb4d384be926988"
+ "reference": "b87735ae4a8f06246497c76883ff0c147afd138a"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/0bca144964d2214aba02786e7eb4d384be926988",
- "reference": "0bca144964d2214aba02786e7eb4d384be926988",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/b87735ae4a8f06246497c76883ff0c147afd138a",
+ "reference": "b87735ae4a8f06246497c76883ff0c147afd138a",
"shasum": ""
},
"require": {
@@ -1665,7 +1665,7 @@
"jakub-onderka/php-parallel-lint": ">=0.3 <0.10",
"mediawiki/mediawiki-codesniffer": ">=0.4 <0.8"
},
- "time": "2017-03-26 22:33:16",
+ "time": "2017-03-30 23:11:18",
"type": "mediawiki-extension",
"installation-source": "dist",
"autoload": {
--
To view, visit https://gerrit.wikimedia.org/r/345783
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c410d9c0a94fafe3bbb1302abfc8e462536bbef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: wmf/1.29.0-wmf.17
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits