Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | $result_path = array( 'query', $this->getModuleName() ); |
38 | 38 | $revisionId = ApiArticleFeedbackv5Utils::getRevisionId( $params['pageid'] ); |
39 | 39 | $pageId = $params['pageid']; |
40 | | - $rollup = $this->fetchPageRollup( $pageId ); |
| 40 | + $rollup = $this->fetchRollup( $pageId ); |
41 | 41 | |
42 | 42 | $result->addValue( $result_path, 'pageid', $params['pageid'] ); |
43 | 43 | $result->addValue( $result_path, 'status', 'current' ); |
— | — | @@ -51,32 +51,9 @@ |
52 | 52 | ); |
53 | 53 | } |
54 | 54 | $result->addValue( $result_path, 'rollup', $info ); |
55 | | - |
56 | | - $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'aa' ); |
57 | 55 | } |
58 | 56 | |
59 | 57 | /** |
60 | | - * Pulls the page rollup row |
61 | | - * |
62 | | - * @param $pageId int the page id |
63 | | - * @return array the rollup row |
64 | | - */ |
65 | | - public function fetchPageRollup( $pageId ) { |
66 | | - return $this->fetchRollup( $pageId, 0, 'page' ); |
67 | | - } |
68 | | - |
69 | | - /** |
70 | | - * Pulls the revision rollup row |
71 | | - * |
72 | | - * @param $pageId int the page id |
73 | | - * @param $revisionLimit int [optional] go back only to this revision |
74 | | - * @return array the rollup row |
75 | | - */ |
76 | | - public function fetchRevisionRollup( $pageId, $revisionLimit = 0 ) { |
77 | | - return $this->fetchRollup( $pageId, $revisionLimit, 'revision' ); |
78 | | - } |
79 | | - |
80 | | - /** |
81 | 58 | * Pulls a rollup row |
82 | 59 | * |
83 | 60 | * @param $pageId int the page id |
— | — | @@ -85,20 +62,12 @@ |
86 | 63 | * @return array the rollup row |
87 | 64 | */ |
88 | 65 | private function fetchRollup( $pageId, $revisionLimit, $type ) { |
89 | | - $dbr = wfGetDB( DB_SLAVE ); |
90 | | - $where = array(); |
91 | | - |
92 | | - if ( $type == 'page' ) { |
93 | | - $table = 'article_feedback_ratings_rollup'; |
94 | | - $prefix = 'arr'; |
95 | | - } else { |
96 | | - $table = 'article_revision_feedback_ratings_rollup'; |
97 | | - $prefix = 'afrr'; |
98 | | - $where[] = 'afrr_revision_id >= ' . $revisionLimit; |
99 | | - } |
| 66 | + $dbr = wfGetDB( DB_SLAVE ); |
| 67 | + $where = array(); |
| 68 | + $table = 'article_feedback_ratings_rollup'; |
| 69 | + $prefix = 'arr'; |
100 | 70 | $where[$prefix . '_page_id'] = $pageId; |
101 | 71 | $where[] = $prefix . '_rating_id = afi_id'; |
102 | | - |
103 | 72 | $rows = $dbr->select( |
104 | 73 | array( 'aft_' . $table, 'aft_article_field' ), |
105 | 74 | array( |
— | — | @@ -124,20 +93,7 @@ |
125 | 94 | */ |
126 | 95 | public function getAllowedParams() { |
127 | 96 | return array( |
128 | | - 'userrating' => 0, |
129 | | - 'anontoken' => null, |
130 | | - 'userid' => null, |
131 | | - 'subaction' => array( |
132 | | - ApiBase::PARAM_REQUIRED => false, |
133 | | - ApiBase::PARAM_ISMULTI => false, |
134 | | - ApiBase::PARAM_TYPE => array( 'showratings', 'newform' ), |
135 | | - ), |
136 | | - 'revid' => array( |
137 | | - ApiBase::PARAM_REQUIRED => false, |
138 | | - ApiBase::PARAM_ISMULTI => false, |
139 | | - ApiBase::PARAM_TYPE => 'integer', |
140 | | - ), |
141 | | - 'pageid' => array( |
| 97 | + 'pageid' => array( |
142 | 98 | ApiBase::PARAM_REQUIRED => true, |
143 | 99 | ApiBase::PARAM_ISMULTI => false, |
144 | 100 | ApiBase::PARAM_TYPE => 'integer', |
— | — | @@ -152,9 +108,7 @@ |
153 | 109 | */ |
154 | 110 | public function getParamDescription() { |
155 | 111 | return array( |
156 | | - 'pageid' => 'Page ID to get feedback ratings for', |
157 | | - 'revid' => 'Rev ID to get feedback ratings for', |
158 | | - 'anontoken' => 'Token for anonymous users', |
| 112 | + 'pageid' => 'Page ID to get feedback ratings for', |
159 | 113 | ); |
160 | 114 | } |
161 | 115 | |
— | — | @@ -170,19 +124,6 @@ |
171 | 125 | } |
172 | 126 | |
173 | 127 | /** |
174 | | - * Gets any possible errors |
175 | | - * |
176 | | - * @return array the errors |
177 | | - */ |
178 | | - public function getPossibleErrors() { |
179 | | - return array_merge( parent::getPossibleErrors(), array( |
180 | | - array( 'missingparam', 'anontoken' ), |
181 | | - array( 'code' => 'invalidtoken', 'info' => 'The anontoken is not 32 characters' ), |
182 | | - ) |
183 | | - ); |
184 | | - } |
185 | | - |
186 | | - /** |
187 | 128 | * Gets an example |
188 | 129 | * |
189 | 130 | * @return array the example as the first element in an array |