r92080 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92079‎ | r92080 | r92081 >
Date:18:55, 13 July 2011
Author:kipcool
Status:deferred
Tags:
Comment:
removed a certain number of php warnings
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Editor.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Record.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Transaction.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -399,7 +399,7 @@
400400 function fetchName() {
401401 global $wgLang, $wdTermDBDataSet;
402402 if ( $wdTermDBDataSet ) {
403 - $userLanguageId = $wgLang->getCode() ;
 403+ $userLanguage = $wgLang->getCode() ;
404404 $spelling = getSpellingForLanguage( $this->dmId, $userLanguage, 'en', $wdTermDBDataSet );
405405 if ( $spelling ) return $spelling;
406406 }
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -5,7 +5,7 @@
66 require_once( "WikiDataBootstrappedMeanings.php" );
77 require_once( "ContextFetcher.php" );
88 require_once( "WikiDataGlobals.php" );
9 -require_once( "GotoSourceTemplate.php" );
 9+// require_once( "GotoSourceTemplate.php" ); // not used, disabled
1010 require_once( "ViewInformation.php" );
1111
1212 class DummyViewer extends Viewer {
@@ -607,8 +607,7 @@
608608 }
609609
610610 function getDefinedMeaningCollectionMembershipEditor( ViewInformation $viewInformation ) {
611 - global
612 - $wgGotoSourceTemplates;
 611+ global $wgGotoSourceTemplates;
613612
614613 $o = OmegaWikiAttributes::getInstance();
615614
@@ -616,7 +615,7 @@
617616 $editor->addEditor( new CollectionReferenceEditor( $o->collectionMeaning, new SimplePermissionController( false ), true ) );
618617 $editor->addEditor( new ShortTextEditor( $o->sourceIdentifier, new SimplePermissionController( false ), true ) );
619618
620 - if ( count( $wgGotoSourceTemplates ) > 0 )
 619+ if ( count( $wgGotoSourceTemplates ) > 1 )
621620 $editor->addEditor( new GotoSourceEditor( $o->gotoSource, new SimplePermissionController( true ), true ) );
622621
623622 addTableMetadataEditors( $editor, $viewInformation );
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -272,34 +272,30 @@
273273 if ( count( $expressionIds ) > 0 ) {
274274 $dbr = wfGetDB( DB_SLAVE );
275275
276 - # Query building
 276+ # Query building
277277 $frontQuery = "SELECT expression_id, language_id, spelling" .
278 - " FROM {$dc}_expression" .
279 - " WHERE expression_id = ";
280 - $queueQuery = " AND " . getLatestTransactionRestriction( "{$dc}_expression" );
 278+ " FROM {$dc}_expression" .
 279+ " WHERE expression_id = ";
281280
282 - # Build atomic queries
283 - foreach ( $expressionIds as &$value ) { $value = $frontQuery . $value . $queueQuery; }
284 - unset( $value );
 281+ # Build atomic queries
 282+ foreach ( $expressionIds as &$value ) { $value = $frontQuery . $value ; }
 283+ unset( $value );
285284 # Union of the atoms
286 - $finalQuery = implode( ' UNION ', $expressionIds );
287 -
 285+ $finalQuery = implode( ' UNION ', $expressionIds );
 286+
288287 $queryResult = $dbr->query( $finalQuery );
289 -
 288+
290289 $result = array();
291290
292291 while ( $row = $dbr->fetchObject( $queryResult ) ) {
293292 $record = new ArrayRecord( $o->expressionStructure );
294293 $record->language = $row->language_id;
295294 $record->spelling = $row->spelling;
296 -
297295 $result[$row->expression_id] = $record;
298296 }
299 -
300297 return $result;
301298 }
302 - else
303 - return array();
 299+ else return array();
304300 }
305301
306302 function expandExpressionReferencesInRecordSet( RecordSet $recordSet, array $expressionAttributes ) {
Index: trunk/extensions/Wikidata/OmegaWiki/Record.php
@@ -110,6 +110,11 @@
111111 }
112112
113113 public function tostring_indent( $depth = 0, $key = "" ) {
 114+ // FIXME why is this called when viewing a WikiData page?
 115+ // anyway, throws a Warning: get_class() expects parameter 1 to be object, string given
 116+ // does it work still? In doubt: disabled!
 117+ return "";
 118+/*
114119 $rv = "\n" . str_pad( "", $depth * 8 );
115120 $str = $this->getStructure();
116121 $type = $str->getStructureType();
@@ -133,6 +138,7 @@
134139 }
135140 $rv .= "}";
136141 return $rv;
 142+*/
137143 }
138144
139145 }
Index: trunk/extensions/Wikidata/OmegaWiki/Transaction.php
@@ -292,6 +292,7 @@
293293
294294 if ( $transaction = $dbr->fetchObject( $queryResult ) ) {
295295 $result->user = getUserLabel( $transaction->user_id, $transaction->user_ip );
 296+ if ( $result->user == null ) $result->user = "userId " . $transaction->user_id . " not found" ;
296297 $result->timestamp = $transaction->timestamp;
297298 $result->summary = $transaction->comment;
298299 }
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php
@@ -1,12 +1,12 @@
22 <?php
33
 4+require_once( "WikiDataGlobals.php" );
45 require_once( "HTMLtable.php" );
56 require_once( "Controller.php" );
67 require_once( "type.php" );
78 require_once( "GotoSourceTemplate.php" );
89 require_once( "Wikidata.php" );
910 require_once( "ContextFetcher.php" );
10 -require_once( "WikiDataGlobals.php" );
1111
1212 function addCollapsablePrefixToClass( $class ) {
1313 return "collapsable-$class";
@@ -2447,11 +2447,15 @@
24482448 }
24492449 }
24502450
 2451+/*
 2452+Don't know what it is, but obviously only used for SwissProt
 2453+cf. GoToSourceTemplate.php
 2454+*/
24512455 class GotoSourceEditor extends Viewer {
24522456 public function view( IdStack $idPath, $value ) {
2453 - global
2454 - $wgGotoSourceTemplates;
2455 -
 2457+ global $wgGotoSourceTemplates;
 2458+ if ( count( $wgGotoSourceTemplates ) <= 1 ) return "" ;
 2459+
24562460 $collectionId = $value->collectionId;
24572461 $sourceIdentifier = $value->sourceIdentifier;
24582462
@@ -2471,6 +2475,7 @@
24722476 }
24732477 }
24742478
 2479+
24752480 class DefinedMeaningContextEditor extends WrappingEditor {
24762481 public function view( IdStack $idPath, $value ) {
24772482 $definedMeaningId = (int) $value->definedMeaningId;

Status & tagging log