jenkins-bot has submitted this change and it was merged.
Change subject: Get rid of deprecated method usage in SpecialNewProperty
......................................................................
Get rid of deprecated method usage in SpecialNewProperty
Also cleaned up code a little
Change-Id: Ib96adf2c5864b94869a5531f35d994f5906be768
---
M repo/includes/specials/SpecialNewProperty.php
1 file changed, 8 insertions(+), 7 deletions(-)
Approvals:
Tobias Gritschacher: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/specials/SpecialNewProperty.php
b/repo/includes/specials/SpecialNewProperty.php
index bc1e159..6fada60 100644
--- a/repo/includes/specials/SpecialNewProperty.php
+++ b/repo/includes/specials/SpecialNewProperty.php
@@ -87,21 +87,22 @@
$status = parent::modifyEntity( $propertyContent );
if ( $this->dataType !== '' ) {
- $dataTypeFactory =
WikibaseRepo::getDefaultInstance()->getDataTypeFactory();
-
- $dataType = $dataTypeFactory->getType( $this->dataType
);
-
- if ( $dataType === null ) {
- $status->fatal(
'wikibase-newproperty-invalid-datatype' );
+ if ( $this->dataTypeExists() ) {
+ $propertyContent->getProperty()->setDataTypeId(
$this->dataType );
}
else {
- $propertyContent->getProperty()->setDataType(
$dataType );
+ $status->fatal(
'wikibase-newproperty-invalid-datatype' );
}
}
return $status;
}
+ protected function dataTypeExists() {
+ $dataTypeFactory =
WikibaseRepo::getDefaultInstance()->getDataTypeFactory();
+ return $dataTypeFactory->getType( $this->dataType ) !== null;
+ }
+
/**
* @see SpecialNewEntity::additionalFormElements()
*/
--
To view, visit https://gerrit.wikimedia.org/r/78217
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib96adf2c5864b94869a5531f35d994f5906be768
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits