Dominic.sauer has uploaded a new change for review.
https://gerrit.wikimedia.org/r/210052
Change subject: Change prefix from wbq/wdqa to wbqc
......................................................................
Change prefix from wbq/wdqa to wbqc
Change-Id: Icefeb6353e8e9e87f6ba48e7c15ebb81d1482e57
---
M WikidataQualityConstraints.php
M WikidataQualityConstraintsHooks.php
M i18n/en.json
M i18n/qqq.json
M modules/SpecialConstraintReportPage.css
M specials/SpecialConstraintReport.php
A sql/create_wbqc_constraints.sql
D sql/create_wdqa_constraints.sql
M tests/phpunit/Specials/SpecialConstraintReportTest.php
9 files changed, 100 insertions(+), 88 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataQualityConstraints
refs/changes/52/210052/1
diff --git a/WikidataQualityConstraints.php b/WikidataQualityConstraints.php
old mode 100644
new mode 100755
index 04a6fc7..fa15a4a
--- a/WikidataQualityConstraints.php
+++ b/WikidataQualityConstraints.php
@@ -11,7 +11,7 @@
'name' => 'WikidataQualityConstraints',
'author' => 'BP2014N1',
'url' =>
'https://www.mediawiki.org/wiki/Extension:WikidataQualityConstraints',
- 'descriptionmsg' => 'wikidataquality-constraints-desc',
+ 'descriptionmsg' => 'wbqc-constraints-desc',
'version' => '0.0.0'
);
@@ -36,9 +36,9 @@
);
// Define database table names
- define( 'CONSTRAINT_TABLE', 'wdqa_constraints' );
+ define( 'CONSTRAINT_TABLE', 'wbqc_constraints' );
// Jobs
$GLOBALS['wgJobClasses']['evaluateConstraintReportJob'] =
'EvaluateConstraintReportJob';
- $GLOBALS['wgDebugLogGroups']['wdqa_evaluation'] =
'/var/log/mediawiki/wdqa_evaluation.log';
+ $GLOBALS['wgDebugLogGroups']['wbq_evaluation'] =
'/var/log/mediawiki/wbq_evaluation.log';
} );
\ No newline at end of file
diff --git a/WikidataQualityConstraintsHooks.php
b/WikidataQualityConstraintsHooks.php
old mode 100644
new mode 100755
index 45ef5e3..2f6ceec
--- a/WikidataQualityConstraintsHooks.php
+++ b/WikidataQualityConstraintsHooks.php
@@ -8,7 +8,7 @@
* @return bool
*/
public static function onCreateSchema( DatabaseUpdater $updater ) {
- $updater->addExtensionTable( CONSTRAINT_TABLE, __DIR__ .
'/sql/create_wdqa_constraints.sql' );
+ $updater->addExtensionTable( CONSTRAINT_TABLE, __DIR__ .
'/sql/create_wbqc_constraints.sql' );
return true;
}
diff --git a/i18n/en.json b/i18n/en.json
old mode 100644
new mode 100755
index 60e21ce..848784f
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -2,12 +2,12 @@
"@metadata": {
"authors": "BP2014N1"
},
- "wikidataquality-constraintreport": "Constraint report",
- "wikidataquality-constraintreport-explanation-part-one": "This special page
performs constraints checks on every entity you want. The entities are fetched
from the live system so every constraint violation you fix there will be
instantly removed from this list.",
- "wikidataquality-constraintreport-explanation-part-two": "The constraints
are parsed from the property talk pages once a week, so if you
add/delete/modify a constraint it might take up to a week until this gets taken
into account by this constraint report. There is currently work in progress to
migrate the constraints to statements on properties, enabling this special page
to do live-checks.",
- "wikidataquality-constraintreport-empty-result": "There are no constraint
defined on this entity.",
- "wikidataquality-constraintreport-result-table-header-claim": "Claim",
- "wikidataquality-constraintreport-result-table-header-constraint":
"Constraint",
- "wikidataquality-constraintreport-result-link-to-claim": "go to claim",
- "wikidataquality-constraintreport-result-link-to-constraint": "go to
constraint"
+ "wbqc-constraintreport": "Constraint report",
+ "wbqc-constraintreport-explanation-part-one": "This special page performs
constraints checks on every entity you want. The entities are fetched from the
live system so every constraint violation you fix there will be instantly
removed from this list.",
+ "wbqc-constraintreport-explanation-part-two": "The constraints are parsed
from the property talk pages once a week, so if you add/delete/modify a
constraint it might take up to a week until this gets taken into account by
this constraint report. There is currently work in progress to migrate the
constraints to statements on properties, enabling this special page to do
live-checks.",
+ "wbqc-constraintreport-empty-result": "There are no constraint defined on
this entity.",
+ "wbqc-constraintreport-result-table-header-claim": "Claim",
+ "wbqc-constraintreport-result-table-header-constraint": "Constraint",
+ "wbqc-constraintreport-result-link-to-claim": "go to claim",
+ "wbqc-constraintreport-result-link-to-constraint": "go to constraint"
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
old mode 100644
new mode 100755
index d92920d..faebf27
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -7,12 +7,11 @@
"Robby"
]
},
- "wikidataquality-constraintreport": "{{doc-special|ConstraintReport}}",
- "wikidataquality-constraintreport-explanation-part-one": "Explanation
(part one), what this special page does and how it gets its data.",
- "wikidataquality-constraintreport-explanation-part-one": "Explanation
(part two), what this special page does and how it gets its data.",
- "wikidataquality-constraintreport-empty-result": "Message that appears,
when there are no constraints defined for the given entity.",
- "wikidataquality-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}}",
- "wikidataquality-constraintreport-result-table-header-constraint":
"Header of the column that gives information about which constraint was
checked.\n{{Identical|Constraint}}",
- "wikidataquality-constraintreport-result-link-to-claim": "Text for the
link to a claim group on the entity page.",
- "wikidataquality-constraintreport-result-link-to-constraint": "Text for
the link to a constraint on the property page."
+ "wbqc-constraintreport": "{{doc-special|ConstraintReport}}",
+ "wbqc-constraintreport-explanation-part-one": "Explanation (part one),
what this special page does and how it gets its data.",
+ "wbqc-constraintreport-empty-result": "Message that appears, when there
are no constraints defined for the given entity.",
+ "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."
}
diff --git a/modules/SpecialConstraintReportPage.css
b/modules/SpecialConstraintReportPage.css
old mode 100644
new mode 100755
index d572b56..f0d2d53
--- a/modules/SpecialConstraintReportPage.css
+++ b/modules/SpecialConstraintReportPage.css
@@ -1,59 +1,59 @@
/* Entity id form */
-.wbq-checkresult-form {
+.wbqc-checkresult-form {
margin-top: 10px;
margin-bottom: 20px;
}
-.wbq-checkresult-form-entity-id {
+.wbqc-checkresult-form-entity-id {
width: 120px;
}
-.wbq-checkresult-form-submit {
+.wbqc-checkresult-form-submit {
margin-left: 5px;
}
/* Notices */
-.wbq-checkresult-notice {
+.wbqc-checkresult-notice {
font-style: italic;
}
-.wbq-checkresult-notice-error {
+.wbqc-checkresult-notice-error {
font-weight: bold;
color: #BA0000;
}
/* Explanation infobox */
-.wbq-explanation {
+.wbqc-explanation {
width: 50%;
}
/* Statuses */
-.wbq-status {
+.wbqc-status {
font-weight: bold;
}
-.wbq-status-success {
+.wbqc-status-success {
color: #008000;
}
-.wbq-status-partial-success {
+.wbqc-status-partial-success {
color: #6CB500;
}
-.wbq-status-warning {
+.wbqc-status-warning {
color: #E6B800;
}
-.wbq-status-error {
+.wbqc-status-error {
color: #BA0000;
}
-.wbq-status-unknown {
+.wbqc-status-unknown {
color: #404040;
}
/* Tooltip */
-.wbq-tooltip-indicator {
+.wbqc-tooltip-indicator {
color: #CCC;
font-weight: 600;
}
diff --git a/specials/SpecialConstraintReport.php
b/specials/SpecialConstraintReport.php
index de7ed60..f66f752 100755
--- a/specials/SpecialConstraintReport.php
+++ b/specials/SpecialConstraintReport.php
@@ -149,6 +149,10 @@
* @see SpecialPage::execute
*
* @param string|null $subPage
+ *
+ * @throws InvalidArgumentException
+ * @throws EntityIdParsingException
+ * @throws UnexpectedValueException
*/
public function execute( $subPage ) {
$out = $this->getOutput();
@@ -181,14 +185,14 @@
$entity = $this->entityLookup->getEntity( $entityId );
} catch ( EntityIdParsingException $e ) {
$out->addHTML(
- $this->buildNotice( $this->msg(
'wikidataquality-checkresult-invalid-entity-id' )->text(), true )
+ $this->buildNotice( $this->msg(
'wbqc-checkresult-invalid-entity-id' )->text(), true )
);
return;
}
if ( !$entity ) {
$out->addHTML(
- $this->buildNotice( $this->msg(
'wikidataquality-checkresult-not-existent-entity' )->text(), true )
+ $this->buildNotice( $this->msg(
'wbqc-checkresult-not-existent-entity' )->text(), true )
);
return;
}
@@ -225,7 +229,7 @@
Html::openElement(
'form',
array (
- 'class' => 'wbq-checkresult-form',
+ 'class' => 'wbqc-checkresult-form',
'action' =>
$this->getPageTitle()->getLocalURL(),
'method' => 'post'
)
@@ -235,16 +239,16 @@
'',
'text',
array (
- 'class' =>
'wbq-checkresult-form-entity-id',
- 'placeholder' => $this->msg(
'wikidataquality-checkresult-form-entityid-placeholder' )->text()
+ 'class' =>
'wbqc-checkresult-form-entity-id',
+ 'placeholder' => $this->msg(
'wbqc-checkresult-form-entityid-placeholder' )->text()
)
)
. Html::input(
'submit',
- $this->msg(
'wikidataquality-checkresult-form-submit-label' )->text(),
+ $this->msg(
'wbqc-checkresult-form-submit-label' )->text(),
'submit',
array (
- 'class' => 'wbq-checkresult-form-submit'
+ 'class' =>
'wbqc-checkresult-form-submit'
)
)
. Html::closeElement( 'form' );
@@ -255,6 +259,8 @@
*
* @param string $message
* @param bool $error
+ *
+ * @throws InvalidArgumentException
*
* @return string
*/
@@ -266,9 +272,9 @@
throw new InvalidArgumentException( '$error must be
bool.' );
}
- $cssClasses = 'wbq-checkresult-notice';
+ $cssClasses = 'wbqc-checkresult-notice';
if ( $error ) {
- $cssClasses .= ' wbq-checkresult-notice-error';
+ $cssClasses .= ' wbqc-checkresult-notice-error';
}
return
@@ -304,17 +310,17 @@
* @return string
*/
public function getDescription() {
- return $this->msg( 'wikidataquality-constraintreport' )->text();
+ return $this->msg( 'wbqc-constraintreport' )->text();
}
protected function getExplanationText() {
return
- Html::openElement( 'div', array( 'class' =>
'wbq-explanation') )
- . $this->msg(
'wikidataquality-constraintreport-explanation-part-one' )
+ Html::openElement( 'div', array( 'class' =>
'wbqc-explanation') )
+ . $this->msg(
'wbqc-constraintreport-explanation-part-one' )
. Html::closeElement( 'div' )
. Html::element( 'br' )
- . Html::openElement( 'div', array( 'class' =>
'wbq-explanation') )
- . $this->msg(
'wikidataquality-constraintreport-explanation-part-two' )
+ . Html::openElement( 'div', array( 'class' =>
'wbqc-explanation') )
+ . $this->msg(
'wbqc-constraintreport-explanation-part-two' )
. Html::closeElement( 'div' );
}
@@ -325,7 +331,7 @@
*/
protected function getEmptyResultText() {
return
- $this->msg(
'wikidataquality-constraintreport-empty-result' )->text();
+ $this->msg( 'wbqc-constraintreport-empty-result'
)->text();
}
/**
@@ -351,7 +357,7 @@
/**
* @see SpecialCheckResultPage::buildResultTable
*
- * @param EntityId
+ * @param EntityId $entityId
* @param array|Traversable $results
*
* @return string
@@ -361,15 +367,15 @@
$table = new HtmlTable(
array (
new HtmlTableHeader(
- $this->msg(
'wikidataquality-checkresult-result-table-header-status' )->text(),
+ $this->msg(
'wbqc-checkresult-result-table-header-status' )->text(),
true
),
new HtmlTableHeader(
- $this->msg(
'wikidataquality-constraintreport-result-table-header-claim' )->text(),
+ $this->msg(
'wbqc-constraintreport-result-table-header-claim' )->text(),
true
),
new HtmlTableHeader(
- $this->msg(
'wikidataquality-constraintreport-result-table-header-constraint' )->text(),
+ $this->msg(
'wbqc-constraintreport-result-table-header-constraint' )->text(),
true
)
)
@@ -435,8 +441,8 @@
$entityId->getSerialization() );
return
- Html::openElement( 'h3', array( 'class' => 'wbq-clear'
) ) //TODO delete if not wished
- . $this->msg(
'wikidataquality-checkresult-result-headline', $entityLink )->text()
+ Html::openElement( 'h3', array( 'class' => 'wbqc-clear'
) ) //TODO delete if not wished
+ . $this->msg( 'wbqc-checkresult-result-headline',
$entityLink )->text()
. Html::closeElement( 'h3' );
}
@@ -463,7 +469,7 @@
if ( $count > 0 ) {
$statusElements[ ] =
$this->formatStatus( $status )
- . ": "
+ . ': '
. $count;
}
}
@@ -481,6 +487,9 @@
*
* @param string $content
* @param string $tooltipContent
+ * @param $indicator
+ *
+ * @throws InvalidArgumentException
*
* @return string
*/
@@ -499,7 +508,7 @@
$tooltipIndicator = Html::element(
'span',
array (
- 'class' => 'wbq-tooltip-indicator'
+ 'class' => 'wbqc-tooltip-indicator'
),
$indicator
);
@@ -519,6 +528,8 @@
* Formats given status to html
*
* @param string $status
+ *
+ * @throws InvalidArgumentException
*
* @return string
*/
@@ -527,7 +538,7 @@
throw new InvalidArgumentException( '$status has to be
string.' );
}
- $messageName = "wikidataquality-checkresult-status-" .
strtolower( $status );
+ $messageName = 'wbqc-checkresult-status-' . strtolower( $status
);
$message = $this->msg( $messageName )->text();
$statusMapping = $this->getStatusMapping();
@@ -541,7 +552,7 @@
Html::element(
'span',
array (
- 'class' => 'wbq-status wbq-status-' .
$genericStatus
+ 'class' => 'wbqc-status wbqc-status-' .
$genericStatus
),
$message
);
@@ -554,6 +565,8 @@
*
* @param DataValue|array $dataValues
* @param string $separator
+ *
+ * @throws InvalidArgumentException
*
* @return string
*/
diff --git a/sql/create_wbqc_constraints.sql b/sql/create_wbqc_constraints.sql
new file mode 100755
index 0000000..7b371c1
--- /dev/null
+++ b/sql/create_wbqc_constraints.sql
@@ -0,0 +1,12 @@
+CREATE TABLE IF NOT EXISTS /*_*/wbqc_constraints (
+ constraint_guid VARCHAR(255) PRIMARY KEY,
+ pid INT(11) NOT NULL,
+ constraint_type_qid VARCHAR(255) NOT NULL,
+ constraint_parameters TEXT DEFAULT
NULL
+) /*$wgDBTableOptions*/;
+
+CREATE INDEX /*i*/wbqc_constraints_pid_index
+ON /*_*/wbqc_constraints (pid);
+
+CREATE INDEX /*i*/wbqc_constraints_constraint_type_qid_index
+ON /*_*/wbqc_constraints (constraint_type_qid);
\ No newline at end of file
diff --git a/sql/create_wdqa_constraints.sql b/sql/create_wdqa_constraints.sql
deleted file mode 100644
index cf0cb05..0000000
--- a/sql/create_wdqa_constraints.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-CREATE TABLE IF NOT EXISTS /*_*/wdqa_constraints (
- constraint_guid VARCHAR(255) PRIMARY KEY,
- pid INT(11) NOT NULL,
- constraint_type_qid VARCHAR(255) NOT NULL,
- constraint_parameters TEXT DEFAULT
NULL
-) /*$wgDBTableOptions*/;
-
-CREATE INDEX /*i*/wdqa_constraints_pid_index
-ON /*_*/wdqa_constraints (pid);
-
-CREATE INDEX /*i*/wqda_constraints_constraint_type_qid_index
-ON /*_*/wdqa_constraints (constraint_type_qid);
\ No newline at end of file
diff --git a/tests/phpunit/Specials/SpecialConstraintReportTest.php
b/tests/phpunit/Specials/SpecialConstraintReportTest.php
index c955097..f37beb1 100755
--- a/tests/phpunit/Specials/SpecialConstraintReportTest.php
+++ b/tests/phpunit/Specials/SpecialConstraintReportTest.php
@@ -161,29 +161,29 @@
// Empty input
$matchers[ 'explanationOne' ] = array (
'tag' => 'div',
- 'content' =>
'(wikidataquality-constraintreport-explanation-part-one)'
+ 'content' =>
'(wbqc-constraintreport-explanation-part-one)'
);
$matchers[ 'explanationTwo' ] = array (
'tag' => 'div',
- 'content' =>
'(wikidataquality-constraintreport-explanation-part-two)'
+ 'content' =>
'(wbqc-constraintreport-explanation-part-two)'
);
$matchers[ 'entityId' ] = array (
'tag' => 'input',
'attributes' => array (
- 'placeholder' =>
'(wikidataquality-checkresult-form-entityid-placeholder)',
+ 'placeholder' =>
'(wbqc-checkresult-form-entityid-placeholder)',
'name' => 'entityId',
- 'class' => 'wbq-checkresult-form-entity-id'
+ 'class' => 'wbqc-checkresult-form-entity-id'
)
);
$matchers[ 'submit' ] = array (
'tag' => 'input',
'attributes' => array (
- 'class' => 'wbq-checkresult-form-submit',
+ 'class' => 'wbqc-checkresult-form-submit',
'type' => 'submit',
- 'value' =>
'(wikidataquality-checkresult-form-submit-label)',
+ 'value' =>
'(wbqc-checkresult-form-submit-label)',
'name' => 'submit'
)
);
@@ -194,9 +194,9 @@
$matchers[ 'error' ] = array (
'tag' => 'p',
'attributes' => array (
- 'class' => 'wbq-checkresult-notice
wbq-checkresult-notice-error'
+ 'class' => 'wbqc-checkresult-notice
wbqc-checkresult-notice-error'
),
- 'content' =>
'(wikidataquality-checkresult-invalid-entity-id)'
+ 'content' => '(wbqc-checkresult-invalid-entity-id)'
);
$cases[ 'invalid input 1' ] = array ( 'Qwertz', array (),
$userLanguage, $matchers );
@@ -207,9 +207,9 @@
$matchers[ 'error' ] = array (
'tag' => 'p',
'attributes' => array (
- 'class' => 'wbq-checkresult-notice
wbq-checkresult-notice-error'
+ 'class' => 'wbqc-checkresult-notice
wbqc-checkresult-notice-error'
),
- 'content' =>
'(wikidataquality-checkresult-not-existent-entity)'
+ 'content' => '(wbqc-checkresult-not-existent-entity)'
);
$cases[ 'valid input - not existing item' ] = array (
@@ -223,7 +223,7 @@
unset( $matchers[ 'error' ] );
$matchers[ 'result for' ] = array (
'tag' => 'h3',
- 'content' =>
'(wikidataquality-checkresult-result-headline:'
+ 'content' => '(wbqc-checkresult-result-headline:'
);
$matchers[ 'result table' ] = array (
@@ -238,7 +238,7 @@
'attributes' => array (
'role' => 'columnheader button'
),
- 'content' =>
'(wikidataquality-checkresult-result-table-header-status)'
+ 'content' =>
'(wbqc-checkresult-result-table-header-status)'
);
$matchers[ 'column claim' ] = array (
@@ -246,7 +246,7 @@
'attributes' => array (
'role' => 'columnheader button'
),
- 'content' =>
'(wikidataquality-constraintreport-result-table-header-claim)'
+ 'content' =>
'(wbqc-constraintreport-result-table-header-claim)'
);
$matchers[ 'column constraint' ] = array (
@@ -254,23 +254,23 @@
'attributes' => array (
'role' => 'columnheader button'
),
- 'content' =>
'(wikidataquality-constraintreport-result-table-header-constraint)'
+ 'content' =>
'(wbqc-constraintreport-result-table-header-constraint)'
);
$matchers[ 'value status - violation' ] = array (
'tag' => 'span',
'attributes' => array (
- 'class' => 'wbq-status wbq-status-error'
+ 'class' => 'wbqc-status wbqc-status-error'
),
- 'content' =>
'(wikidataquality-checkresult-status-violation)'
+ 'content' => '(wbqc-checkresult-status-violation)'
);
$matchers[ 'value status - compliance' ] = array (
'tag' => 'span',
'attributes' => array (
- 'class' => 'wbq-status wbq-status-success'
+ 'class' => 'wbqc-status wbqc-status-success'
),
- 'content' =>
'(wikidataquality-checkresult-status-compliance)'
+ 'content' => '(wbqc-checkresult-status-compliance)'
);
$cases[ 'valid input - existing item' ] = array ( '$id', array
(), $userLanguage, $matchers );
--
To view, visit https://gerrit.wikimedia.org/r/210052
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icefeb6353e8e9e87f6ba48e7c15ebb81d1482e57
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataQualityConstraints
Gerrit-Branch: v1
Gerrit-Owner: Dominic.sauer <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits