r69544 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69543‎ | r69544 | r69545 >
Date:13:09, 19 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Small style improvements
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -794,4 +794,4 @@
795795 return ''; // empty unit
796796 }
797797
798 -}
 798+}
\ No newline at end of file
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -1917,9 +1917,12 @@
19181918 $id = 0;
19191919
19201920 if ( $iw != '' ) { // external page; no need to think about redirects
1921 - $res = $db->select( 'smw_ids', array( 'smw_id', 'smw_sortkey' ),
1922 - array( 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw ),
1923 - 'SMW::getSMWPageID', array( 'LIMIT' => 1 ) );
 1921+ $res = $db->select(
 1922+ 'smw_ids',
 1923+ array( 'smw_id', 'smw_sortkey' ),
 1924+ array( 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw ),
 1925+ 'SMW::getSMWPageID', array( 'LIMIT' => 1 )
 1926+ );
19241927
19251928 if ( $row = $db->fetchObject( $res ) ) {
19261929 $id = $row->smw_id;
@@ -1988,15 +1991,21 @@
19891992 $db = wfGetDB( DB_MASTER );
19901993 $sortkey = $sortkey ? $sortkey:( str_replace( '_', ' ', $title ) );
19911994
1992 - $db->insert( 'smw_ids',
1993 - array( 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ),
1994 - 'smw_title' => $title,
1995 - 'smw_namespace' => $namespace,
1996 - 'smw_iw' => $iw,
1997 - 'smw_sortkey' => $sortkey ), 'SMW::makeSMWPageID' );
 1995+ $db->insert(
 1996+ 'smw_ids',
 1997+ array(
 1998+ 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ),
 1999+ 'smw_title' => $title,
 2000+ 'smw_namespace' => $namespace,
 2001+ 'smw_iw' => $iw,
 2002+ 'smw_sortkey' => $sortkey
 2003+ ),
 2004+ 'SMW::makeSMWPageID'
 2005+ );
19982006
19992007 $id = $db->insertId();
20002008 $this->m_ids["$iw $namespace $title -"] = $id; // fill that cache, even if canonical was given
 2009+
20012010 // This ID is also authorative for the canonical version.
20022011 // This is always the case: if $canonical===false and $id===0, then there is no redi-entry in
20032012 // smw_ids either, hence the object just did not exist at all.
@@ -2086,8 +2095,17 @@
20872096 $db = wfGetDB( DB_MASTER );
20882097
20892098 // check if there is an unused bnode to take:
2090 - $res = $db->select( 'smw_ids', 'smw_id', array( 'smw_title' => '', 'smw_namespace' => 0, 'smw_iw' => SMW_SQL2_SMWIW ),
2091 - 'SMW::makeSMWBnodeID', array( 'LIMIT' => 1 ) );
 2099+ $res = $db->select(
 2100+ 'smw_ids',
 2101+ 'smw_id',
 2102+ array(
 2103+ 'smw_title' => '',
 2104+ 'smw_namespace' => 0,
 2105+ 'smw_iw' => SMW_SQL2_SMWIW
 2106+ ),
 2107+ 'SMW::makeSMWBnodeID',
 2108+ array( 'LIMIT' => 1 )
 2109+ );
20922110
20932111 $id = ( $row = $db->fetchObject( $res ) ) ? $row->smw_id:0;
20942112 $db->freeResult( $res );
@@ -2130,26 +2148,39 @@
21312149 */
21322150 protected function moveSMWPageID( $curid, $targetid = 0 ) {
21332151 $db = wfGetDB( DB_MASTER );
2134 - $row = $db->selectRow( 'smw_ids',
2135 - array( 'smw_id', 'smw_namespace', 'smw_title', 'smw_iw', 'smw_sortkey' ),
2136 - array( 'smw_id' => $curid ), 'SMWSQLStore2::moveSMWPageID' );
 2152+
 2153+ $row = $db->selectRow(
 2154+ 'smw_ids',
 2155+ array( 'smw_id', 'smw_namespace', 'smw_title', 'smw_iw', 'smw_sortkey' ),
 2156+ array( 'smw_id' => $curid ), 'SMWSQLStore2::moveSMWPageID'
 2157+ );
21372158
21382159 if ( $row === false ) return; // no id at current position, ignore
21392160
21402161 if ( $targetid == 0 ) { // append new id
2141 - $db->insert( 'smw_ids', array( 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ),
2142 - 'smw_title' => $row->smw_title,
2143 - 'smw_namespace' => $row->smw_namespace,
2144 - 'smw_iw' => $row->smw_iw,
2145 - 'smw_sortkey' => $row->smw_sortkey ), 'SMW::moveSMWPageID' );
 2162+ $db->insert(
 2163+ 'smw_ids',
 2164+ array(
 2165+ 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ),
 2166+ 'smw_title' => $row->smw_title,
 2167+ 'smw_namespace' => $row->smw_namespace,
 2168+ 'smw_iw' => $row->smw_iw,
 2169+ 'smw_sortkey' => $row->smw_sortkey
 2170+ ),
 2171+ 'SMW::moveSMWPageID'
 2172+ );
21462173
21472174 $targetid = $db->insertId();
21482175 } else { // change to given id
2149 - $db->insert( 'smw_ids', array( 'smw_id' => $targetid,
2150 - 'smw_title' => $row->smw_title,
2151 - 'smw_namespace' => $row->smw_namespace,
2152 - 'smw_iw' => $row->smw_iw,
2153 - 'smw_sortkey' => $row->smw_sortkey ), 'SMW::moveSMWPageID' );
 2176+ $db->insert( 'smw_ids',
 2177+ array( 'smw_id' => $targetid,
 2178+ 'smw_title' => $row->smw_title,
 2179+ 'smw_namespace' => $row->smw_namespace,
 2180+ 'smw_iw' => $row->smw_iw,
 2181+ 'smw_sortkey' => $row->smw_sortkey
 2182+ ),
 2183+ 'SMW::moveSMWPageID'
 2184+ );
21542185 }
21552186
21562187 $db->delete( 'smw_ids', array( 'smw_id' => $curid ), 'SMWSQLStore2::moveSMWPageID' );
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php
@@ -345,4 +345,4 @@
346346 }
347347 }
348348
349 -}
 349+}
\ No newline at end of file

Status & tagging log