r108936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108935‎ | r108936 | r108937 >
Date:19:14, 14 January 2012
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_CSV.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_DSV.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_JSONlink.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RDF.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RSSlink.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES
@@ -10,6 +10,7 @@
1111
1212 * Fixed fatal error occurring for some invalid property definitions (bug 33652).
1313 * Fixed error in RSS when using creator or date parameters (bug 33721).
 14+* Fixed incorrect offset of export formats (bug 33726).
1415
1516 == SMW 1.7.0.1 ==
1617
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RSSlink.php
@@ -119,7 +119,7 @@
120120 } else {
121121 $label = wfMsgForContent( 'smw_rss_link' );
122122 }
123 - $link = $res->getQueryLink( $label );
 123+ $link = $res->getQueryLink( $label, false );
124124 $link->setParameter( 'rss', 'format' );
125125 if ( $this->m_title !== '' ) {
126126 $link->setParameter( $this->m_title, 'title' );
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_JSONlink.php
@@ -129,7 +129,7 @@
130130 $label = wfMsgForContent( 'smw_json_link' );
131131 }
132132
133 - $link = $res->getQueryLink( $label );
 133+ $link = $res->getQueryLink( $label, false );
134134 if ( array_key_exists( 'callback', $this->params ) ) {
135135 $link->setParameter( htmlspecialchars( $this->params['callback'] ), 'callback' );
136136 }
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_CSV.php
@@ -88,7 +88,7 @@
8989 $label = wfMsgForContent( 'smw_csv_link' );
9090 }
9191
92 - $link = $res->getQueryLink( $label );
 92+ $link = $res->getQueryLink( $label, false );
9393 $link->setParameter( 'csv', 'format' );
9494 $link->setParameter( $this->m_sep, 'sep' );
9595
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RDF.php
@@ -96,7 +96,7 @@
9797 $label = wfMsgForContent( 'smw_rdf_link' );
9898 }
9999
100 - $link = $res->getQueryLink( $label );
 100+ $link = $res->getQueryLink( $label, false );
101101 $link->setParameter( 'rdf', 'format' );
102102 $link->setParameter( $this->syntax, 'syntax' );
103103
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_DSV.php
@@ -158,7 +158,7 @@
159159 $label = wfMsgForContent( 'smw_dsv_link' );
160160 }
161161
162 - $link = $res->getQueryLink( $label );
 162+ $link = $res->getQueryLink( $label, false );
163163 $link->setParameter( 'dsv', 'format' );
164164 $link->setParameter( $this->separator, 'separator' );
165165 $link->setParameter( $this->fileName, 'filename' );
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php
@@ -196,11 +196,12 @@
197197 * TODO: have this work for all params without manually overriding and adding everything
198198 * (this is possible since the param handling changes in 1.7)
199199 *
200 - * @param mixed $caption A caption string or false
 200+ * @param string|false $caption
 201+ * @param boolean $offsetResults Should the results be offsetted by the current limit?
201202 *
202203 * @return SMWInfolink
203204 */
204 - public function getQueryLink( $caption = false ) {
 205+ public function getQueryLink( $caption = false, $offsetResults = true ) {
205206 $params = array( trim( $this->mQuery->getQueryString() ) );
206207
207208 foreach ( $this->mQuery->getExtraPrintouts() as /* SMWPrintRequest */ $printout ) {
@@ -217,8 +218,16 @@
218219 $params['mainlabel'] = $this->mQuery->getMainLabel();
219220 }
220221
221 - $params['offset'] = $this->mQuery->getOffset() + $this->mQuery->getLimit();
222 -
 222+ $params['offset'] = $this->mQuery->getOffset();
 223+
 224+ if ( $offsetResults ) {
 225+ $params['offset'] += $this->mQuery->getLimit();
 226+ }
 227+
 228+ if ( $params['offset'] === 0 ) {
 229+ unset( $params['offset'] );
 230+ }
 231+
223232 if ( $this->mQuery->getLimit() > 0 ) {
224233 $params['limit'] = $this->mQuery->getLimit();
225234 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r108990Follow up to r108936; fix this in a way that we do not need to care about if ...jeroendedauw16:37, 15 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   09:21, 15 January 2012

Introduces unreadable core.