https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102358
Revision: 102358 Author: jeroendedauw Date: 2011-11-08 01:06:38 +0000 (Tue, 08 Nov 2011) Log Message: ----------- Follow up to r102352; Modified Paths: -------------- trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php trunk/extensions/SemanticMediaWiki/includes/SMW_Infolink.php trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Quantity.php trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Element.php trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_Concept.php trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RDF.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_PrintRequest.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLHelpers.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php trunk/extensions/SemanticMediaWiki/maintenance/SMW_conceptCache.php trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -126,7 +126,7 @@ * @return SMWDataValue */ static public function newDataItemValue( SMWDataItem $dataItem, $property, $caption = false ) { - if ( $property !== null ) { + if ( !is_null( $property ) ) { $typeId = $property->findPropertyTypeID(); } else { $typeId = self::$mDefaultDataItemTypeIds[$dataItem->getDiType()]; Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_Infolink.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/SMW_Infolink.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_Infolink.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -228,7 +228,7 @@ $title = Title::newFromText( $titletext ); - if ( $title !== null ) { + if ( !is_null( $title ) ) { if ( $outputformat == SMW_OUTPUT_WIKI ) { $link = "[[$titletext|$this->mCaption]]"; } else { // SMW_OUTPUT_HTML, SMW_OUTPUT_FILE @@ -240,7 +240,7 @@ // e.g. as in Special:Bla/il<leg>al -> Special:Bla&p=il<leg>al) $title = Title::newFromText( $this->mTarget ); - if ( $title !== null ) { + if ( !is_null( $title ) ) { if ( $outputformat == SMW_OUTPUT_WIKI ) { $link = '[' . $title->getFullURL( SMWInfolink::encodeParameters( $this->mParams, false ) ) . " $this->mCaption]"; } else { // SMW_OUTPUT_HTML, SMW_OUTPUT_FILE @@ -296,7 +296,7 @@ if ( $this->mInternal ) { $title = Title::newFromText( $this->mTarget ); - if ( $title !== null ) { + if ( !is_null( $title ) ) { return $title->getFullURL( SMWInfolink::encodeParameters( $this->mParams, false ) ); } else { return ''; // the title was bad, normally this would indicate a software bug Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -114,7 +114,7 @@ if ( $propertyDi->isInverse() ) { $result->addError( wfMsgForContent( 'smw_noinvannot' ) ); - } elseif ( $storeAnnotation && ( self::getSMWData( $parser ) !== null ) ) { + } elseif ( $storeAnnotation && !is_null( self::getSMWData( $parser ) ) ) { $semandticData->addPropertyObjectValue( $propertyDi, $result->getDataItem() ); // Take note of the error for storage (do this here and not in storage, thus avoiding duplicates). if ( !$result->isValid() ) { @@ -230,7 +230,7 @@ foreach ( $subjects as $subject ) { $subjectTitle = $subject->getTitle(); - if ( $subjectTitle !== null ) { + if ( !is_null( $subjectTitle ) ) { $jobs[] = new SMWUpdateJob( $subjectTitle ); } } @@ -240,7 +240,8 @@ foreach ( $subjects as $subject ) { $subjectTitle = $subject->getTitle(); - if ( $subjectTitle !== null ) { + + if ( !is_null( $subjectTitle ) ) { $jobs[] = new SMWUpdateJob( $subjectTitle ); } } @@ -263,15 +264,18 @@ foreach ( $proppages as $proppage ) { $propertyTitle = $proppage->getTitle(); - if ( $propertyTitle !== null ) { + + if ( !is_null( $propertyTitle ) ) { $jobs[] = new SMWUpdateJob( $propertyTitle ); } + $prop = new SMWDIProperty( $proppage->getDBkey() ); $subjects = $store->getAllPropertySubjects( $prop ); foreach ( $subjects as $subject ) { $subjectTitle = $subject->getTitle(); - if ( $subjectTitle !== null ) { + + if ( !is_null( $subjectTitle ) ) { $jobs[] = new SMWUpdateJob( $subjectTitle ); } } @@ -283,7 +287,8 @@ foreach ( $subjects as $subject ) { $subjectTitle = $subject->getTitle(); - if ( $subjectTitle !== null ) { + + if ( !is_null( $subjectTitle ) ) { $jobs[] = new SMWUpdateJob( $subject->getTitle() ); } } @@ -408,7 +413,8 @@ $pmdat = new SMWDIProperty( $smwgContLang->getPropertyId( 'Modification date' ) ); $timestamp = $article->getTimestamp(); $di = self::getDataItemFromMWTimestamp( $timestamp ); - if ( $di !== null ) { + + if ( !is_null( $di ) ) { $semdata->addPropertyObjectValue( $pmdat, $di ); } } Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -37,7 +37,8 @@ // Process redirects, if any (it seems that there is indeed no more direct way of getting this info from MW) if ( $smwgStoreAnnotations ) { $rt = Title::newFromRedirect( $text ); - if ( $rt !== null ) { + + if ( !is_null( $rt ) ) { $p = new SMWDIProperty( '_REDI' ); $di = SMWDIWikiPage::newFromTitle( $rt, '__red' ); SMWParseData::getSMWData( $parser )->addPropertyObjectValue( $p, $di ); Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -43,7 +43,8 @@ */ public function setDefaultNamespaces( $nsarray ) { $this->m_defaultns = null; - if ( $nsarray !== null ) { + + if ( !is_null( $nsarray ) ) { foreach ( $nsarray as $ns ) { $this->m_defaultns = $this->addDescription( $this->m_defaultns, new SMWNamespaceDescription( $ns ), false ); } @@ -136,7 +137,8 @@ switch ( $chunk ) { case '[[': // start new link block $ld = $this->getLinkDescription( $setsubNS ); - if ( $ld !== null ) { + + if ( !is_null( $ld ) ) { $conjunction = $this->addDescription( $conjunction, $ld ); } break; @@ -148,7 +150,7 @@ case '||': case '': case '</q>': // finish disjunction and maybe subquery - if ( $this->m_defaultns !== null ) { // possibly add namespace restrictions + if ( !is_null( $this->m_defaultns ) ) { // possibly add namespace restrictions if ( $hasNamespaces && !$mustSetNS ) { // add NS restrictions to all earlier conjunctions (all of which did not have them yet) $mustSetNS = true; // enforce NS restrictions from now on @@ -271,7 +273,8 @@ } else { // assume category/concept title /// NOTE: we add m_c...prefix to prevent problems with, e.g., [[Category:Template:Test]] $title = Title::newFromText( ( $category ? $this->m_categoryprefix : $this->m_conceptprefix ) . $chunk ); - if ( $title !== null ) { + + if ( !is_null( $title ) ) { $diWikiPage = new SMWDIWikiPage( $title->getDBkey(), $title->getNameSpace(), '' ); $desc = $category ? new SMWClassDescription( $diWikiPage ) : new SMWConceptDescription( $diWikiPage ); $result = $this->addDescription( $result, $desc, false ); @@ -327,7 +330,7 @@ switch ( $chunk ) { case '+': // wildcard, add namespaces for page-type properties - if ( ( $this->m_defaultns !== null ) && ( ( $typeid == '_wpg' ) || $inverse ) ) { + if ( !is_null( $this->m_defaultns ) && ( ( $typeid == '_wpg' ) || $inverse ) ) { $innerdesc = $this->addDescription( $innerdesc, $this->m_defaultns, false ); } else { $innerdesc = $this->addDescription( $innerdesc, new SMWThingDescription(), false ); @@ -384,7 +387,7 @@ } if ( is_null( $innerdesc ) ) { // make a wildcard search - $innerdesc = ( ( $this->m_defaultns !== null ) && ( $typeid == '_wpg' ) ) ? + $innerdesc = ( !is_null( $this->m_defaultns ) && ( $typeid == '_wpg' ) ) ? $this->addDescription( $innerdesc, $this->m_defaultns, false ) : $this->addDescription( $innerdesc, new SMWThingDescription(), false ); $this->m_errors[] = wfMsgForContent( 'smw_propvalueproblem', $property->getWikiValue() ); @@ -456,7 +459,7 @@ protected function finishLinkDescription( $chunk, $hasNamespaces, $result, &$setNS ) { if ( is_null( $result ) ) { // no useful information or concrete error found $this->m_errors[] = wfMsgForContent( 'smw_badqueryatom' ); - } elseif ( !$hasNamespaces && $setNS && ( $this->m_defaultns !== null ) ) { + } elseif ( !$hasNamespaces && $setNS && !is_null( $this->m_defaultns ) ) { $result = $this->addDescription( $result, $this->m_defaultns ); $hasNamespaces = true; } Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -286,7 +286,7 @@ $lastprintout = new SMWPrintRequest( $printmode, $label, $data, trim( $propparts[1] ) ); $printouts[] = $lastprintout; } elseif ( $param[0] == '+' ) { // print request parameter - if ( $lastprintout !== null ) { + if ( !is_null( $lastprintout ) ) { $param = substr( $param, 1 ); $parts = explode( '=', $param, 2 ); if ( count( $parts ) == 2 ) { Modified: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -164,7 +164,7 @@ public function getWikiPageValue() { if ( !isset( $this->m_wikipage ) ) { $diWikiPage = $this->m_dataitem->getDiWikiPage(); - if ( $diWikiPage !== null ) { + if ( !is_null( $diWikiPage ) ) { $this->m_wikipage = SMWDataValueFactory::newDataItemValue( $diWikiPage, null, $this->m_caption ); $this->m_wikipage->setOutputFormat( $this->m_outformat ); $this->addError( $this->m_wikipage->getErrors() ); Modified: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Quantity.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Quantity.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Quantity.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -117,7 +117,7 @@ $this->m_unitfactors = array(); $this->m_mainunit = false; - if ( $this->m_property !== null ) { + if ( !is_null( $this->m_property ) ) { $propertyDiWikiPage = $this->m_property->getDiWikiPage(); } if ( is_null( $this->m_property ) || is_null( $propertyDiWikiPag ) ) { Modified: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -638,7 +638,7 @@ */ public function getYear( $calendarmodel = SMWDITime::CM_GREGORIAN ) { $di = $this->getDataForCalendarModel( $calendarmodel ); - if ( $di !== null ) { + if ( !is_null( $di ) ) { return $di->getYear(); } else { return false; @@ -655,7 +655,7 @@ */ public function getMonth( $calendarmodel = SMWDITime::CM_GREGORIAN, $default = 1 ) { $di = $this->getDataForCalendarModel( $calendarmodel ); - if ( $di !== null ) { + if ( !is_null( $di ) ) { return ( $di->getPrecision() >= SMWDITime::PREC_YM ) ? $di->getMonth() : $default; } else { return false; @@ -672,7 +672,7 @@ */ public function getDay( $calendarmodel = SMWDITime::CM_GREGORIAN, $default = 1 ) { $di = $this->getDataForCalendarModel( $calendarmodel ); - if ( $di !== null ) { + if ( !is_null( $di ) ) { return ( $di->getPrecision() >= SMWDITime::PREC_YMD ) ? $di->getDay() : $default; } else { return false; Modified: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -349,8 +349,9 @@ */ public function getArticleID() { if ( $this->m_id === false ) { - $this->m_id = ( $this->getTitle() !== null ) ? $this->m_title->getArticleID() : 0; + $this->m_id = !is_null( $this->getTitle() ) ? $this->m_title->getArticleID() : 0; } + return $this->m_id; } Modified: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Element.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Element.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Element.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -31,7 +31,7 @@ * @param $dataItem SMWDataItem or null */ public function __construct( $dataItem = null ) { - if ( $dataItem !== null ) { + if ( !is_null( $dataItem ) ) { $this->m_dataItem = $dataItem; } } Modified: trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -162,12 +162,16 @@ if ( $this->add_backlinks ) { wfProfileIn( "RDF::PrintPages::GetBacklinks" ); $inprops = smwfGetStore()->getInProperties( $diWikiPage ); + foreach ( $inprops as $inprop ) { $propWikiPage = $inprop->getDiWikiPage(); - if ( $propWikiPage !== null ) { + + if ( !is_null( $propWikiPage ) ) { $this->queuePage( $propWikiPage, 0 ); // no real recursion along properties } + $inSubs = smwfGetStore()->getPropertySubjects( $inprop, $diWikiPage ); + foreach ( $inSubs as $inSub ) { if ( !$this->isPageDone( $inSub, $subrecdepth ) ) { $semdata = $this->getSemanticData( $inSub, true ); @@ -306,7 +310,7 @@ protected function flush( $force = false ) { if ( !$force && ( $this->delay_flush > 0 ) ) { $this->delay_flush -= 1; - } elseif ( $this->outputfile !== null ) { + } elseif ( !is_null( $this->outputfile ) ) { fwrite( $this->outputfile, $this->serializer->flushContent() ); } else { print $this->serializer->flushContent(); @@ -532,10 +536,12 @@ $ed = new SMWExpData( new SMWExpLiteral( $wgLanguageCode, null, 'http://www.w3.org/2001/XMLSchema#string' ) ); $data->addPropertyObjectValue( SMWExporter::getSpecialNsResource( 'swivt', 'langCode' ), $ed ); $mainpage = Title::newMainPage(); - if ( $mainpage !== null ) { + + if ( !is_null( $mainpage ) ) { $ed = new SMWExpData( new SMWExpResource( $mainpage->getFullURL() ) ); $data->addPropertyObjectValue( SMWExporter::getSpecialNsResource( 'swivt', 'mainPage' ), $ed ); } + // statistical information $ed = new SMWExpData( new SMWExpLiteral( SiteStats::pages(), null, 'http://www.w3.org/2001/XMLSchema#int' ) ); $data->addPropertyObjectValue( SMWExporter::getSpecialNsResource( 'swivt', 'pageCount' ), $ed ); Modified: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -147,13 +147,17 @@ if ( $property->isUserDefined() ) { $pe = self::getResourceElementForProperty( $property ); $peHelper = self::getResourceElementForProperty( $property, true ); + foreach ( $dataItems as $dataItem ) { $ed = self::getDataItemExpElement( $dataItem ); - if ( $ed !== null ) { + + if ( !is_null( $ed ) ) { $expData->addPropertyObjectValue( $pe, $ed ); } + $edHelper = self::getDataItemHelperExpElement( $dataItem ); - if ( $edHelper !== null ) { + + if ( !is_null( $edHelper ) ) { $expData->addPropertyObjectValue( $peHelper, $edHelper ); } } @@ -182,8 +186,10 @@ ( $dataItem->getNamespace() != $diSubject->getNamespace() ) ) ) { continue; } + $ed = self::getDataItemExpElement( $dataItem ); - if ( $ed !== null ) { + + if ( !is_null( $ed ) ) { if ( ( $property->getKey() == '_CONC' ) && ( $ed->getSubject()->getUri() === '' ) ) { // equivalent to anonymous class -> simplify description foreach ( $ed->getProperties() as $subp ) { @@ -334,11 +340,13 @@ break; } } + if ( $namespaceId != -1 ) { $dataItem = new SMWDIWikiPage( $parts[1], $namespaceId, '', $subobjectname ); } else { $title = Title::newFromDBkey( $dbKey ); - if ( $title !== null ) { + + if ( !is_null( $title ) ) { $dataItem = new SMWDIWikiPage( $title->getDBkey(), $title->getNamespace(), $title->getInterwiki(), $subobjectname ); } } Modified: trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_Concept.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_Concept.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_Concept.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -60,7 +60,7 @@ $concept_text = $query->getDescription()->getQueryString(); - if ( SMWParseData::getSMWData( $parser ) !== null ) { + if ( !is_null( SMWParseData::getSMWData( $parser ) ) ) { $diConcept = new SMWDIConcept( $concept_text, $concept_docu, $query->getDescription()->getQueryFeatures(), $query->getDescription()->getSize(), $query->getDescription()->getDepth() ); SMWParseData::getSMWData( $parser )->addPropertyObjectValue( $pconc, $diConcept ); } Modified: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RDF.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RDF.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RDF.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -79,7 +79,7 @@ break; } - if ( $property !== null ) { + if ( !is_null( $property ) ) { SMWExporter::addPropertyValues( $property, $resultarray->getContent() , $data, $subjectDi ); } } Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_PrintRequest.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_PrintRequest.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_PrintRequest.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -44,7 +44,7 @@ */ public function __construct( $mode, $label, $data = null, $outputformat = false, $params = null ) { if ( ( ( $mode == self::PRINT_CATS || $mode == self::PRINT_THIS ) && - $data !== null ) || + !is_null( $data ) ) || ( $mode == self::PRINT_PROP && ( !( $data instanceof SMWPropertyValue ) || !$data->isValid() ) ) || ( $mode == self::PRINT_CCAT && Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -99,7 +99,8 @@ public function setExtraPrintouts( $extraprintouts ) { $this->m_extraprintouts = $extraprintouts; - if ( $this->m_description !== null ) { + + if ( !is_null( $this->m_description ) ) { foreach ( $extraprintouts as $printout ) { $this->m_description->addPrintRequest( $printout ); } @@ -125,7 +126,7 @@ public function getQueryString() { if ( $this->m_querystring !== false ) { return $this->m_querystring; - } elseif ( $this->m_description !== null ) { + } elseif ( !is_null( $this->m_description ) ) { return $this->m_description->getQueryString(); } else { return ''; @@ -174,7 +175,8 @@ */ public function applyRestrictions() { global $smwgQMaxSize, $smwgQMaxDepth, $smwgQConceptMaxSize, $smwgQConceptMaxDepth; - if ( $this->m_description !== null ) { + + if ( !is_null( $this->m_description ) ) { if ( $this->m_concept ) { $maxsize = $smwgQConceptMaxSize; $maxdepth = $smwgQConceptMaxDepth; @@ -182,8 +184,10 @@ $maxsize = $smwgQMaxSize; $maxdepth = $smwgQMaxDepth; } + $log = array(); $this->m_description = $this->m_description->prune( $maxsize, $maxdepth, $log ); + if ( count( $log ) > 0 ) { $this->m_errors[] = wfMsgForContent( 'smw_querytoolarge', str_replace( '[', '[', implode( ', ' , $log ) ) ); } Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -488,8 +488,9 @@ foreach ( $this->mContent as $diContainer ) { $recordValue = SMWDataValueFactory::newDataItemValue( $diContainer, $propertyValue->getDataItem() ); $dataItems = $recordValue->getDataItems(); + if ( array_key_exists( $pos, $dataItems ) && - ( $dataItems[$pos] !== null ) ) { + ( !is_null( $dataItems[$pos] ) ) ) { $newcontent[] = $dataItems[$pos]; } } Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLHelpers.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLHelpers.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLHelpers.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -470,7 +470,7 @@ * @param object $receiver */ protected static function reportProgress( $msg, $receiver ) { - if ( $receiver !== null ) $receiver->reportProgress( $msg ); + if ( !is_null( $receiver ) ) $receiver->reportProgress( $msg ); } } \ No newline at end of file Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -195,7 +195,7 @@ if ( $property->isInverse() ) { // inverses are working differently $noninverse = new SMWDIProperty( $property->getKey(), false ); $result = $this->getPropertySubjects( $noninverse, $subject, $requestoptions ); - } elseif ( $subject !== null ) { // subject given, use semantic data cache + } elseif ( !is_null( $subject ) ) { // subject given, use semantic data cache $sd = $this->getSemanticData( $subject, array( $property->findPropertyTypeID() ) ); $result = $this->applyRequestOptions( $sd->getPropertyValues( $property ), $requestoptions ); } else { // no subject given, get all values for the given property @@ -499,7 +499,7 @@ $this->prepareValueQuery( $from, $where, $subproptable, $subvalue, $tableindex ); } } - } elseif ( $value !== null ) { // add conditions for given value + } elseif ( !is_null( $value ) ) { // add conditions for given value /// TODO This code still partly supports some abandoned flexibility of the DBkeys system; /// this is not very clean (see break; below) and should be improved $dbkeys = SMWCompatibilityHelpers::getDBkeysFromDataItem( $value ); Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -228,7 +228,7 @@ if ( $firstRow === false ) { $exists = false; return $expNsResource; - } elseif ( count( $firstRow ) > 1 && $firstRow[1] !== null ) { + } elseif ( count( $firstRow ) > 1 && !is_null( $firstRow[1] ) ) { $exists = true; $rediTargetElement = $firstRow[1]; $rediTargetUri = $rediTargetElement->getUri(); Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -422,10 +422,12 @@ */ protected function getQueryResultFromSparqlResult( SMWSparqlResultWrapper $sparqlResultWrapper, SMWQuery $query ) { $resultDataItems = array(); + foreach ( $sparqlResultWrapper as $resultRow ) { if ( count( $resultRow ) > 0 ) { $dataItem = SMWExporter::findDataItemForExpElement( $resultRow[0] ); - if ( $dataItem !== null ) { + + if ( !is_null( $dataItem ) ) { $resultDataItems[] = $dataItem; } } @@ -543,7 +545,7 @@ $namespaces[$matchElement->getNamespaceId()] = $matchElement->getNamespace(); } - if ( ( $singletonMatchElement !== null ) && + if ( ( !is_null( $singletonMatchElement ) ) && ( $singletonMatchElementName !== $matchElementName ) ) { return new SMWSparqlFalseCondition(); } @@ -558,7 +560,7 @@ $orderVariables = array_merge( $orderVariables, $subCondition->orderVariables ); } - if ( $singletonMatchElement !== null ) { + if ( !is_null( $singletonMatchElement ) ) { if ( $filter !== '' ) { $condition .= "FILTER( $filter )"; } @@ -716,7 +718,7 @@ //*** Record inner ordering variable if found ***// $result->orderVariables = $innerCondition->orderVariables; - if ( ( $innerOrderByProperty !== null ) && ( $innerCondition->orderByVariable !== '' ) ) { + if ( !is_null( $innerOrderByProperty ) && ( $innerCondition->orderByVariable !== '' ) ) { $result->orderVariables[$diProperty->getKey()] = $innerCondition->orderByVariable; } Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -461,7 +461,7 @@ * @return string */ public static function formatDebugOutput( $storeName, array $entries, $query = null ) { - if ( $query !== null ) { + if ( !is_null( $query ) ) { $preEntries = array(); $preEntries['Generated Wiki-Query'] = '<pre>' . str_replace( '[', '[', $query->getDescription()->getQueryString() ) . '</pre>'; $preEntries['Query Metrics'] = 'Query-Size:' . $query->getDescription()->getSize() . '<br />' . Modified: trunk/extensions/SemanticMediaWiki/maintenance/SMW_conceptCache.php =================================================================== --- trunk/extensions/SemanticMediaWiki/maintenance/SMW_conceptCache.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/maintenance/SMW_conceptCache.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -130,7 +130,8 @@ if ( isset( $options['concept'] ) ) { // single concept mode global $wgContLang; $concept = Title::newFromText( $wgContLang->getNsText( SMW_NS_CONCEPT ) . ':' . $options['concept'] ); - if ( $concept !== null ) { + + if ( !is_null( $concept ) ) { doAction( $concept ); } } else { // iterate over concepts @@ -139,17 +140,22 @@ } else { $start = 0; } + $end = $db->selectField( 'page', 'MAX(page_id)', false, 'SMW_refreshData' ); + if ( array_key_exists( 'e', $options ) ) { $end = min( intval( $options['e'] ), $end ); } + $num_lines = 0; for ( $id = $start; $id <= $end; $id++ ) { $title = Title::newFromID( $id ); + if ( is_null( $title ) || ( $title->getNamespace() != SMW_NS_CONCEPT ) ) { continue; } + $num_lines += doAction( $title, $num_lines ); } } Modified: trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php =================================================================== --- trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -181,16 +181,21 @@ print "$num_files IDs refreshed.\n"; } else { print "Refreshing specified pages!\n\n"; + foreach ( $pages as $page ) { if ( $verbose ) { print "($num_files) Processing page " . $page . " ...\n"; } + $title = Title::newFromText( $page ); - if ( $title !== null ) { + + if ( !is_null( $title ) ) { $updatejob = new SMWUpdateJob( $title ); $updatejob->run(); } + $num_files++; } + print "$num_files pages refreshed.\n"; } Modified: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php =================================================================== --- trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -61,13 +61,13 @@ $errors = array(); $diWikiPage = $result[0]->getDiWikiPage(); - $title = $diWikiPage !== null ? $diWikiPage->getTitle() : null; + $title = !is_null( $diWikiPage ) ? $diWikiPage->getTitle() : null; if ( $result[0]->isUserDefined() && ( $result[1] <= 5 ) ) { $errors[] = wfMsg( 'smw_propertyhardlyused' ); } - if ( $result[0]->isUserDefined() && $title !== null && $title->exists() ) { + if ( $result[0]->isUserDefined() && !is_null( $title ) && $title->exists() ) { $typeProperty = new SMWDIProperty( '_TYPE' ); $types = smwfGetStore()->getPropertyValues( $diWikiPage, $typeProperty ); if ( count( $types ) >= 1 ) { @@ -75,7 +75,7 @@ $typestring = $typeDataValue->getLongHTMLText( $linker ); } $proplink = $linker->makeKnownLinkObj( $title, $result[0]->getLabel() ); - } elseif ( $result[0]->isUserDefined() && $title !== null ) { + } elseif ( $result[0]->isUserDefined() && !is_null( $title ) ) { $errors[] = wfMsg( 'smw_propertylackspage' ); $proplink = $linker->makeBrokenLinkObj( $title, $result[0]->getLabel(), 'action=view' ); } else { // predefined property @@ -89,9 +89,11 @@ if ( $typestring === '' ) { global $smwgPDefaultType; + $typeDataValue = SMWTypesValue::newFromTypeId( $smwgPDefaultType ); $typestring = $typeDataValue->getLongHTMLText( $linker ); - if ( $title !== null && $title->exists() ) { // print only when we did not print a "nopage" warning yet + + if ( !is_null( $title ) && $title->exists() ) { // print only when we did not print a "nopage" warning yet $errors[] = wfMsg( 'smw_propertylackstype', $typestring ); } } Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php =================================================================== --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2011-11-08 01:00:31 UTC (rev 102357) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2011-11-08 01:06:38 UTC (rev 102358) @@ -109,7 +109,7 @@ $html .= '<br /><h2>' . wfMsg( 'smw_smwadmin_datarefresh' ) . "</h2>\n" . '<p>' . wfMsg( 'smw_smwadmin_datarefreshdocu' ) . "</p>\n"; - if ( $refreshjob !== null ) { + if ( !is_null( $refreshjob ) ) { $prog = $refreshjob->getProgress(); $html .= '<p>' . wfMsg( 'smw_smwadmin_datarefreshprogress' ) . "</p>\n" . '<p><div style="float: left; background: #DDDDDD; border: 1px solid grey; width: 300px; "><div style="background: #AAF; width: ' . _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs