jenkins-bot has submitted this change and it was merged.

Change subject: Remove wfLogWarning calls and update comment
......................................................................


Remove wfLogWarning calls and update comment

Change-Id: I151e2ef022623a888ef02eff195788d5be99f4b9
---
M lib/includes/ReferencedUrlFinder.php
M lib/tests/phpunit/ReferencedUrlFinderTest.php
2 files changed, 7 insertions(+), 15 deletions(-)

Approvals:
  Denny Vrandecic: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/includes/ReferencedUrlFinder.php 
b/lib/includes/ReferencedUrlFinder.php
index 8a5e07e..9b7982f 100644
--- a/lib/includes/ReferencedUrlFinder.php
+++ b/lib/includes/ReferencedUrlFinder.php
@@ -7,7 +7,11 @@
 use Wikibase\Lib\PropertyNotFoundException;
 
 /**
- * Finds URLs given a list of entities or a list of claims.
+ * Finds URLs given a list of snaks.
+ *
+ * If a snaks property is not found or the type of DataValue
+ * does not match the expected one for URLs, the snak is ignored
+ * silently.
  *
  * @since 0.4
  *
@@ -65,8 +69,6 @@
 
                if ( $snakValue instanceof StringValue ) {
                        $this->foundURLs[] = $snakValue->getValue();
-               } else {
-                       wfLogWarning( 'Unexpected value type for url: ' . 
$snakValue->getType() );
                }
        }
 
@@ -74,9 +76,6 @@
                try {
                        $type = 
$this->propertyDataTypeLookup->getDataTypeIdForProperty( $propertyId );
                } catch ( PropertyNotFoundException $ex ) {
-                       // FIXME: wrong place to stop exception propagation.
-                       // Either do not catch this here or throw a new 
exception instead.
-                       wfLogWarning( 'No data type known for unknown property 
' . $propertyId );
                        return false;
                }
 
diff --git a/lib/tests/phpunit/ReferencedUrlFinderTest.php 
b/lib/tests/phpunit/ReferencedUrlFinderTest.php
index f87899e..3e30efe 100644
--- a/lib/tests/phpunit/ReferencedUrlFinderTest.php
+++ b/lib/tests/phpunit/ReferencedUrlFinderTest.php
@@ -92,14 +92,7 @@
                $p42 = new EntityId( Property::ENTITY_TYPE, 42 );
                $snaks = array( new PropertyValueSnak( $p42, new StringValue( 
'http://acme.com/test' )  ) );
 
-               wfSuppressWarnings(); // suppress warnings about unknown 
property
-               try {
-                       $actual = $linkFinder->findSnakLinks( $snaks );
-                       $this->assertEmpty( $actual ); // since $p42 isn't 
know, this should return nothing
-
-                       wfRestoreWarnings();
-               } catch ( Exception $exception ) {
-                       wfRestoreWarnings();
-               }
+               $actual = $linkFinder->findSnakLinks( $snaks );
+               $this->assertEmpty( $actual ); // since $p42 isn't know, this 
should return nothing
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/80362
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I151e2ef022623a888ef02eff195788d5be99f4b9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to