r79820 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79819‎ | r79820 | r79821 >
Date:14:43, 7 January 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
properly calculate maximal limit/offset (fixes Bug 26622)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php
@@ -55,11 +55,7 @@
5656 */
5757 public function __construct( $description = null, $inline = false, $concept = false ) {
5858 global $smwgQMaxLimit, $smwgQMaxInlineLimit;
59 - if ( $inline ) {
60 - $this->m_limit = $smwgQMaxInlineLimit;
61 - } else {
62 - $this->m_limit = $smwgQMaxLimit;
63 - }
 59+ $this->m_limit = $inline ? $smwgQMaxInlineLimit : $smwgQMaxLimit;
6460 $this->m_inline = $inline;
6561 $this->m_concept = $concept;
6662 $this->m_description = $description;
@@ -145,12 +141,8 @@
146142 */
147143 public function setLimit( $limit, $restrictinline = true ) {
148144 global $smwgQMaxLimit, $smwgQMaxInlineLimit;
149 - if ( $this->m_inline && $restrictinline ) {
150 - $maxlimit = $smwgQMaxInlineLimit;
151 - } else {
152 - $maxlimit = $smwgQMaxLimit;
153 - }
154 - $this->m_limit = min( $maxlimit - $this->m_offset, $limit );
 145+ $maxlimit = ( $this->m_inline && $restrictinline ) ? $smwgQMaxInlineLimit : $smwgQMaxLimit;
 146+ $this->m_limit = min( $smwgQMaxLimit - $this->m_offset, $limit, $maxlimit );
155147 return $this->m_limit;
156148 }
157149

Status & tagging log