Last modified: 2013-06-08 07:35:09 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T51219, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 49219 - $wgCapitalLinkOverrides ignored
$wgCapitalLinkOverrides ignored
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-05 23:03 UTC by John McClure
Modified: 2013-06-08 07:35 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Chgs to 6 SMW files for bug 49219 (22.72 KB, application/empty)
2013-06-07 00:51 UTC, John McClure
Details

Description John McClure 2013-06-05 23:03:24 UTC
$wgCapitalLinkOverrides is being ignored, but it appears $wgCapitalLinks is not in SWM_GlobalFunctions.php, SMW 1.8.

Thanks - john
Comment 1 MWJames 2013-06-05 23:13:08 UTC
(In reply to comment #0)
> $wgCapitalLinkOverrides is being ignored, but it appears $wgCapitalLinks is
> not
> in SWM_GlobalFunctions.php, SMW 1.8.
> 
> Thanks - john

Ignored where? Do you have a particular example?

## General notion

$wgCapitalLinkOverrides/$wgCapitalLinks are globals defined by MW which don't have be included by SMW as access is available via $GLOABLS['wgCapitalLinks'] or $GLOABLS['wgCapitalLinkOverrides']

SWM_GlobalFunctions.php (Defines.php in SMW 1.9) only specifies globals that are SMW related.
Comment 2 John McClure 2013-06-05 23:36:25 UTC
may be good to use MWNamespace::isCapitalized($intNamespace) as in...

function smwfNormalTitleDBKey( $text, $intNamespace ) {
	if( MWNamespace::isCapitalized($intNamespace) ) {
		$text = ucfirst( trim( $text ) );
	}
	else {
		$text = lcfirst( trim( $text ) );
	}
	return str_replace( ' ', '_', $text );
}
..snip..
function smwfNormalTitleText( $text ) {
	if( MWNamespace::isCapitalized($intNamespace) ) {
		$text = $wgContLang->ucfirst( trim( $text ) );
	}
	else {
		$text = $wgContLang->lcfirst( trim( $text ) );
	}
	return str_replace( '_', ' ', $text );
}
Comment 3 John McClure 2013-06-05 23:53:42 UTC
(note: above comment should have a new param on the smwfNormalTextTitle() method.)

Related to this is line 33 in SMW_DV_PropertyList.php:
		$namespace = smwfNormalTitleText( $propertyNameParts[0] );

1. Looks like it's normalizing namespace-names as if they were page-names, since one could specify a property named "dc:creator".

2. It may not be foresighted to assume there are only 2 strings resulting from the explode() on line 29... can one have Property:dc:creator, for instance?
Comment 4 MWJames 2013-06-06 00:06:05 UTC
(In reply to comment #3)
> (note: above comment should have a new param on the smwfNormalTextTitle()
> method.)

As a site note (I haven't looked at given examples yet) smwfNormalTextTitle should be deprecated and be replaced by a "normal" class object that can be injected which would allow separate unit testing.

If you feel up to it, you might want to tackle this and additionally provide some unit tests that ensures proper coverage otherwise it might take some time before someone is trying to dig into this.
Comment 5 John McClure 2013-06-06 00:16:29 UTC
Yes I agree smwfNormalTitleText & smwfNormalTitleDBKey should be deprecated as you say. I'll try at least some code and post here to be sure it's ok before I continue on? Thanks - john
Comment 6 John McClure 2013-06-07 00:51:38 UTC
Created attachment 12485 [details]
Chgs to 6 SMW files for bug 49219

Here's my changes to SMW for this problem. I have eliminated all six calls to SMWNormalTitleText which I found while none were found for SMWNormalTitleDBKey, in the SMW codebase. I have not checked other semantic extensions though. I have a variety of tests in ExpandTemplates (that won't do you much good) and results are as expected. Where might I look for existing SMW query parser tests?

Inventory
1. SMW_GlobalFunctions.php - removed two functions
2. SMW_SemanticData.php - added 3 public static flags
3. SMW_QueryProcessor.php - re-coded spots where removed calls
4. SMW_DV_Types, SMW_DV_Property & SMW_DV_PropertyList.php - re-code spots

I wanted to bounce these off you & ask for help unit testing.
Thanks - john
Comment 7 MWJames 2013-06-07 01:37:32 UTC
Thanks for your work but after I quick peek it leaves me with two general concerns.

The first remark is directed towards that changes should be submitted to Gerrit directly because I can't see from the posted files which part of the classes did change and potentially cause problems which leads to the second problem that your changes are based on SMW 1.8 which means that some of the changes can't be incorporate into SMW 1.9 because the base class has been updated in 1.9 already which makes it tedious to try to patch manually the files with the current master.

A general tactic is to incorporate changes with the current master and only after it passes unit tests on the master, a patch might be provided for a lower release (if absolutely necessary).

As for unit tests[1], the current 1.9 master has several (~50) unit tests available and I think I wrote even a test for the GlobalFunction.php which would fail now since those two methods are gone and the unit tests need to be updated.

SMW_SemanticData.php, SMW_QueryProcessor.php, SMW_DV_Types, SMW_DV_Property & SMW_DV_PropertyList.php are high risk classes and definitely need unit tests to ensure that no core functionality is broken but this can only be verified by having those changes in Gerrit and based on the current master in order for the continues integration platform (Jenkins) to run tests against the current master.

[1] https://www.semantic-mediawiki.org/wiki/PHPUnit_tests
Comment 8 John McClure 2013-06-07 02:38:45 UTC
oops I shouldhave said SMW_QueryParser.php not SMW_QueryProcessor.php above.

so the next step is to check these files into gerrit, as some branch of smw? I'd think I'd need privledges to do that - I have created one project already, with some difficulty, to be kind about it!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links