From b528bcdf89c9c3d65e08508e01b3eaa488e959c8 Mon Sep 17 00:00:00 2001 From: X! Date: Sun, 8 Aug 2010 14:55:08 +0000 Subject: [PATCH] Followup to r70638: Clean up code, add prop to function args, add comment --- includes/api/ApiQueryPageProps.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiQueryPageProps.php b/includes/api/ApiQueryPageProps.php index 089c94f18a..4629333beb 100644 --- a/includes/api/ApiQueryPageProps.php +++ b/includes/api/ApiQueryPageProps.php @@ -72,7 +72,7 @@ class ApiQueryPageProps extends ApiQueryBase { foreach ( $this->everything as $pageid => $title ) { - $pageInfo = $this->extractPageInfo( $pageid, $title ); + $pageInfo = $this->extractPageInfo( $pageid, $title, $prop ); $fit = $result->addValue( array( 'query', 'pages' @@ -92,7 +92,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(); @@ -121,7 +121,7 @@ class ApiQueryPageProps extends ApiQueryBase { return $pageInfo; } - public function getCacheMode( $params ) { + public function getCacheMode() { return 'public'; } @@ -148,6 +148,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 ) { -- 2.20.1