]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/api/ApiQueryLangLinks.php
MediaWiki 1.15.0
[autoinstallsdev/mediawiki.git] / includes / api / ApiQueryLangLinks.php
index 8eaf8d02617e67a0ad5509736ba83a37fc7da49f..3abe5e3d2d7aa7cd3886dd823b95aee9ab71a9e1 100644 (file)
@@ -71,8 +71,6 @@ class ApiQueryLangLinks extends ApiQueryBase {
                $this->addOption('LIMIT', $params['limit'] + 1);
                $res = $this->select(__METHOD__);
 
-               $data = array();
-               $lastId = 0;    // database has no ID 0
                $count = 0;
                $db = $this->getDB();
                while ($row = $db->fetchObject($res)) {
@@ -82,23 +80,15 @@ class ApiQueryLangLinks extends ApiQueryBase {
                                $this->setContinueEnumParameter('continue', "{$row->ll_from}|{$row->ll_lang}");
                                break;
                        }
-                       if ($lastId != $row->ll_from) {
-                               if($lastId != 0) {
-                                       $this->addPageSubItems($lastId, $data);
-                                       $data = array();
-                               }
-                               $lastId = $row->ll_from;
-                       }
-
                        $entry = array('lang' => $row->ll_lang);
                        ApiResult :: setContent($entry, $row->ll_title);
-                       $data[] = $entry;
-               }
-
-               if($lastId != 0) {
-                       $this->addPageSubItems($lastId, $data);
+                       $fit = $this->addPageSubItem($row->ll_from, $entry);
+                       if(!$fit)
+                       {
+                               $this->setContinueEnumParameter('continue', "{$row->ll_from}|{$row->ll_lang}");
+                               break;
+                       }
                }
-
                $db->freeResult($res);
        }
 
@@ -134,6 +124,6 @@ class ApiQueryLangLinks extends ApiQueryBase {
        }
 
        public function getVersion() {
-               return __CLASS__ . ': $Id: ApiQueryLangLinks.php 43271 2008-11-06 22:38:42Z siebrand $';
+               return __CLASS__ . ': $Id: ApiQueryLangLinks.php 46845 2009-02-05 14:30:59Z catrope $';
        }
-}
+}
\ No newline at end of file