http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72002

Revision: 72002
Author:   reedy
Date:     2010-08-31 01:10:32 +0000 (Tue, 31 Aug 2010)

Log Message:
-----------
Implement limiting, no continue. Should be no "need" for it at this point? 
Trivial enough to add if deemed necessary

Modified Paths:
--------------
    trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php

Modified: 
trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php
===================================================================
--- trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php    
2010-08-31 01:00:36 UTC (rev 72001)
+++ trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php    
2010-08-31 01:10:32 UTC (rev 72002)
@@ -49,6 +49,9 @@
                        }
                }
 
+               $limit = $params['limit'] * 4; //4 "Ratings"
+               $this->addOption( 'LIMIT', $limit );
+
                $res = $this->select( __METHOD__ );
 
                $ratings = array();
@@ -82,7 +85,13 @@
                        $ratings[$pageId]['ratings'][] = $thisRow;
                }
 
+               $count = 0;
                foreach ( $ratings as $rat ) {
+                       if ( ++ $count > $limit ) {
+                               //$this->setContinueEnumParameter( 'from', 
$this->keyToTitle( $row->page_title ) );
+                               break;
+                       }
+
                        $result->setIndexedTagName( $rat['ratings'], 'r' );
                        $result->addValue( array( 'query', 
$this->getModuleName() ), null, $rat );
                }
@@ -95,6 +104,13 @@
                        'pageid' => null,
                        'revid' => null,
                        'userrating' => false,
+                       'limit' => array(
+                               ApiBase::PARAM_DFLT => 1,
+                               ApiBase::PARAM_TYPE => 'limit',
+                               ApiBase::PARAM_MIN => 1,
+                               ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
+                               ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
+                       ),
                );
        }
 
@@ -103,6 +119,7 @@
                        'pageid' => 'Page ID to get assessments for',
                        'revid' => 'Specific revision to get (used in 
conjunction with user param, otherwise ignored)',
                        'userrating' => 'Whether to get the current users 
ratings for the specific rev/article',
+                       'limit' => 'Amount of pages to get the ratings for',
                );
        }
 



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to