r87086 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87085‎ | r87086 | r87087 >
Date:16:25, 28 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
use of getNextdataValue instead of getNextObject
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
@@ -270,6 +270,7 @@
271271 *
272272 * @param[in] $count int How many entities have the exact same value on the property?
273273 * @param[in] $greater bool Should the values be bigger? Set false for smaller values
 274+ *
274275 * @return array of array of SMWWikiPageValue, SMWDataValue with the first being the entity, and the second the value
275276 */
276277 private function getNearbyResults( $count, $greater = true ) {
@@ -298,15 +299,18 @@
299300
300301 $result = $results->getNext();
301302 $ret = array();
 303+
302304 while ( $result ) {
303 - array_push( $ret, array( $result[0]->getNextObject(), $result[1]->getNextObject() ) );
 305+ array_push( $ret, array( $result[0]->getNextDataValue(), $result[1]->getNextDataValue() ) );
304306 $result = $results->getNext();
305307 }
 308+
306309 if ( !$greater ) {
307310 $temp = array();
308311 while ( $ret ) array_push( $temp, array_pop( $ret ) );
309312 $ret = $temp;
310313 }
 314+
311315 return $ret;
312316 }
313317
@@ -325,4 +329,5 @@
326330
327331 return $html;
328332 }
 333+
329334 }
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php
@@ -237,7 +237,7 @@
238238 $pinst = new SMWDIProperty( '_INST' );
239239
240240 while ( $resarray !== false ) {
241 - $instance = end( $resarray )->getNextObject();
 241+ $instance = end( $resarray )->getNextDataValue();
242242
243243 $stb = new SMWSmallTitle();
244244 $stb->dbkey = $instance->getDBkey();
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
@@ -33,6 +33,7 @@
3434 if ( $this->limit > 0 ) {
3535 $store = smwfGetStore();
3636 $desc = new SMWConceptDescription( $this->mTitle );
 37+
3738 if ( $this->from != '' ) {
3839 $dv = SMWWikiPageValue::makePage( $this->from, NS_MAIN ); // make a dummy wiki page as boundary
3940 $fromdesc = new SMWValueDescription( $dv, SMW_CMP_GEQ );
@@ -47,6 +48,7 @@
4849 } else {
4950 $order = 'ASC';
5051 }
 52+
5153 $desc->addPrintRequest( new SMWPrintRequest( SMWPrintRequest::PRINT_THIS, '' ) );
5254 $query = new SMWQuery( $desc );
5355 $query->sortkeys[''] = $order;
@@ -54,13 +56,16 @@
5557
5658 $result = $store->getQueryResult( $query );
5759 $row = $result->getNext();
 60+
5861 while ( $row !== false ) {
59 - $this->articles[] = end( $row )->getNextObject();
 62+ $this->articles[] = end( $row )->getNextDataValue();
6063 $row = $result->getNext();
6164 }
 65+
6266 if ( $order == 'DESC' ) {
6367 $this->articles = array_reverse( $this->articles );
6468 }
 69+
6570 $this->m_errors = $query->getErrors();
6671 } else {
6772 $this->articles = array();
@@ -98,6 +103,7 @@
99104 */
100105 private function formatList( $cutoff = 6 ) {
101106 $end = count( $this->articles );
 107+
102108 if ( $end > $this->limit ) {
103109 if ( $this->until != '' ) {
104110 $start = 1;
@@ -115,6 +121,7 @@
116122 // for short lists of articles
117123 return $this->shortList( $start, $end, $this->articles );
118124 }
 125+
119126 return '';
120127 }
121128

Status & tagging log