Couple more userid properties for Bug 19195
[lhc/web/wiklou.git] / includes / api / ApiQueryPageProps.php
index 04d5687..858f08a 100644 (file)
@@ -1,11 +1,10 @@
 <?php
-
 /**
- * Created on Sep 25, 2006
- *
  * API for MediaWiki 1.8+
  *
- * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Created on Sep 25, 2006
+ *
+ * Copyright © 2010 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +20,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
  */
 
 if ( !defined( 'MEDIAWIKI' ) ) {
@@ -68,10 +69,8 @@ class ApiQueryPageProps extends ApiQueryBase {
                        }
                }
 
-               
-
                foreach ( $this->everything as $pageid => $title ) {
-                       $pageInfo = $this->extractPageInfo( $pageid, $title );
+                       $pageInfo = $this->extractPageInfo( $pageid, $title, $this->params['prop'] );
                        $fit = $result->addValue( array(
                                'query',
                                'pages'
@@ -91,7 +90,7 @@ class ApiQueryPageProps extends ApiQueryBase {
         * @param $title Title object
         * @return array
         */
-       private function extractPageInfo( $pageid, $title ) {
+       private function extractPageInfo( $pageid, $title, $prop ) {
                global $wgPageProps;
                
                $pageInfo = array();
@@ -147,6 +146,9 @@ class ApiQueryPageProps extends ApiQueryBase {
                        'continue' => 'When more results are available, use this to continue',
                );
                
+               //This mess of code first gets the length of the biggest propname, and adds two onto it to make 
+               //the number of characters should be used before the dash. If the biggest propname is shorter than 12 characters, 
+               //the number of characters before the dash become 14. 
                $maxLen = max( array_map( 'strlen', array_keys( $wgPageProps ) ) );
                $matchLen = $maxLen + 2;
                if( $maxLen < 12 ) {