Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/78217


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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/17/78217/1

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: newchange
Gerrit-Change-Id: Ib96adf2c5864b94869a5531f35d994f5906be768
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to