Index: trunk/extensions/ArticleAssessmentPilot/api/ApiQueryArticleAssessment.php |
— | — | @@ -54,9 +54,10 @@ |
55 | 55 | |
56 | 56 | $this->addOption( 'ORDER BY', 'aa_revision DESC' ); |
57 | 57 | } |
| 58 | + |
| 59 | + global $wgArticleAssessmentRatingCount; |
58 | 60 | |
59 | | - $limit = $params['limit']; |
60 | | - $this->addOption( 'LIMIT', $limit * 4 ); //4 "Ratings" |
| 61 | + $this->addOption( 'LIMIT', $wgArticleAssessmentRatingCount ); |
61 | 62 | |
62 | 63 | $res = $this->select( __METHOD__ ); |
63 | 64 | |
— | — | @@ -100,6 +101,8 @@ |
101 | 102 | $revid = isset( $params['revid'] ) ? $params['revid'] : $ratings[$pageId]['revid']; |
102 | 103 | |
103 | 104 | $dbr = wfGetDb( DB_SLAVE ); |
| 105 | + |
| 106 | + global $wgArticleAssessmentStaleCount; |
104 | 107 | |
105 | 108 | $res = $dbr->selectField( |
106 | 109 | 'revision', |
— | — | @@ -108,11 +111,10 @@ |
109 | 112 | 'rev_page' => $params['pageid'], |
110 | 113 | 'rev_id > ' . $revid |
111 | 114 | ), |
112 | | - __METHOD__ |
| 115 | + __METHOD__, |
| 116 | + array ( 'LIMIT', $wgArticleAssessmentStaleCount + 1 ) |
113 | 117 | ); |
114 | 118 | |
115 | | - global $wgArticleAssessmentStaleCount; |
116 | | - |
117 | 119 | if ( $res && (int)$res > $wgArticleAssessmentStaleCount ) { |
118 | 120 | //it's stale! |
119 | 121 | $ratings[$params['pageid']]['stale'] = intval( $res ); |
— | — | @@ -139,16 +141,12 @@ |
140 | 142 | ApiBase::PARAM_ISMULTI => false, |
141 | 143 | ApiBase::PARAM_TYPE => 'integer', |
142 | 144 | ), |
143 | | - 'revid' => null, |
| 145 | + 'revid' =>array( |
| 146 | + ApiBase::PARAM_ISMULTI => false, |
| 147 | + ApiBase::PARAM_TYPE => 'integer', |
| 148 | + ), |
144 | 149 | 'userrating' => false, |
145 | 150 | 'anontoken' => null, |
146 | | - 'limit' => array( |
147 | | - ApiBase::PARAM_DFLT => 1, |
148 | | - ApiBase::PARAM_TYPE => 'limit', |
149 | | - ApiBase::PARAM_MIN => 1, |
150 | | - ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, |
151 | | - ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG1, |
152 | | - ), |
153 | 151 | ); |
154 | 152 | } |
155 | 153 | |
— | — | @@ -158,7 +156,6 @@ |
159 | 157 | 'revid' => 'Specific revision to get (used in conjunction with userrating param, otherwise ignored)', |
160 | 158 | 'userrating' => "Whether to get the current user's ratings for the specific rev/article", |
161 | 159 | 'anontoken' => 'Token for anonymous users', |
162 | | - 'limit' => 'Amount of pages to get the ratings for', |
163 | 160 | ); |
164 | 161 | } |
165 | 162 | |
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php |
— | — | @@ -73,9 +73,10 @@ |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | | - * |
78 | | - * @param $pageId Integer: |
79 | | - * @param $ratingId Integer: |
| 77 | + * Inserts (or Updates, where appropriate) the aggregate page rating |
| 78 | + * |
| 79 | + * @param $pageId Integer: Page Id |
| 80 | + * @param $ratingId Integer: Rating Id |
80 | 81 | * @param $updateAddition Integer: Difference between user's last rating (if applicable) |
81 | 82 | * @param $newRating Boolean: Whether this is a new rating (for update, whether this increases the count) |
82 | 83 | */ |
— | — | @@ -109,12 +110,14 @@ |
110 | 111 | } |
111 | 112 | |
112 | 113 | /** |
113 | | - * @param $pageId Integer: |
114 | | - * @param $revisionId Integer: |
115 | | - * @param $user User: |
116 | | - * @param $token Array: |
117 | | - * @param $ratingId Integer: |
118 | | - * @param $ratingValue Integer: |
| 114 | + * Inserts (or Updates, where appropriate) the users ratings for a specific revision |
| 115 | + * |
| 116 | + * @param $pageId Integer: Page Id |
| 117 | + * @param $revisionId Integer: Revision Id |
| 118 | + * @param $user User: Current User object |
| 119 | + * @param $token Array: Token if necessary |
| 120 | + * @param $ratingId Integer: Rating Id |
| 121 | + * @param $ratingValue Integer: Value of the Rating |
119 | 122 | */ |
120 | 123 | private function insertUserRatings( $pageId, $revisionId, $user, $token, $ratingId, $ratingValue ) { |
121 | 124 | $dbw = wfGetDB( DB_MASTER ); |