Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | # $this->dieUsage( 'ArticleFeedback is not enabled on this page', 'invalidpage' ); |
41 | 41 | # } |
42 | 42 | |
43 | | - $feedbackId = $this->getFeedbackId( $params ); |
| 43 | + $feedbackId = $this->newFeedback( $params ); |
44 | 44 | $dbr = wfGetDB( DB_SLAVE ); |
45 | 45 | $pageId = $params['pageid']; |
46 | 46 | $bucket = $params['bucket']; |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | $this->updateRollupTables( $pageId, $revisionId ); |
84 | 84 | |
85 | 85 | if( $params['email'] ) { |
86 | | - $this->captureEmail ( $params['email'], json_encode( |
| 86 | + $this->captureEmail ( $params['email'], json_encode( |
87 | 87 | $email_data |
88 | 88 | ) ); |
89 | 89 | } |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | # rating: int between 1 and 5 (inclusive) |
141 | 141 | # boolean: 1 or 0 |
142 | 142 | # option_id: option exists |
143 | | - # text: none (maybe xss encode) |
| 143 | + # text: none |
144 | 144 | switch ( $type ) { |
145 | 145 | case 'rating': |
146 | 146 | if ( preg_match( '/^(1|2|3|4|5)$/', $value ) ) { |
— | — | @@ -302,12 +302,12 @@ |
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
306 | | - * Gets the feedback id |
| 306 | + * Creates a new feedback row and returns the id |
307 | 307 | * |
308 | 308 | * @param $params array the parameters |
309 | 309 | * @return int the feedback id |
310 | 310 | */ |
311 | | - public function getFeedbackId($params) { |
| 311 | + public function newFeedback( $params ) { |
312 | 312 | global $wgUser; |
313 | 313 | $dbw = wfGetDB( DB_MASTER ); |
314 | 314 | $revId = $params['revid']; |
— | — | @@ -323,7 +323,7 @@ |
324 | 324 | |
325 | 325 | # Fetch this if it wasn't passed in |
326 | 326 | if ( !$revId ) { |
327 | | - $revId = ApiArticleFeedbackv5Utils::getRevisionId($params['pageid']); |
| 327 | + $revId = ApiArticleFeedbackv5Utils::getRevisionId( $params['pageid'] ); |
328 | 328 | } |
329 | 329 | |
330 | 330 | $dbw->insert( 'aft_article_feedback', array( |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | * @param $bucket int the bucket id |
374 | 374 | * @return int the cta id |
375 | 375 | */ |
376 | | - public function getCTAId($answers, $bucket) { |
| 376 | + public function getCTAId( $answers, $bucket ) { |
377 | 377 | return 1; # Hard-code this for now. |
378 | 378 | } |
379 | 379 | |
— | — | @@ -386,30 +386,24 @@ |
387 | 387 | 'pageid' => array( |
388 | 388 | ApiBase::PARAM_TYPE => 'integer', |
389 | 389 | ApiBase::PARAM_REQUIRED => true, |
390 | | - ApiBase::PARAM_ISMULTI => false, |
391 | 390 | ), |
392 | 391 | 'revid' => array( |
393 | 392 | ApiBase::PARAM_TYPE => 'integer', |
394 | 393 | ApiBase::PARAM_REQUIRED => true, |
395 | | - ApiBase::PARAM_ISMULTI => false, |
396 | 394 | ), |
397 | 395 | 'anontoken' => null, |
398 | 396 | 'bucket' => array( |
399 | 397 | ApiBase::PARAM_TYPE => 'integer', |
400 | 398 | ApiBase::PARAM_REQUIRED => true, |
401 | | - ApiBase::PARAM_ISMULTI => false, |
402 | 399 | ApiBase::PARAM_MIN => 0 |
403 | 400 | ), |
404 | 401 | 'link' => array( |
405 | 402 | ApiBase::PARAM_TYPE => 'integer', |
406 | 403 | ApiBase::PARAM_REQUIRED => true, |
407 | | - ApiBase::PARAM_ISMULTI => false, |
408 | 404 | ApiBase::PARAM_MIN => 0 |
409 | 405 | ), |
410 | 406 | 'email' => array( |
411 | 407 | ApiBase::PARAM_TYPE => 'string', |
412 | | - ApiBase::PARAM_REQUIRED => false, |
413 | | - ApiBase::PARAM_ISMULTI => false, |
414 | 408 | ) |
415 | 409 | ); |
416 | 410 | |