r71664 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71663‎ | r71664 | r71665 >
Date:21:54, 25 August 2010
Author:reedy
Status:deferred
Tags:
Comment:
Trailing whitespace, rename parameter
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php
@@ -13,22 +13,22 @@
1414 public function execute() {
1515 global $wgUser;
1616 $params = $this->extractRequestParams();
17 -
 17+
1818 $userName = $wgUser->getName();
19 -
 19+
2020 //TODO:Refactor out...?
21 -
 21+
2222 $this->addTables( 'article_assessment' );
23 -
 23+
2424 $this->addFields( array( 'aa_m1', 'aa_m2', 'aa_m3', 'aa_m3' ) );
25 -
 25+
2626 //$this->addWhereFld( 'aa_page_id', $params['pageid'] );
2727
2828 $this->addWhereFld( 'aa_revision', $params['revid'] );
2929 $this->addWhereFld( 'aa_user_text', $userName );
30 -
 30+
3131 $res = $this->select( __METHOD__ );
32 -
 32+
3333 if ( $res ) {
3434 $lastM1 = $res[0]->aa_m1;
3535 $lastM2 = $res[0]->aa_m2;
@@ -45,12 +45,12 @@
4646 $m2 = isset( $params['2'] ) ? $params['2'] : 0;
4747 $m3 = isset( $params['3'] ) ? $params['3'] : 0;
4848 $m4 = isset( $params['4'] ) ? $params['4'] : 0;
49 -
 49+
5050 //Do for each metric/dimension
51 -
 51+
5252 $pageId = $params['pageid'];
5353 $revisionId = $params['revisionid'];
54 -
 54+
5555 $this->insertOrUpdatePages( $pageId, $revisionId, $userName, 1, $m1, ( $m1 - $lastM1 ) );
5656 $this->insertOrUpdatePages( $pageId, $revisionId, $userName, 2, $m1, ( $m2 - $lastM2 ) );
5757 $this->insertOrUpdatePages( $pageId, $revisionId, $userName, 3, $m1, ( $m3 - $lastM3 ) );
@@ -81,20 +81,20 @@
8282 'aa_m4' => $m4,
8383 )
8484 );
85 -
 85+
8686 $r = array();
8787 $r['result'] = 'Success';
8888 $this->getResult()->addValue( null, $this->getModuleName(), $r );
8989 }
90 -
91 - private function insertOrUpdatePages( $pageId, $revisionId, $dimension, $insertAddition, $updateAddition ) {
 90+
 91+ private function insertOrUpdatePages( $pageId, $revisionId, $dimension, $insert, $updateAddition ) {
9292 $dbw = wfGetDB( DB_MASTER );
9393
9494 $dbw->insertOrUpdate( 'article_assessment_pages',
9595 array(
9696 'aap_page_id' => $pageId,
9797 'aap_revision' => $revisionId,
98 - 'aap_total', => 'aap_total + ' . $insertAddition,
 98+ 'aap_total' => $insert,
9999 'aap_count' => 'aap_count + 1',
100100 'aap_dimension' => $dimension,
101101 ),
@@ -159,12 +159,12 @@
160160 'Submit article assessments'
161161 );
162162 }
163 -
 163+
164164 public function getPossibleErrors() {
165165 return array_merge( parent::getPossibleErrors(), array(
166166 ) );
167167 }
168 -
 168+
169169 protected function getExamples() {
170170 return array(
171171 'api.php?action=articleassessment'

Status & tagging log