Extension talk:UserFunctions

From MediaWiki.org
Jump to: navigation, search
Start a new discussion

Contents

Thread titleRepliesLast modified
UserFunctions breaks maintenance/importImages.php309:23, 3 May 2012
$wgUFEnablePersonalDataFunctions = true; not working1008:43, 22 March 2012
More secure version suggestion411:27, 3 January 2012
Issue with MW 1.18.0519:00, 23 December 2011
Rewriting of the extension607:40, 20 December 2011
#ip:012:56, 30 October 2011
Request 120:01, 28 September 2011
Version 1.2019:59, 28 September 2011
Version 1.1019:58, 28 September 2011

UserFunctions breaks maintenance/importImages.php

The UserFunctions extension breaks the importImages.php maintenance script:

Importing ******.mp3...
Fatal error: Call to a member function getNamespace() on a non-object in /var/******/extensions/UserFunctions/UserFunctions.php on line 84

I thus temporarily added if( is_object( $wgTitle ) ) to get it back to a working state.

Clausekwis (talk)14:06, 15 April 2012

Hi, in which MW version did it happen?

Toniher (talk)15:36, 19 April 2012

Hi, I encountered the same error using http://www.mediawiki.org/wiki/Extension:Data_Import_Extension with MW 1.17.0 and SemanticMediaWiki 1.6.1. I enabled all namespaces including -1 for UserFunctions with no success. Any help is very appreciated.

Best Karsten

Kaboomki (talk)13:47, 26 April 2012

I'm going to provide a fixed version in Git as soon as I can. This is the change I tried myself in UserFunctions.php:

        function registerParser( &$parser ) {
                global $wgUFEnablePersonalDataFunctions, $wgUFAllowedNamespaces;
 
                // Whether it's a Special Page or a Maintenance Script
                $special = false;
 
                // Depending on MW version
                if (class_exists("RequestContext")) {           
                        $pagetitle = RequestContext::getMain()->getTitle();
                        if (method_exists($pagetitle, 'getNamespace' )) {
                                $cur_ns = $pagetitle->getNamespace();
                                if ($cur_ns == -1) {
                                        $special = true;                
                                }
                        }
                        else {
                                $special = true;
                        }
                } else {
                        global $wgTitle;
                        if (method_exists($wgTitle, 'getNamespace' )) {
                                $cur_ns = $wgTitle->getNamespace();
                                if ($cur_ns == -1) {
                                        $special = true;
                                }
                        }
                        else {
                                $special = true;
                        }
                }
 
                $process = false;
 
                // As far it's not special case, check if current page NS is in the allowed list 
                if (!$special) {
                        if (isset($wgUFAllowedNamespaces[$cur_ns])) {
                                if ($wgUFAllowedNamespaces[$cur_ns]) {
                                        $process = true;
                                } 
                        }
                }
...
Toniher (talk)09:23, 3 May 2012
 
 
 

$wgUFEnablePersonalDataFunctions = true; not working

Heiya Toniher, I just deployed UF 2.2 together with MW 1.17.2 and realised that enabeling PersonalDataFunctions does not work at all. May you please check if there is an issue. UF 1.5 is working as expected. Thank you and cheers

[[kgh]]19:38, 12 January 2012

Hi! Maybe the problem is 'Allowed Namespaces' ? Maybe that should be more clear :/

Is it only PersonalDataFunctions or any other function? I've tried in a MW 1.17.2 installation today and no problem. Let me know!

Toniher22:47, 13 January 2012

Heiya, no it cannot be an allowed namespace issue. I set

$wgUFAllowedNamespaces = array(
        NS_MAIN => true,
        NS_TEMPLATE => true,
        NS_USER => true
);

in LocalSettings.php, so it should at least work in these namespaces. However, it does not. That's why I thought it must be $wgUFEnablePersonalDataFunctions. The other parser functions in NS_MAIN are working. I guess I will have to add NS_MEDIAWIKI since this array will override the standart setting. I will do another test tomorrow. Cheers

[[kgh]]23:30, 13 January 2012
 
Edited by author.
Last edit: 16:55, 15 January 2012

Heiya,

now I tried with MW 1.18.1 and this setting in LocalSettings.php

require( "extensions/UserFunctions/UserFunctions.php" );
$wgUFEnablePersonalDataFunctions = true;
$wgUFAllowedNamespaces[NS_MAIN] = true;

Sadly I cannot get it to work. All functions from this exetension are broken. I wonder what I am doing wrong. :(

[[kgh]]16:21, 15 January 2012

With 1.18.1 I get it work, for instance for NS_MEDIAWIKI and NS_MAIN. I use this:

require_once( "$IP/extensions/UserFunctions/UserFunctions.php" );
$wgUFEnablePersonalDataFunctions = true;
 
/** Restrict to certain namespaces **/
$wgUFAllowedNamespaces[NS_MAIN] = true;

I will try 1.17.2 now.

Toniher16:46, 15 January 2012

A typo, I meant MW 1.18.1! The only difference is the way of the extension's inclusion. I tested your proposal before and just tried again now. However, the result is the same. :( Hmm ... It must be something tiny, but I cannot think of what this may be.

[[kgh]]16:51, 15 January 2012
 

One thing that just came to my mind. My server is running PHP 5.3 I the past I learned that quite a few extensions have trouble with it. Thus I just tested it on a server running PHP 5.2 et voila: it is working. There must be something in the code which is not liked by PHP 5.3.

[[kgh]]17:24, 15 January 2012

Hi, I can make it work in 1.17.2 as well. PHP version I'm using is: PHP Version 5.3.6-13ubuntu3.3 Maybe a specific php.ini or PHP minor version problem? It would be nice if more people could report...

Toniher18:25, 15 January 2012
 
 
 
 
 

More secure version suggestion

The page says that this extension has a major security risk because these functions can be used to superficially hide information from sysops and can expose e-mail address.

I have some suggestions to enhances this extension and make it safe:

  • Limit its functionnality to some namespace where only sysops can modify pages (MediaWiki:) to define message.
  • Add the possibility to select only some functionnality of this extension and disable the other (like #useremail).

It would be great to enable this extension on Wikimedia sites, in particular for the #username, otherwise the {{gender:}} tag is quite useless.

DavidL12:46, 30 September 2011

Hi, after some comments from Platonides here: Special:Code/MediaWiki/106597, I rechecked this page and I've seen your comments. I'm going to add these possibilities. Would you and other users suggest some defaults for each of these two points?

Toniher00:15, 21 December 2011

Perhaps a setting like $wgUFDisclosePrivateInformation might be a good idea to control if #realname, #useremail should be enabled or not. Something like $wgUFDiscloseRealName or $wgUFDiscloseUserName would allow a more fine grained control, but I do not think that is necessary. To remove these functions is not a good idea since there are valid usecases around for wikis. Cheers

[[kgh]]20:38, 23 December 2011

I just saw that you already introduced this improvement three days ago. Shame on me. Cool and thank you.

[[kgh]]16:53, 24 December 2011

Hey, no problem. I've just also added also the NS allowance/blocking suggestion from DavidL. Happy New Year to all!

Toniher11:27, 3 January 2012
 
 
 
 

Issue with MW 1.18.0

Heiya Toniher, I just upgraded my wiki to MW 1.18.0 and UF 2.0 and found out that the functions do not work in the sidebar (MediaWiki:Sidebar) on Monobook skin. It just displays everything in the sidebar. This is sad. :( What kind of behaviour do you experience on your wiki? I ruled out sidebar caches on my wiki. Cheers

[[kgh]]23:23, 19 December 2011

uh. It works in MediaWiki Sidebar in a 1.17 installation. Let me see if I can check it in a 1.18 :O

Toniher15:22, 20 December 2011

1.17 is ok, but 1.18 ... *fear* On regular wiki pages there is no problem at all.

[[kgh]]15:25, 20 December 2011

No parser function seems to work there.

ifexpr, ifeq, etc. are ignored inside MediaWiki:Sidebar as well. I would research for any comment anywhere. If I don't find anything, I would fill a bug in case it's not intentional.

Toniher14:33, 22 December 2011

Filled bug here: https://bugzilla.wikimedia.org/show_bug.cgi?id=33321

If it is not / cannot be solved, I would check whether this alternative works in 1.18: Extension:CustomNavBlocks

Toniher15:37, 22 December 2011

Hi Toniher, thank you for checking this and filing a bug. Let's hope for the best. Perhaps CustomNavBlocks is an alternative. First I will wait and see how this bug develops since I prefer UserFunctions. Cheers and thank you again.

[[kgh]]19:00, 23 December 2011
 
 
 
 
 

Rewriting of the extension

Following the model of ParserFunctions, but mainly for making it compatible with extensions such as Variables, I have rewritten the extension.

Code is here.

I would update extension page unless anyone finds any objection.

Toniher23:12, 12 December 2011

Heiya Toniher, that's cool. No objections from my side. You also added I18N, which was missing too. Is it supposed to stay at gitorious or do you also have plans for moving it to SVN to allow translations via translatewiki.net. Cheers

[[kgh]]23:17, 12 December 2011
Edited by 0 users.
Last edit: 09:50, 13 December 2011

Hi! If possible, I think it would be better to submit it to MediaWiki SVN. I will follow the procedure to do this. Thanks!

Toniher09:50, 13 December 2011

That's great. I guess it will not only be useful for you with regard to this extension to have access to SVN. Cheers

[[kgh]]10:12, 13 December 2011

Done: http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/UserFunctions/ In a couple of days I would change the extension page.

Toniher23:35, 18 December 2011

Cool, the first five translations are already there too. :) At $wgExtensionCredits you may change 'al.' to '...' Since MW 1.18 this gets automatically transformed in the wiki language for, e.g. 'others', 'andere' etc. I have already done the first update of the page to save you some time. You may now add notes for the new magic you added to the extension as soon as you have time to do so. Cheers

[[kgh]]22:03, 19 December 2011
 
 
 
 
 

Hi, this parser function is a bit redundant in this extension. Still I believe it should be there. Cheers

[[kgh]]12:56, 30 October 2011

Hi, I would like to add a method that use getId() to get the user ID (the integer one), this way references survive user name changes. How do I contribute code here? By just editing the page, or what?

//Nicklas20:00, 28 September 2011

Yeah, since this extension is not in SVN you may just edit the page. Cheers

[[kgh]]20:01, 28 September 2011
 

Version 1.2

... and I added the #ifingroup function, and updated the version to 1.2 .

Louperivois 16:29, 25 July 2008 (UTC)19:59, 28 September 2011

Version 1.1

I just added the #nickname function, and updated the version to 1.1 . This was tested with the "post wiki-1.8" version only, but I believe the "pre 1.8" version will be all right too.

Lexw 13:19, 27 June 2008 (UTC)19:58, 28 September 2011
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox