r108505 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108504‎ | r108505 | r108506 >
Date:15:17, 10 January 2012
Author:gregchiasson
Status:ok
Tags:
Comment:
Remove boneheaded non-use of insertId in AFTv5 (actually already being used, just not passed into saveUserProperties for some reason). follow up to r106965
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
@@ -90,7 +90,7 @@
9191 $ctaId = $ratingIds['cta_id'];
9292 $feedbackId = $ratingIds['feedback_id'];
9393
94 - $this->saveUserProperties( $revisionId );
 94+ $this->saveUserProperties( $feedbackId );
9595 $this->updateRollupTables( $pageId, $revisionId, $user_answers );
9696
9797 if ( $params['email'] ) {
@@ -554,7 +554,7 @@
555555 * Inserts or updates properties for a specific rating
556556 * @param $revisionId int Revision ID
557557 */
558 - private function saveUserProperties( $revisionId ) {
 558+ private function saveUserProperties( $feedbackId ) {
559559 global $wgUser;
560560 $dbw = wfGetDB( DB_MASTER );
561561 $dbr = wfGetDB( DB_SLAVE );
@@ -565,28 +565,6 @@
566566 return null;
567567 }
568568
569 - // I'd really rather have this passed in, to save a query,
570 - // and rule out consistency problems, but there doesn't seem
571 - // to be a way to do 'RETUNING af_id' on the insert, or to
572 - // pre-increment the ID column (since it's a MySQL auto-
573 - // increment, not a sequence) before the insert. So, fetch
574 - // the most recent feedback ID for this user on this revision.
575 - // This gets called imediately after saving, so it'll almost
576 - // certainly be the right one.
577 - $feedbackId = $dbr->selectField(
578 - 'aft_article_feedback',
579 - 'af_id',
580 - array(
581 - 'af_revision_id' => $revisionId,
582 - 'af_user_id' => $wgUser->getId()
583 - ),
584 - __METHOD__,
585 - array(
586 - 'ORDER BY' => 'af_id DESC',
587 - 'LIMIT' => 1
588 - )
589 - );
590 -
591569 // Total edits by this user
592570 $rows[] = array(
593571 'afp_feedback_id' => $feedbackId,

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106965AFTv5 - enable use of feedback properties table to store user edit counts (if...gregchiasson19:04, 21 December 2011

Status & tagging log