Index: trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | | -class ApiArticleAssessment extends ApiBase { |
| 3 | +class ApiArticleFeedback extends ApiBase { |
4 | 4 | public function __construct( $query, $moduleName ) { |
5 | 5 | parent::__construct( $query, $moduleName, '' ); |
6 | 6 | } |
7 | 7 | |
8 | 8 | public function execute() { |
9 | | - global $wgUser, $wgArticleAssessmentRatings; |
| 9 | + global $wgUser, $wgArticleFeedbackRatings; |
10 | 10 | $params = $this->extractRequestParams(); |
11 | 11 | |
12 | 12 | $token = array(); |
— | — | @@ -24,21 +24,21 @@ |
25 | 25 | // Query the latest ratings by this user for this page, |
26 | 26 | // possibly for an older revision |
27 | 27 | $res = $dbr->select( |
28 | | - 'article_assessment', |
| 28 | + 'article_feedback', |
29 | 29 | array( 'aa_rating_id', 'aa_rating_value', 'aa_revision' ), |
30 | 30 | array_merge( |
31 | 31 | array( |
32 | 32 | 'aa_user_id' => $wgUser->getId(), |
33 | 33 | 'aa_user_text' => $wgUser->getName(), |
34 | 34 | 'aa_page_id' => $params['pageid'], |
35 | | - 'aa_rating_id' => $wgArticleAssessmentRatings, |
| 35 | + 'aa_rating_id' => $wgArticleFeedbackRatings, |
36 | 36 | ), |
37 | 37 | $token |
38 | 38 | ), |
39 | 39 | __METHOD__, |
40 | 40 | array( |
41 | 41 | 'ORDER BY' => 'aa_revision DESC', |
42 | | - 'LIMIT' => count( $wgArticleAssessmentRatings ), |
| 42 | + 'LIMIT' => count( $wgArticleFeedbackRatings ), |
43 | 43 | ) |
44 | 44 | ); |
45 | 45 | |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | $pageId = $params['pageid']; |
53 | 53 | $revisionId = $params['revid']; |
54 | 54 | |
55 | | - foreach( $wgArticleAssessmentRatings as $rating ) { |
| 55 | + foreach( $wgArticleFeedbackRatings as $rating ) { |
56 | 56 | $lastRating = false; |
57 | 57 | if ( isset( $lastRatings[$rating] ) ) { |
58 | 58 | $lastRating = $lastRatings[$rating]; |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | $dbw = wfGetDB( DB_MASTER ); |
87 | 87 | |
88 | 88 | $dbw->insert( |
89 | | - 'article_assessment_pages', |
| 89 | + 'article_feedback_pages', |
90 | 90 | array( |
91 | 91 | 'aap_page_id' => $pageId, |
92 | 92 | 'aap_total' => 0, |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | ); |
99 | 99 | |
100 | 100 | $dbw->update( |
101 | | - 'article_assessment_pages', |
| 101 | + 'article_feedback_pages', |
102 | 102 | array( |
103 | 103 | 'aap_total = aap_total + ' . $updateAddition, |
104 | 104 | 'aap_count = aap_count + ' . ( $newRating ? 1 : 0 ), |
— | — | @@ -126,7 +126,7 @@ |
127 | 127 | $timestamp = $dbw->timestamp(); |
128 | 128 | |
129 | 129 | $dbw->insert( |
130 | | - 'article_assessment', |
| 130 | + 'article_feedback', |
131 | 131 | array_merge( |
132 | 132 | array( |
133 | 133 | 'aa_page_id' => $pageId, |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | |
147 | 147 | if ( !$dbw->affectedRows() ) { |
148 | 148 | $dbw->update( |
149 | | - 'article_assessment', |
| 149 | + 'article_feedback', |
150 | 150 | array( |
151 | 151 | 'aa_timestamp' => $timestamp, |
152 | 152 | 'aa_rating_value' => $ratingValue, |
— | — | @@ -165,7 +165,7 @@ |
166 | 166 | } |
167 | 167 | |
168 | 168 | public function getAllowedParams() { |
169 | | - global $wgArticleAssessmentRatings; |
| 169 | + global $wgArticleFeedbackRatings; |
170 | 170 | $ret = array( |
171 | 171 | 'pageid' => array( |
172 | 172 | ApiBase::PARAM_TYPE => 'integer', |
— | — | @@ -180,7 +180,7 @@ |
181 | 181 | 'anontoken' => null, |
182 | 182 | ); |
183 | 183 | |
184 | | - foreach( $wgArticleAssessmentRatings as $rating ) { |
| 184 | + foreach( $wgArticleFeedbackRatings as $rating ) { |
185 | 185 | $ret["r{$rating}"] = array( |
186 | 186 | ApiBase::PARAM_TYPE => 'limit', |
187 | 187 | ApiBase::PARAM_DFLT => 0, |
— | — | @@ -193,13 +193,13 @@ |
194 | 194 | } |
195 | 195 | |
196 | 196 | public function getParamDescription() { |
197 | | - global $wgArticleAssessmentRatings; |
| 197 | + global $wgArticleFeedbackRatings; |
198 | 198 | $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', |
201 | 201 | 'anontoken' => 'Token for anonymous users', |
202 | 202 | ); |
203 | | - foreach( $wgArticleAssessmentRatings as $rating ) { |
| 203 | + foreach( $wgArticleFeedbackRatings as $rating ) { |
204 | 204 | $ret["r{$rating}"] = "Rating {$rating}"; |
205 | 205 | } |
206 | 206 | return $ret; |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | |
209 | 209 | public function getDescription() { |
210 | 210 | return array( |
211 | | - 'Submit article assessments' |
| 211 | + 'Submit article feedbacks' |
212 | 212 | ); |
213 | 213 | } |
214 | 214 | |
— | — | @@ -228,7 +228,7 @@ |
229 | 229 | |
230 | 230 | protected function getExamples() { |
231 | 231 | return array( |
232 | | - 'api.php?action=articleassessment' |
| 232 | + 'api.php?action=articlefeedback' |
233 | 233 | ); |
234 | 234 | } |
235 | 235 | |
Property changes on: trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
236 | 236 | Merged /trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php:r76964,77627 |
Index: trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php |
— | — | @@ -1,23 +1,23 @@ |
2 | 2 | <?php |
3 | | -class ApiQueryArticleAssessment extends ApiQueryBase { |
| 3 | +class ApiQueryArticleFeedback extends ApiQueryBase { |
4 | 4 | public function __construct( $query, $moduleName ) { |
5 | | - parent::__construct( $query, $moduleName, 'aa' ); |
| 5 | + parent::__construct( $query, $moduleName, 'af' ); |
6 | 6 | } |
7 | 7 | |
8 | 8 | public function execute() { |
9 | | - global $wgArticleAssessmentRatings; |
| 9 | + global $wgArticleFeedbackRatings; |
10 | 10 | $params = $this->extractRequestParams(); |
11 | 11 | |
12 | 12 | $result = $this->getResult(); |
13 | 13 | |
14 | | - $this->addTables( array( 'article_assessment_pages', 'article_assessment_ratings' ) ); |
| 14 | + $this->addTables( array( 'article_feedback_pages', 'article_feedback_ratings' ) ); |
15 | 15 | |
16 | 16 | $this->addFields( array( 'aap_page_id', 'aap_total', 'aap_count', 'aap_rating_id', 'aar_rating' ) ); |
17 | 17 | |
18 | 18 | $this->addJoinConds( array( |
19 | | - 'article_assessment_ratings' => array( 'LEFT JOIN', array( |
| 19 | + 'article_feedback_ratings' => array( 'LEFT JOIN', array( |
20 | 20 | 'aar_id=aap_rating_id', |
21 | | - 'aap_rating_id' => $wgArticleAssessmentRatings, |
| 21 | + 'aap_rating_id' => $wgArticleFeedbackRatings, |
22 | 22 | ) |
23 | 23 | ), |
24 | 24 | ) ); |
— | — | @@ -42,9 +42,9 @@ |
43 | 43 | $leftJoinConds['aa_user_anon_token'] = $params['anontoken']; |
44 | 44 | } |
45 | 45 | |
46 | | - $this->addTables( 'article_assessment' ); |
| 46 | + $this->addTables( 'article_feedback' ); |
47 | 47 | $this->addJoinConds( array( |
48 | | - 'article_assessment' => array( 'LEFT JOIN', $leftJoinConds ), |
| 48 | + 'article_feedback' => array( 'LEFT JOIN', $leftJoinConds ), |
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | $this->addOption( 'ORDER BY', 'aa_revision DESC' ); |
55 | 55 | } |
56 | 56 | |
57 | | - $this->addOption( 'LIMIT', count( $wgArticleAssessmentRatings ) ); |
| 57 | + $this->addOption( 'LIMIT', count( $wgArticleFeedbackRatings ) ); |
58 | 58 | |
59 | 59 | $res = $this->select( __METHOD__ ); |
60 | 60 | |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | if ( $params['userrating'] && $userRatedArticle ) { |
98 | 98 | $dbr = wfGetDb( DB_SLAVE ); |
99 | 99 | |
100 | | - global $wgArticleAssessmentStaleCount; |
| 100 | + global $wgArticleFeedbackStaleCount; |
101 | 101 | |
102 | 102 | $res = $dbr->select( |
103 | 103 | 'revision', |
— | — | @@ -106,10 +106,10 @@ |
107 | 107 | 'rev_id > ' . $ratings[$pageId]['revid'] |
108 | 108 | ), |
109 | 109 | __METHOD__, |
110 | | - array ( 'LIMIT', $wgArticleAssessmentStaleCount + 1 ) |
| 110 | + array ( 'LIMIT', $wgArticleFeedbackStaleCount + 1 ) |
111 | 111 | ); |
112 | 112 | |
113 | | - if ( $res && $dbr->numRows( $res ) > $wgArticleAssessmentStaleCount ) { |
| 113 | + if ( $res && $dbr->numRows( $res ) > $wgArticleFeedbackStaleCount ) { |
114 | 114 | //it's stale! |
115 | 115 | $ratings[$params['pageid']]['stale'] = ''; |
116 | 116 | } |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | |
139 | 139 | public function getParamDescription() { |
140 | 140 | return array( |
141 | | - 'pageid' => 'Page ID to get assessments for', |
| 141 | + 'pageid' => 'Page ID to get feedbacks for', |
142 | 142 | 'userrating' => "Whether to get the current user's ratings for the specific rev/article", |
143 | 143 | 'anontoken' => 'Token for anonymous users', |
144 | 144 | ); |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | |
147 | 147 | public function getDescription() { |
148 | 148 | return array( |
149 | | - 'List all article assessments' |
| 149 | + 'List all article feedbacks' |
150 | 150 | ); |
151 | 151 | } |
152 | 152 | |
— | — | @@ -159,9 +159,9 @@ |
160 | 160 | |
161 | 161 | protected function getExamples() { |
162 | 162 | 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', |
166 | 166 | ); |
167 | 167 | } |
168 | 168 | |
Property changes on: trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
169 | 169 | Merged /trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php:r76964,77627 |