r71505 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71504‎ | r71505 | r71506 >
Date:19:25, 23 August 2010
Author:reedy
Status:deferred
Tags:
Comment:
Followup r71498 No point setting keywords Id if not using it

Reformat ApiListArticleAssessment.php
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php
@@ -5,8 +5,10 @@
66 * @file
77 * @ingroup API
88 */
9 -
109 class ApiListArticleAssessment extends ApiBase {
 10+ public function __construct( $query, $moduleName ) {
 11+ parent::__construct( $query, $moduleName, 'aa' );
 12+ }
1113
1214 /**
1315 * runs when the API is called with "articleasessment"
@@ -14,70 +16,35 @@
1517 */
1618 public function execute() {
1719 $params = $this->extractRequestParams();
18 - $this->validateParams( $params );
19 -
20 - if( isset( $params['getCumulativeResults'] ) ){
21 - //get cumulative results
22 -
23 - //query to add 'n' reviews together
24 -
25 - }
26 - else if ( isset( $params['setUserVals'] ) ){
27 - //set user values
28 -
29 - //validate authid
30 -
31 - //insert
32 - }
33 -
 20+
3421 }
3522
36 - /**
37 - * Required parameter check
38 - * @param $params params extracted from the POST
39 - */
40 - protected function validateParams( $params ) {
41 -
42 - if( isset( $params['getCumulativeResults'] ) ){
43 - //get cumulative results
44 - $required = array('pageId', 'revId');
45 - foreach ( $required as $arg ) {
46 - if ( !isset( $params[$arg] ) ) {
47 - $this->dieUsageMsg( array( 'missingparam', $arg ) );
48 - }
49 - }
50 - }
51 - else if ( isset( $params['setUserVals'] ) ){
52 - //set user values
53 - $required = array('userId', 'authId', 'pageId', 'revId', 'review');
54 - foreach ( $required as $arg ) {
55 - if ( !isset( $params[$arg] ) ) {
56 - $this->dieUsageMsg( array( 'missingparam', $arg ) );
57 - }
58 - }
59 - }
60 - else{
61 - //FIXME: better usage message
62 - $this->dieUsageMsg( array('missingparam', "mode") );
63 - }
 23+ public function getAllowedParams() {
 24+ return array(
 25+ 'pageid' => null,
 26+ 'revid' => null,
 27+ );
6428 }
6529
66 - /*
6730 public function getParamDescription() {
6831 return array(
69 - 'getResults' => 'set if you want to get results',
 32+ 'pageid' => '',
 33+ 'revid' => '',
7034 );
71 - }*/
 35+ }
7236
7337 public function getDescription() {
7438 return array(
75 - 'get and set article assessment data'
 39+ 'List all article assessments'
7640 );
7741 }
7842
 43+ public function getPossibleErrors() {
 44+ return array_merge( parent::getPossibleErrors(), array(
 45+ ) );
 46+ }
7947
8048 public function getVersion() {
81 - return __CLASS__ . ':0';
 49+ return __CLASS__ . ': $Id$';
8250 }
83 -
8451 }
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71498svn:keywords Id to api/ApiArticleAssessmentPilot.php...reedy18:58, 23 August 2010

Status & tagging log