Jonaskeutel has uploaded a new change for review.
https://gerrit.wikimedia.org/r/215892
Change subject: escape sql and validate batchSize parameter
......................................................................
escape sql and validate batchSize parameter
Change-Id: I91b4a9859364f4f0b70e5167a5156748cb7449aa
---
M includes/ConstraintRepository.php
1 file changed, 9 insertions(+), 3 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataQualityConstraints
refs/changes/92/215892/1
diff --git a/includes/ConstraintRepository.php
b/includes/ConstraintRepository.php
index c3ce38c..5374a53 100644
--- a/includes/ConstraintRepository.php
+++ b/includes/ConstraintRepository.php
@@ -11,10 +11,12 @@
*/
public function queryConstraintsForProperty( $prop ) {
$db = wfGetDB( DB_SLAVE );
+ $conds = array( 'pid' => $db->addQuotes( $prop ) );
+
$results = $db->select(
CONSTRAINT_TABLE,
'*',
- "pid = $prop"
+ $conds
);
return $this->convertToConstraints( $results );
@@ -46,8 +48,12 @@
return $db->insert( CONSTRAINT_TABLE, $accumulator );
}
-
- public function deleteAll( $batchSize = 1000 ) {
+ /**
+ * @param int $batchSize
+ *
+ * @throws \DBUnexpectedError
+ */
+ public function deleteAll( int $batchSize = 1000 ) {
$db = wfGetDB( DB_MASTER );
if ( $db->getType() === 'sqlite' ) {
$db->delete( CONSTRAINT_TABLE, '*' );
--
To view, visit https://gerrit.wikimedia.org/r/215892
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I91b4a9859364f4f0b70e5167a5156748cb7449aa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataQualityConstraints
Gerrit-Branch: v1
Gerrit-Owner: Jonaskeutel <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits