Soeren.oldag has uploaded a new change for review. https://gerrit.wikimedia.org/r/219178
Change subject: Added overwrite switch for SqlViolationRepo. ...................................................................... Added overwrite switch for SqlViolationRepo. Change-Id: I404db9ce415649c0b52bc2be5b52b018935f7b91 --- M includes/Violations/SqlViolationRepo.php M includes/Violations/ViolationStore.php 2 files changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataQuality refs/changes/78/219178/1 diff --git a/includes/Violations/SqlViolationRepo.php b/includes/Violations/SqlViolationRepo.php index 54f6e35..40d5181 100755 --- a/includes/Violations/SqlViolationRepo.php +++ b/includes/Violations/SqlViolationRepo.php @@ -106,12 +106,16 @@ /** * @param Violation $violation + * @param bool $overwriteExisting * @return bool */ - public function insert( Violation $violation ) { + public function insert( Violation $violation, $overwriteExisting = false ) { $db = wfGetDB( DB_MASTER ); if( $this->violationExists( $db, $violation ) ) { + if( $overwriteExisting ) { + return $this->update( $violation, false ); + } throw new InvalidArgumentException( 'Given violation already exists in database.' ); } diff --git a/includes/Violations/ViolationStore.php b/includes/Violations/ViolationStore.php index 8893cd5..0c586e8 100644 --- a/includes/Violations/ViolationStore.php +++ b/includes/Violations/ViolationStore.php @@ -15,9 +15,10 @@ * Inserts given violation into database. * * @param Violation $violation + * @param bool $overwriteExisting * @return mixed */ - public function insert( Violation $violation ); + public function insert( Violation $violation, $overwriteExisting = false ); /** * Updates given violation in database. -- To view, visit https://gerrit.wikimedia.org/r/219178 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I404db9ce415649c0b52bc2be5b52b018935f7b91 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikidataQuality Gerrit-Branch: master Gerrit-Owner: Soeren.oldag <soeren_ol...@freenet.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits