Anomie has uploaded a new change for review. https://gerrit.wikimedia.org/r/255487
Change subject: Fix DAO brokenness with respect to auto-increment fields ...................................................................... Fix DAO brokenness with respect to auto-increment fields The auto-increment field's value needs to be updated on insert, not on update. Not touching the fact that correct operation really requires a call to $dbw->nextSequenceValue(), since this extension currently only seems to support MySQL and SQLite and neither of those care. Change-Id: I26c18729297db4c70f0f4f8501a44fe0689913e9 --- M backend/MWOAuthDAO.php 1 file changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth refs/changes/87/255487/1 diff --git a/backend/MWOAuthDAO.php b/backend/MWOAuthDAO.php index 2da10a2..70d2180 100644 --- a/backend/MWOAuthDAO.php +++ b/backend/MWOAuthDAO.php @@ -167,10 +167,6 @@ array( $idColumn => $uniqueId ), __METHOD__ ); - $afield = static::getAutoIncrField(); - if ( $afield !== null ) { // update field for auto-increment field - $this->$afield = $dbw->insertId(); - } $this->daoPending = false; return $dbw->affectedRows() > 0; } else { @@ -179,11 +175,16 @@ } } else { $this->logger->debug( get_class( $this ) . ': performing DB update; new object.' ); + $afield = static::getAutoIncrField(); + // TODO: $this->$afield = $dbw->nextSequenceValue( ??? ) $dbw->insert( static::getTable(), $this->getRowArray( $dbw ), __METHOD__ ); + if ( $afield !== null ) { // update field for auto-increment field + $this->$afield = $dbw->insertId(); + } $this->daoPending = false; return true; } -- To view, visit https://gerrit.wikimedia.org/r/255487 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26c18729297db4c70f0f4f8501a44fe0689913e9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OAuth Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits