r77653 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77652‎ | r77653 | r77654 >
Date:13:55, 3 December 2010
Author:catrope
Status:ok
Tags:
Comment:
Finish r77651: reapply r76964, r77627
Modified paths:
  • /trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php
@@ -1,11 +1,11 @@
22 <?php
3 -class ApiArticleAssessment extends ApiBase {
 3+class ApiArticleFeedback extends ApiBase {
44 public function __construct( $query, $moduleName ) {
55 parent::__construct( $query, $moduleName, '' );
66 }
77
88 public function execute() {
9 - global $wgUser, $wgArticleAssessmentRatings;
 9+ global $wgUser, $wgArticleFeedbackRatings;
1010 $params = $this->extractRequestParams();
1111
1212 $token = array();
@@ -24,21 +24,21 @@
2525 // Query the latest ratings by this user for this page,
2626 // possibly for an older revision
2727 $res = $dbr->select(
28 - 'article_assessment',
 28+ 'article_feedback',
2929 array( 'aa_rating_id', 'aa_rating_value', 'aa_revision' ),
3030 array_merge(
3131 array(
3232 'aa_user_id' => $wgUser->getId(),
3333 'aa_user_text' => $wgUser->getName(),
3434 'aa_page_id' => $params['pageid'],
35 - 'aa_rating_id' => $wgArticleAssessmentRatings,
 35+ 'aa_rating_id' => $wgArticleFeedbackRatings,
3636 ),
3737 $token
3838 ),
3939 __METHOD__,
4040 array(
4141 'ORDER BY' => 'aa_revision DESC',
42 - 'LIMIT' => count( $wgArticleAssessmentRatings ),
 42+ 'LIMIT' => count( $wgArticleFeedbackRatings ),
4343 )
4444 );
4545
@@ -51,7 +51,7 @@
5252 $pageId = $params['pageid'];
5353 $revisionId = $params['revid'];
5454
55 - foreach( $wgArticleAssessmentRatings as $rating ) {
 55+ foreach( $wgArticleFeedbackRatings as $rating ) {
5656 $lastRating = false;
5757 if ( isset( $lastRatings[$rating] ) ) {
5858 $lastRating = $lastRatings[$rating];
@@ -85,7 +85,7 @@
8686 $dbw = wfGetDB( DB_MASTER );
8787
8888 $dbw->insert(
89 - 'article_assessment_pages',
 89+ 'article_feedback_pages',
9090 array(
9191 'aap_page_id' => $pageId,
9292 'aap_total' => 0,
@@ -97,7 +97,7 @@
9898 );
9999
100100 $dbw->update(
101 - 'article_assessment_pages',
 101+ 'article_feedback_pages',
102102 array(
103103 'aap_total = aap_total + ' . $updateAddition,
104104 'aap_count = aap_count + ' . ( $newRating ? 1 : 0 ),
@@ -126,7 +126,7 @@
127127 $timestamp = $dbw->timestamp();
128128
129129 $dbw->insert(
130 - 'article_assessment',
 130+ 'article_feedback',
131131 array_merge(
132132 array(
133133 'aa_page_id' => $pageId,
@@ -145,7 +145,7 @@
146146
147147 if ( !$dbw->affectedRows() ) {
148148 $dbw->update(
149 - 'article_assessment',
 149+ 'article_feedback',
150150 array(
151151 'aa_timestamp' => $timestamp,
152152 'aa_rating_value' => $ratingValue,
@@ -165,7 +165,7 @@
166166 }
167167
168168 public function getAllowedParams() {
169 - global $wgArticleAssessmentRatings;
 169+ global $wgArticleFeedbackRatings;
170170 $ret = array(
171171 'pageid' => array(
172172 ApiBase::PARAM_TYPE => 'integer',
@@ -180,7 +180,7 @@
181181 'anontoken' => null,
182182 );
183183
184 - foreach( $wgArticleAssessmentRatings as $rating ) {
 184+ foreach( $wgArticleFeedbackRatings as $rating ) {
185185 $ret["r{$rating}"] = array(
186186 ApiBase::PARAM_TYPE => 'limit',
187187 ApiBase::PARAM_DFLT => 0,
@@ -193,13 +193,13 @@
194194 }
195195
196196 public function getParamDescription() {
197 - global $wgArticleAssessmentRatings;
 197+ global $wgArticleFeedbackRatings;
198198 $ret = array(
199 - 'pageid' => 'Page ID to submit assessment for',
200 - 'revid' => 'Revision ID to submit assessment for',
 199+ 'pageid' => 'Page ID to submit feedback for',
 200+ 'revid' => 'Revision ID to submit feedback for',
201201 'anontoken' => 'Token for anonymous users',
202202 );
203 - foreach( $wgArticleAssessmentRatings as $rating ) {
 203+ foreach( $wgArticleFeedbackRatings as $rating ) {
204204 $ret["r{$rating}"] = "Rating {$rating}";
205205 }
206206 return $ret;
@@ -207,7 +207,7 @@
208208
209209 public function getDescription() {
210210 return array(
211 - 'Submit article assessments'
 211+ 'Submit article feedbacks'
212212 );
213213 }
214214
@@ -228,7 +228,7 @@
229229
230230 protected function getExamples() {
231231 return array(
232 - 'api.php?action=articleassessment'
 232+ 'api.php?action=articlefeedback'
233233 );
234234 }
235235
Property changes on: trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php
___________________________________________________________________
Added: svn:mergeinfo
236236 Merged /trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php:r76964,77627
Index: trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php
@@ -1,23 +1,23 @@
22 <?php
3 -class ApiQueryArticleAssessment extends ApiQueryBase {
 3+class ApiQueryArticleFeedback extends ApiQueryBase {
44 public function __construct( $query, $moduleName ) {
5 - parent::__construct( $query, $moduleName, 'aa' );
 5+ parent::__construct( $query, $moduleName, 'af' );
66 }
77
88 public function execute() {
9 - global $wgArticleAssessmentRatings;
 9+ global $wgArticleFeedbackRatings;
1010 $params = $this->extractRequestParams();
1111
1212 $result = $this->getResult();
1313
14 - $this->addTables( array( 'article_assessment_pages', 'article_assessment_ratings' ) );
 14+ $this->addTables( array( 'article_feedback_pages', 'article_feedback_ratings' ) );
1515
1616 $this->addFields( array( 'aap_page_id', 'aap_total', 'aap_count', 'aap_rating_id', 'aar_rating' ) );
1717
1818 $this->addJoinConds( array(
19 - 'article_assessment_ratings' => array( 'LEFT JOIN', array(
 19+ 'article_feedback_ratings' => array( 'LEFT JOIN', array(
2020 'aar_id=aap_rating_id',
21 - 'aap_rating_id' => $wgArticleAssessmentRatings,
 21+ 'aap_rating_id' => $wgArticleFeedbackRatings,
2222 )
2323 ),
2424 ) );
@@ -42,9 +42,9 @@
4343 $leftJoinConds['aa_user_anon_token'] = $params['anontoken'];
4444 }
4545
46 - $this->addTables( 'article_assessment' );
 46+ $this->addTables( 'article_feedback' );
4747 $this->addJoinConds( array(
48 - 'article_assessment' => array( 'LEFT JOIN', $leftJoinConds ),
 48+ 'article_feedback' => array( 'LEFT JOIN', $leftJoinConds ),
4949 )
5050 );
5151
@@ -53,7 +53,7 @@
5454 $this->addOption( 'ORDER BY', 'aa_revision DESC' );
5555 }
5656
57 - $this->addOption( 'LIMIT', count( $wgArticleAssessmentRatings ) );
 57+ $this->addOption( 'LIMIT', count( $wgArticleFeedbackRatings ) );
5858
5959 $res = $this->select( __METHOD__ );
6060
@@ -96,7 +96,7 @@
9797 if ( $params['userrating'] && $userRatedArticle ) {
9898 $dbr = wfGetDb( DB_SLAVE );
9999
100 - global $wgArticleAssessmentStaleCount;
 100+ global $wgArticleFeedbackStaleCount;
101101
102102 $res = $dbr->select(
103103 'revision',
@@ -106,10 +106,10 @@
107107 'rev_id > ' . $ratings[$pageId]['revid']
108108 ),
109109 __METHOD__,
110 - array ( 'LIMIT', $wgArticleAssessmentStaleCount + 1 )
 110+ array ( 'LIMIT', $wgArticleFeedbackStaleCount + 1 )
111111 );
112112
113 - if ( $res && $dbr->numRows( $res ) > $wgArticleAssessmentStaleCount ) {
 113+ if ( $res && $dbr->numRows( $res ) > $wgArticleFeedbackStaleCount ) {
114114 //it's stale!
115115 $ratings[$params['pageid']]['stale'] = '';
116116 }
@@ -137,7 +137,7 @@
138138
139139 public function getParamDescription() {
140140 return array(
141 - 'pageid' => 'Page ID to get assessments for',
 141+ 'pageid' => 'Page ID to get feedbacks for',
142142 'userrating' => "Whether to get the current user's ratings for the specific rev/article",
143143 'anontoken' => 'Token for anonymous users',
144144 );
@@ -145,7 +145,7 @@
146146
147147 public function getDescription() {
148148 return array(
149 - 'List all article assessments'
 149+ 'List all article feedbacks'
150150 );
151151 }
152152
@@ -159,9 +159,9 @@
160160
161161 protected function getExamples() {
162162 return array(
163 - 'api.php?action=query&list=articleassessment',
164 - 'api.php?action=query&list=articleassessment&aapageid=1',
165 - 'api.php?action=query&list=articleassessment&aapageid=1&aauserrating',
 163+ 'api.php?action=query&list=articlefeedback',
 164+ 'api.php?action=query&list=articlefeedback&aapageid=1',
 165+ 'api.php?action=query&list=articlefeedback&aapageid=1&aauserrating',
166166 );
167167 }
168168
Property changes on: trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php
___________________________________________________________________
Added: svn:mergeinfo
169169 Merged /trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php:r76964,77627

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76964Part 2 of 2 - Renaming ArticleAssessmentPilot to ArticleFeedback - this commi...tparscal21:28, 18 November 2010
r77627Change API module prefix from aa to afreedy01:01, 3 December 2010
r77651First step towards cleaning up r76961, which moved files without preserving h...catrope13:49, 3 December 2010

Status & tagging log