Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php |
— | — | @@ -323,7 +323,8 @@ |
324 | 324 | |
325 | 325 | # Fetch this if it wasn't passed in |
326 | 326 | if ( !$revId ) { |
327 | | - $revId = ApiArticleFeedbackv5Utils::getRevisionId( $params['pageid'] ); |
| 327 | + $title = Title::newFromID( $params['pageid'] ); |
| 328 | + $revId = $title->getLatestRevID(); |
328 | 329 | } |
329 | 330 | |
330 | 331 | $dbw->insert( 'aft_article_feedback', array( |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | * @return bool |
53 | 53 | */ |
54 | 54 | public static function isFeedbackEnabled( $params ) { |
55 | | - global $wgArticleFeedbackNamespaces; |
| 55 | + global $wgArticleFeedbackv5Namespaces; |
56 | 56 | $title = Title::newFromID( $params['pageid'] ); |
57 | 57 | if ( |
58 | 58 | // not an existing page? |
— | — | @@ -90,32 +90,11 @@ |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | | - * Gets the most recent revision id for a page id |
95 | | - * |
96 | | - * @param $pageId int the page id |
97 | | - * @return int the revision id |
98 | | - */ |
99 | | - public static function getRevisionId( $pageId ) { |
100 | | - $dbr = wfGetDB( DB_SLAVE ); |
101 | | - $revId = $dbr->selectField( |
102 | | - 'revision', 'rev_id', |
103 | | - array( 'rev_page' => $pageId ), |
104 | | - __METHOD__, |
105 | | - array( |
106 | | - 'ORDER BY' => 'rev_id DESC', |
107 | | - 'LIMIT' => 1 |
108 | | - ) |
109 | | - ); |
110 | | - |
111 | | - return $revId; |
112 | | - } |
113 | | - |
114 | | - /** |
115 | 94 | * Gets the known feedback fields |
116 | 95 | * |
117 | 96 | * TODO: use memcache |
118 | 97 | * |
119 | | - * @return array the rows in the aft_article_field table |
| 98 | + * @return ResultWrapper the rows in the aft_article_field table |
120 | 99 | */ |
121 | 100 | public static function getFields() { |
122 | 101 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -147,9 +126,6 @@ |
148 | 127 | ); |
149 | 128 | $rv = array(); |
150 | 129 | foreach ( $rows as $row ) { |
151 | | - if ( !isset( $rv[$row->afo_field_id] ) ) { |
152 | | - $rv[$row->afo_field_id] = array(); |
153 | | - } |
154 | 130 | $rv[$row->afo_field_id][$row->afo_option_id] = $row->afo_name; |
155 | 131 | } |
156 | 132 | return $rv; |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php |
— | — | @@ -34,7 +34,6 @@ |
35 | 35 | $params = $this->extractRequestParams(); |
36 | 36 | $result = $this->getResult(); |
37 | 37 | $result_path = array( 'query', $this->getModuleName() ); |
38 | | - $revisionId = ApiArticleFeedbackv5Utils::getRevisionId( $params['pageid'] ); |
39 | 38 | $pageId = $params['pageid']; |
40 | 39 | $rollup = $this->fetchRollup( $pageId ); |
41 | 40 | |