Extension talk:Semantic Extra Special Properties
- [History↑]
Contents
| Thread title | Replies | Last modified |
|---|---|---|
| Undefined variable: firstAuthor | 1 | 13:26, 30 April 2013 |
| Getting a fatal error: Call to undefined method WikiPage::getCreator() | 3 | 15:27, 26 April 2013 |
| EUSER sorted by number of edits? | 4 | 09:10, 1 April 2013 |
| Thank you! | 1 | 21:24, 25 March 2013 |
| WMF git repo | 8 | 19:19, 31 October 2012 |
| Cannot see any output from this extension | 1 | 22:41, 27 October 2012 |
| Problems with v0.2.3 | 3 | 07:39, 29 March 2012 |
| Add code for mimetype and mediatypes and some other changes ... | 6 | 05:23, 9 February 2012 |
| Convert to patch for SMW? | 7 | 19:55, 2 February 2012 |
| Changes to your code | 3 | 13:11, 5 January 2012 |
Hi. I'm running SESP version 0.2.8 alpha and when I run runJobs.php I'm getting the following error:
Notice: Undefined variable: firstAuthor in /var/www/webapps/wiki/extensions/Semantic-Extra-Special-Properties/SemanticExtraSpecialProperties.hooks.php
on line 255
Initialisation value '' is not a number.
Backtrace:
#0 /var/www/webapps/wiki/extensions/Semantic-Extra-Special-Properties/SemanticExtraSpecialProperties.hooks.php(276): SMWDINumber->__construct(NULL)
#1 [internal function]: SemanticESP::sespUpdateDataBefore(Object(SMWSQLStore3), Object(SMWSemanticData))
#2 /var/www/webapps/wiki/includes/Hooks.php(216): call_user_func_array('SemanticESP::se...', Array)
#3 /var/www/webapps/wiki/includes/GlobalFunctions.php(3856): Hooks::run('SMWStore::updat...', Array)
#4 /var/www/webapps/wiki/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php(216): wfRunHooks('SMWStore::updat...', Array)
#5 /var/www/webapps/wiki/extensions/SemanticMediaWiki/includes/SMW_ParseData.php(374): SMWStore->updateData(Object(SMWSemanticData))
#6 /var/www/webapps/wiki/extensions/SemanticMediaWiki/includes/SMW_ParseData.php(518): SMWParseData::storeData(Object(ParserOutput), Object(Title), true)
#7 [internal function]: SMWParseData::onLinksUpdateConstructed(Object(LinksUpdate))
#8 /var/www/webapps/wiki/includes/Hooks.php(216): call_user_func_array('SMWParseData::o...', Array)
#9 /var/www/webapps/wiki/includes/GlobalFunctions.php(3856): Hooks::run('LinksUpdateCons...', Array)
#10 /var/www/webapps/wiki/includes/LinksUpdate.php(99): wfRunHooks('LinksUpdateCons...', Array)
#11 /var/www/webapps/wiki/includes/job/RefreshLinksJob.php(49): LinksUpdate->__construct(Object(Title), Object(ParserOutput), false)
#12 /var/www/webapps/wiki/maintenance/runJobs.php(80): RefreshLinksJob->run()
#13 /var/www/webapps/wiki/maintenance/doMaintenance.php(105): RunJobs->execute()
#14 /var/www/webapps/wiki/maintenance/runJobs.php(110): require_once('/var/www/webapp...')
#15 {main}
I guess this is a bug?
Thanks
Hi I'm running MS 1.19.3, SMW 1.8 and Semantic Extra Special Properties 0.2.7.
When I save a page I get the following error:
Fatal error: Call to undefined method WikiPage::getCreator() in /var/www/webapps/intranet/extensions/SemanticExtraSpecialProperties/SemanticExtraSpecialProperties.hooks.php on line 126
I guess something has been depreciated.
0.2.7 actually requires MediaWiki 1.20+, which is where the method was introduced! It's mentioned in the Readme, but could be more clear, I guess.
I would like to show all contributors of an article sorted by the number of edits each user has done so far.
Can I use EUSER to achieve this?
If not, can you think of a workaround or maybe a new extra property?
Thanks for your help!
That should be possible, you can count the edits for a user by doing something like {{#ask:[[Page author::USERNAME]]|format=count}}, see i.e. http://xn--ssongsmat-v2a.nu/ssm/S%C3%A4songsmat:Anv%C3%A4ndarlista
It seems that {{#ask:[[Page author::USERNAME]]|format=count}} gives me the total number of edits a user did on the entire wiki.
I rather wanted to have the number of edits the user did on a particular page. Is that possible as well? Thanks!
Oh, I see. No, that's not possible, as far as I can see. How about creating an extension that provides a magic work for getting that number, and then setting a property using that magic word?
Thanks for the suggestion. If I'm more familiar with extension programming I might look into it. Would be perfect if I could show the percentages each user contributed (instead of the number of edits, which is misleading sometimes).
Meanwhile I used Extension:Contributors - after some tweaks I got it running and now it shows the number of edits (Example).
This looks like a great extension!
Previously I was using some hacks like this: http://smw.referata.com/wiki/Add_page_metadata_properties_to_a_page_(using_ED)
I have an idea for a similar extension that could be merged here... something along the lines of 'Semantic Property Properties'... basically to add a bunch of 'special' properties to each semantic property in the wiki. For example, which forms, pages, templates (classes) use the property, and what unique values the property has, and a count of each value.
Cheers,
First of all: great work on this extension! :)
I'd be very neat to have it in the WMF git repo stuff like most of the other SMW extensions which makes it easier for interested developers (which includes me) to track changes and provide feedback. It also gives you more visibility (people will see the extension if they look in the extension list, and changes will be automatically linked to on the IRC channel).
You can request a repository here: https://www.mediawiki.org/wiki/Git/New_repositories/Requests
You can then just push all your current commits to it and retain your full version history and stuff :) If you want me to help out with this, you can add me in the "developer" column as well (username: jeroendedauw).
I'm afraid you partially misunderstood me. I suggested you creating a request for a new WMF git repository with you having access it it, and then me as well in case you wanted me to help move the code. Nischayn22 already went ahead and created such a request, which currently has his and my accounts listed as people who will get access. Steps for you to take now are:
- Request Developer access (ie get an account)
- Add yourself to the list of developers for your extension
Ok, sorry for being a bit stupid here, programming really isn't my trade (even if I enjoy it), so all this svn/git/gerrit stuff is still a bit scary. I have developer access now, and an account at labsconsole.wikimedia.org, and now I'm trying to figure out how to add myself to the list of developers. Could you please point me in the right direction? rotsee (talk) 22:41, 30 October 2012 (UTC)
If you can do this fast (before the git repository is created), go to http://www.mediawiki.org/wiki/Git/New_repositories/Requests and add you labs username along with mine and Jeroen's for this extension.
You're not being stupid :) And this is not really a programming thing, but more a use-confusing-tools-correctly thing.
The repo has been created (see the commit history here)
Unfortunately you where not added to people with merge access. I have requested you to get access here. Please modify the name I put there (rotsee) in case you have a different username.
Heiya, a really cool sheat sheet is available here. This one covers all you normally need. Cheers
MediaWiki = 1.19.1 PHP = 5.3.15-pl0-gentoo (apache2handler) MySQL = 5.1.62-log
Have installed the extension correctly and added the following to LocalSettings.php :
require_once("$IP/extensions/SemanticExtraSpecialProperties/SemanticExtraSpecialProperties.php"); $sespSpecialProperties[] = '_EUSER'; // Add properties for contributing users $sespSpecialProperties[] = '_CUSER'; // Add property for creating user $sespSpecialProperties[] = '_REVID'; // Add property with current revision ID
Note that depending on local settings this value might not be very up to date.In case $wgDisableCounters is set to true this property will not be set.
$sespSpecialProperties[] = '_VIEWS'; // Add property with number of page views. $sespSpecialProperties[] = '_NREV'; // Add property showing an estimated number of total revisions $sespSpecialProperties[] = '_TNREV'; // Same but for the talk page, i.e. showing how much discussion is going on around this page $sespSpecialProperties[] = '_SUBP'; // Add properties pointing to subpages $sespSpecialProperties[] = '_MIMETYPE'; // Adding mimetype and mediatype in case the article object is NS_IMAGE/NS_FILE $sespSpecialProperties[] = '_MEDIATYPE'; // Adding mimetype and mediatype in case the article object is NS_IMAGE/NS_FILE $sespSpecialProperties[] = '_SHORTURL'; // Adding ShortUrl property, if ShortUrl Extension is installed $sespSpecialProperties[] = '_METADATA'; // Adding some porperties based om image metadata (exif data), when available $sespSpecialProperties[] = '_USERREG'; // Adding user registration date to user pages $wgSESPExcludeBots = true;
But no matter how many pages I edit, I still don't see any of the extra properties info on the pages. What am I missing?
Exception [edit]
Sometimes I have an exception in PHP code:
$firstRevision = $title->getFirstRevision(); $firstAuthor = User::newFromId( $firstRevision->getRawUser () );
I added debug statements and found a cause: Some artificial pages does not have first revision, so $firstRevision is null, and calling getRawUser method on null gets the code into trouble.
I fond the reason: Some fake pages does not have any revisions. Fake pages appears when an extension like SemanticMaps play tricks with parser to get template expanded or something like this.
Adding additional check
if ( $firstRevision !== null )
helps to avoid the problem.
One way ticket? [edit]
When I have discovered the crash, my first desire was to disable extension. However, after disabling I had another trouble: I cannot view properties any more:
There is no predefined property with "___CUSER".
Backtrace:
- 0 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/storage/SMW_SqlStubSemanticData.php(182): SMWDIProperty->__construct('___CUSER', false)
- 1 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/storage/SMW_SqlStubSemanticData.php(164): SMWSqlStubSemanticData->unstubProperty('___CUSER')
- 2 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/includes/storage/SMW_SqlStubSemanticData.php(69): SMWSqlStubSemanticData->unstubProperties()
- 3 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/specials/SearchTriple/SMW_SpecialBrowse.php(155): SMWSqlStubSemanticData->getProperties()
- 4 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/specials/SearchTriple/SMW_SpecialBrowse.php(108): SMWSpecialBrowse->displayData(Object(SMWSqlStubSemanticData), true)
- 5 /var/www/oc.su/Extensions/SemanticMediaWiki-1.7.1/specials/SearchTriple/SMW_SpecialBrowse.php(86): SMWSpecialBrowse->displayBrowse()
- 6 /var/www/oc.su/MediaWiki-1.18.1/includes/SpecialPageFactory.php(458): SMWSpecialBrowse->execute('???????????????...')
- 7 /var/www/oc.su/MediaWiki-1.18.1/includes/Wiki.php(240): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
- 8 /var/www/oc.su/MediaWiki-1.18.1/includes/Wiki.php(640): MediaWiki->performRequest()
- 9 /var/www/oc.su/MediaWiki-1.18.1/includes/Wiki.php(547): MediaWiki->main()
- 10 /var/www/oc.su/MediaWiki-1.18.1/index.php(57): MediaWiki->run()
- 11 {main}
Of course, I have database backed up before installing new extension, so I can just restore entire database. But someone may decide to stop using extra properties after long usage. How to stop using it?
We had a similar case with an SMW extension where a special property was declared but after de-activating of the extension the objects still persisted in the SMW database and forced a crash due non-existing definitions that where inherent by the extension (special page property) and not by SMW itself. For reference see [1]. I discussed this with Jeroen and for now SMW core lacks the ability to handle such cases to resolve non-existing special property definitions. The only way to resolve this issue is to run Special:SMWAdmin.
I would like to propose some minor changes as it would make it easier for other people to contribute:
- Contribution: could you put the code at least on github it would it make more simpler to patch and create release branches
- Maintenance: could you set an own class such as SemanticExtraSpecialProperties.hooks.php so it would make adding code a bit more easier and it would be a cleaner implementation
- Customizing: $smwgPageSpecialProperties2 seems to be an ought name (I mean the 2 at the end) so why not just called $sespSpecialProperties as it just belongs to SemanticExtraSpecialProperties
Since we needed something similar for mimetype and mediatypes on NS_FILE objects, as soon as you have it on github I'll at the code for mimetype and mediatypes.
Cheers and thanks
I just put this at Github (hope I made everything correct): https://github.com/rotsee/Semantic-Extra-Special-Properties As for the other suggestions (thanks for pointing those things out, btw), I'll take them on next week, as I will now be afk a couple of days!
rotsee 19:02, 2 February 2012 (UTC)
Thanks. Hope you don't mind but I made a fork https://github.com/mwjames/Semantic-Extra-Special-Properties and included all the proposed changes.
Feel free to make a review and if you'd like I can put them into your master later on.
Cheers
According to kgh he noted that hidden to some usergroup, as the article author property will list all authors for everyone maybe this should be taken care otherwise the extension faces scrutiny by a warning.
Could this extension be converted into a patch for SMW, so it can be merged in and available to all SMW users?
It would be more flexible to have it in an extra extension as it is now. Additionally I doubt that all extra properties would make it into core.
Is there a reason why they wouldn't make it into the core? Is it just to make maintenance easier? It seems that making them optional is a good idea, in any case.
It is just a feeling.
I guess the problem is that you can imagine an infinite number of special properties, so it might make sense to be a bit conservative about which ones to include in core. These ones do not reflect the wishes from the community, but only my personal needs. rotsee 13:23, 22 January 2012 (UTC)
I suppose at some point we should find out what people want. I have been keeping a list here:
User:Badon/Extension:Semantic_MediaWiki/Manual#Needed_special_properties
But I haven't done anything about finding a broad consensus, even though many of those I have gathered from people's wish lists.
Heiya Rotsee, I just made some formatting changes to your code to make compliant with MediaWiki customs. I hope that is ok with you. Cheers
Of course, thank you! I'm still learning. Thanks for your time! rotsee 07:02, 5 January 2012 (UTC)