Reedy has uploaded a new change for review.
https://gerrit.wikimedia.org/r/171789
Change subject: Handle TemplateParser::parsePage() returning an empty array
......................................................................
Handle TemplateParser::parsePage() returning an empty array
Bug: 73107
Change-Id: I0361a6bd8f6103559a5cfc91fb99b706a39223df
---
M DataCollector.php
1 file changed, 5 insertions(+), 1 deletion(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CommonsMetadata
refs/changes/89/171789/1
diff --git a/DataCollector.php b/DataCollector.php
index 018954b..3416b16 100644
--- a/DataCollector.php
+++ b/DataCollector.php
@@ -109,8 +109,12 @@
* - no-source - failed to detect the source of the image or a custom
attribution text
*/
public function verifyAttributionMetadata( $descriptionText ) {
- $problems = array();
$templateData = $this->templateParser->parsePage(
$descriptionText );
+ if ( $templateData === array() ) {
+ return array( 'no-license', 'no-description',
'no-author', 'no-source' );
+ }
+
+ $problems = array();
$licenseData = $this->selectLicense(
$templateData[TemplateParser::LICENSES_KEY] );
$informationData = $this->selectInformationTemplate(
$templateData[TemplateParser::INFORMATION_FIELDS_KEY] );
--
To view, visit https://gerrit.wikimedia.org/r/171789
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0361a6bd8f6103559a5cfc91fb99b706a39223df
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CommonsMetadata
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits