r107709 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107708‎ | r107709 | r107710 >
Date:04:55, 31 December 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
killed dead code
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_SetRecurringEvent.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_List.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLHelpers.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUI.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUI.php
@@ -25,13 +25,6 @@
2626 */
2727 protected $uiCore;
2828
29 - /**
30 - * Is auto-complete enabled for these UI elements?
31 - *
32 - * @var mixed SMWQUeryUI::ENABLE_AUTO_SUGGEST | SMWQUeryUI::DISABLE_AUTO_SUGGEST
33 - */
34 - private $autoCompleteEnabled = false;
35 -
3629 const ENABLE_AUTO_SUGGEST = true;
3730 const DISABLE_AUTO_SUGGEST = false;
3831
@@ -325,7 +318,6 @@
326319 * @return string
327320 */
328321 protected function getQueryFormBox() {
329 - global $smwgScriptPath;
330322 $this->setUrlArgs( array( 'q' => $this->uiCore->getQueryString() ) );
331323 $result = '<div>' .
332324 Html::element( 'textarea',
@@ -507,7 +499,6 @@
508500 SMWOutputs::requireResource( 'ext.smw.style' );
509501
510502 $result = '<span id="smwposortbox">';
511 - $numSortValues = 0;
512503 $params = $this->uiCore->getParameters();
513504
514505 // mainlabel
@@ -595,7 +586,7 @@
596587 }
597588 $printOuts = ( $this->uiCore->getPrintOuts() );
598589 $counter = 0;
599 - foreach ( $printOuts as $poKey => $poValue ) {
 590+ foreach ( $printOuts as $poValue ) {
600591 if ( $poValue->getMode() == SMWPrintRequest::PRINT_CATS ) {
601592 $categoryValues[$counter] = ' ';
602593 $categoryLabelValues[$counter] = $poValue->getLabel();
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -439,7 +439,6 @@
440440 $res = $this->queryResult;
441441 $printer = SMWQueryProcessor::getResultPrinter( $this->parameters['format'],
442442 SMWQueryProcessor::SPECIAL_PAGE );
443 - $resultMime = $printer->getMimeType( $res );
444443
445444 if ( $res->getCount() > 0 ) {
446445 $queryResult = $printer->getResult( $res, $this->params, SMW_OUTPUT_HTML );
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
@@ -31,8 +31,6 @@
3232 * @param string $p
3333 */
3434 protected function makePage( $p ) {
35 - global $wgOut;
36 -
3735 $htmlOutput = $this->makeForm( $p );
3836
3937 if ( $this->uiCore->getQueryString() != "" ) {
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php
@@ -59,7 +59,6 @@
6060 $linker = smwfGetLinker();
6161 list ( $property, $useCount ) = $result;
6262
63 - $typestring = '';
6463 $errors = array();
6564
6665 $diWikiPage = $property->getDiWikiPage();
@@ -68,7 +67,7 @@
6968 if ( $property->isUserDefined() ) {
7069
7170 if ( $title === null ) {
72 - continue;
 71+ return '';
7372 }
7473
7574 if ( $useCount <= 5 ) {
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php
@@ -515,7 +515,6 @@
516516
517517 global $wgSitename, $wgLanguageCode;
518518
519 - $db = & wfGetDB( DB_SLAVE );
520519 $this->prepareSerialization();
521520 $this->delay_flush = 35; // don't do intermediate flushes with default parameters
522521
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php
@@ -321,7 +321,6 @@
322322
323323 $parts = explode( '-23', $dbKey, 2 );
324324 if ( count( $parts ) == 2 ) {
325 - $dbkey = $parts[0];
326325 $subobjectname = $parts[1];
327326 } else {
328327 $subobjectname = '';
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php
@@ -215,8 +215,8 @@
216216 $calendarmodel = $timezoneoffset = $era = $ampm = false;
217217 $hours = $minutes = $seconds = $timeoffset = false;
218218 $unclearparts = array();
219 - $prevmatchwasnumber = $matchisnumber = false; // used for looking back; numbers are days/months/years by default but may be re-interpreted if certain further symbols are found
220 - $prevmatchwasdate = $matchisdate = false; // used for ensuring that date parts are in one block
 219+ $matchisnumber = false; // used for looking back; numbers are days/months/years by default but may be re-interpreted if certain further symbols are found
 220+ $matchisdate = false; // used for ensuring that date parts are in one block
221221
222222 foreach ( $matches as $match ) {
223223 $prevmatchwasnumber = $matchisnumber;
@@ -725,7 +725,6 @@
726726 * @return string
727727 */
728728 public function getISO8601Date( $mindefault = true ) {
729 - $yearnum = ( $this->getYear() > 0 ) ? $this->getYear() : 1 - $this->getYear();
730729 $result = ( $this->getYear() > 0 ) ? '' : '-';
731730 $monthnum = $this->getMonth( SMWDITime::CM_GREGORIAN, ( $mindefault ? 1 : 12 ) );
732731 $result .= str_pad( $this->getYear(), 4, "0", STR_PAD_LEFT ) .
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php
@@ -31,8 +31,6 @@
3232 }
3333
3434 protected function getResultText( SMWQueryResult $res, $outputmode ) {
35 - global $wgVersion;
36 -
3735 $result = '';
3836
3937 $columnClasses = array();
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_List.php
@@ -178,7 +178,6 @@
179179 $result .= $rowstart;
180180 }
181181
182 - $first_col = true;
183182 if ( $this->mTemplate !== '' ) { // build template code
184183 $this->hasTemplates = true;
185184 $wikitext = ( $this->mUserParam ) ? "|userparam=$this->mUserParam" : '';
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php
@@ -99,7 +99,7 @@
100100 $listSeparator = ',';
101101 $allowed_values_str = str_replace( "\\$listSeparator", "\a", $val );
102102 $allowed_values_array = explode( $listSeparator, $allowed_values_str );
103 - foreach ( $allowed_values_array as $i => $value ) {
 103+ foreach ( $allowed_values_array as $value ) {
104104 // replace beep back with comma, trim
105105 $value = str_replace( "\a", $listSeparator, trim( $value ) );
106106 $xml .= '<AllowedValue>' . $value . '</AllowedValue>';
@@ -194,7 +194,7 @@
195195 $text = wfMsgForContent( 'smw-createproperty-isproperty', $typeTag );
196196 if ( $allowedValues != null) {
197197 $text .= "\n\n" . wfMsgExt( 'smw-createproperty-allowedvals', array( 'parsemag', 'content' ), count( $allowedValues ) );
198 - foreach ( $allowedValues as $i => $value ) {
 198+ foreach ( $allowedValues as $value ) {
199199 if ( method_exists( $smwgContLang, 'getPropertyLabels' ) ) {
200200 $prop_labels = $smwgContLang->getPropertyLabels();
201201 $text .= "\n* [[" . $prop_labels['_PVAL'] . "::$value]]";
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
@@ -318,7 +318,6 @@
319319
320320 $typeid = $property->getDataItem()->findPropertyTypeID();
321321 $inverse = $property->isInverse();
322 - $prevname = $name;
323322 $properties[] = $property;
324323 } ///NOTE: after iteration, $property and $typeid correspond to last value
325324
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php
@@ -191,7 +191,7 @@
192192 * @param OutputPage $output
193193 */
194194 static public function commitToOutputPage( OutputPage $output ) {
195 - foreach ( self::$scripts as $key => $script ) {
 195+ foreach ( self::$scripts as $script ) {
196196 $output->addScript( $script );
197197 }
198198 foreach ( self::$headItems as $key => $item ) {
Index: trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_SetRecurringEvent.php
@@ -167,7 +167,6 @@
168168 $cur_date = $start_date;
169169 $cur_date_jd = self::getJD( $cur_date );
170170 $i = 0;
171 - $reached_end_date = false;
172171
173172 do {
174173 $i++;
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php
@@ -1054,7 +1054,6 @@
10551055 if ( $propkey === '' ) { // Sort by first result column (page titles).
10561056 $qobj->sortfields[$propkey] = "$qobj->alias.smw_sortkey";
10571057 } else { // Try to extend query.
1058 - $extrawhere = '';
10591058 $sortprop = SMWPropertyValue::makeUserProperty( $propkey );
10601059
10611060 if ( $sortprop->isValid() ) {
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php
@@ -75,7 +75,7 @@
7676 abstract public function isSafe();
7777
7878 public function getWeakConditionString() {
79 - return implode( $this->weakConditions );
 79+ return implode( '', $this->weakConditions );
8080 }
8181
8282 }
@@ -278,7 +278,6 @@
279279 $sparqlCondition = $this->getSparqlCondition( $query->getDescription() );
280280
281281 if ( $sparqlCondition instanceof SMWSparqlSingletonCondition ) {
282 - $matchElement = $sparqlCondition->matchElement;
283282 if ( $sparqlCondition->condition === '' ) { // all URIs exist, no querying
284283 return 1;
285284 } else {
@@ -357,7 +356,6 @@
358357 $entries = array();
359358
360359 if ( $sparqlCondition instanceof SMWSparqlSingletonCondition ) {
361 - $matchElement = $sparqlCondition->matchElement;
362360 if ( $sparqlCondition->condition === '' ) { // all URIs exist, no querying
363361 $sparql = 'None (no conditions).';
364362 } else {
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -401,7 +401,7 @@
402402 }
403403
404404 // First build $select, $from, and $where for the DB query
405 - $select = $where = $from = '';
 405+ $where = $from = '';
406406 $pid = $this->getSMWPropertyID( $property );
407407 $tableid = self::findPropertyTableID( $property );
408408
@@ -563,7 +563,7 @@
564564 $suboptions = null;
565565 }
566566
567 - foreach ( self::getPropertyTables() as $tid => $proptable ) {
 567+ foreach ( self::getPropertyTables() as $proptable ) {
568568 $from = $db->tableName( $proptable->name );
569569
570570 if ( $proptable->idsubject ) {
@@ -638,7 +638,7 @@
639639 $proptables = self::getPropertyTables();
640640 foreach ( $tableIds as $tid ) {
641641 $proptable = $proptables[$tid];
642 - $select = $where = $from = '';
 642+ $where = $from = '';
643643 if ( $proptable->fixedproperty == false ) { // join smw_ids to get property titles
644644 $from = $db->tableName( 'smw_ids' ) . " INNER JOIN " . $db->tableName( $proptable->name ) . " AS t1 ON t1.p_id=smw_id";
645645 $this->prepareValueQuery( $from, $where, $proptable, $value, 1 );
@@ -847,11 +847,6 @@
848848 if ( $typeid != 'p' ) {
849849 $uvals[$fieldname] = current( $dbkeys );
850850 } else {
851 - /// TODO The dbkeys hanlding here is obsolete; a clean handling for the DI system is needed
852 - $title = current( $dbkeys );
853 - $namespace = next( $dbkeys );
854 - $iw = next( $dbkeys );
855 - $sortkey = next( $dbkeys ); // not used; sortkeys are not set on writing objects
856851 $uvals[$fieldname] = $this->makeSMWPageID( $di->getDBkey(), $di->getNamespace(), $di->getInterwiki(), $di->getSubobjectName() );
857852 }
858853
@@ -1886,9 +1881,7 @@
18871882 public static function findAllDiTypeTableIds( $dataItemId ) {
18881883 $result = array( self::findDiTypeTableId( $dataItemId ) );
18891884
1890 - foreach ( self::$special_tables as $propertyKey => $specialTableId ) {
1891 - $diProperty = new SMWDIProperty( $propertyKey, false );
1892 - $propertyTypeId = $diProperty->findPropertyTypeId();
 1885+ foreach ( self::$special_tables as $specialTableId ) {
18931886 if ( $dataItemId == SMWDataValueFactory::getDataItemId( $dataItemId ) ) {
18941887 $result[] = $specialTableId;
18951888 }
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php
@@ -266,7 +266,7 @@
267267
268268
269269 public function getQueryResult( SMWQuery $query ) {
270 - global $smwgIgnoreQueryErrors, $smwgQSortingSupport;
 270+ global $smwgIgnoreQueryErrors;
271271
272272 if ( !$smwgIgnoreQueryErrors &&
273273 ( $query->querymode != SMWQuery::MODE_DEBUG ) &&
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLHelpers.php
@@ -196,7 +196,6 @@
197197
198198 $res = $db->query( $sql, __METHOD__ );
199199 $curfields = array();
200 - $result = array();
201200
202201 foreach ( $res as $row ) {
203202 if ( $wgDBtype == 'postgres' ) { // postgresql
@@ -330,8 +329,7 @@
331330 * @param DatabaseBase or Database $db
332331 */
333332 public static function setupIndex( $rawTableName, array $columns, $db ) {
334 - // TODO: $verbose is not a good global name!
335 - global $wgDBtype, $verbose;
 333+ global $wgDBtype;
336334
337335 $tableName = $db->tableName( $rawTableName );
338336
@@ -443,7 +441,7 @@
444442 }
445443 }
446444
447 - foreach ( $columns as $key => $index ) { // Add the remaining indexes.
 445+ foreach ( $columns as $index ) { // Add the remaining indexes.
448446 if ( $index != false ) {
449447 $type = 'INDEX';
450448
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -273,7 +273,7 @@
274274 * @return SMWStore
275275 */
276276 function &smwfGetStore() {
277 - global $smwgMasterStore, $smwgDefaultStore, $smwgIP;
 277+ global $smwgMasterStore, $smwgDefaultStore;
278278
279279 if ( is_null( $smwgMasterStore ) ) {
280280 $smwgMasterStore = new $smwgDefaultStore();
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php
@@ -27,7 +27,7 @@
2828 function enableSemantics( $namespace = null, $complete = false ) {
2929 global $smwgIP, $wgFooterIcons, $wgExtensionFunctions,
3030 $wgExtensionMessagesFiles,
31 - $smwgNamespace, $wgServer, $wgAPIModules;
 31+ $smwgNamespace, $wgAPIModules;
3232
3333 $wgExtensionFunctions[] = 'smwfSetupExtension';
3434 $wgExtensionMessagesFiles['SemanticMediaWiki'] = $smwgIP . 'languages/SMW_Messages.php';
@@ -416,7 +416,7 @@
417417 */
418418 function smwfSetupExtension() {
419419 wfProfileIn( 'smwfSetupExtension (SMW)' );
420 - global $smwgIP, $smwgScriptPath, $wgHooks, $wgFooterIcons, $smwgMasterStore, $smwgIQRunningNumber, $smwgToolboxBrowseLink;
 420+ global $smwgIP, $smwgScriptPath, $wgFooterIcons, $smwgMasterStore, $smwgIQRunningNumber;
421421
422422 $smwgMasterStore = null;
423423 $smwgIQRunningNumber = 0;

Status & tagging log