Extension talk:Admin Links

From MediaWiki.org
Jump to: navigation, search

Contents

Feature Request [edit]

Hi, wouldn't it be nice to have a link to 'Special:Statistics' 'and Special:Version' in section „general“ of this extension. Cheers --kgh 19:14, 16 October 2009 (UTC)

Good idea; this was finally done, in version 0.1.3. :) Yaron Koren 21:37, 12 July 2010 (UTC)
Cool, thank you Yaron! I will give it a try soon. --kgh 16:48, 13 July 2010 (UTC)

I see requests for the addition of links. I think it would be nice to have a custom section at the end so we have a quick access to other more project-specific pages. This could be edited in the form of a system message. So all we need is two system messages. The first one would be the section title, the second one the section contents (allowing for more sections/subsections inside it). Just an idea. --Ioannis Protonotarios 12:00, 2 February 2013 (UTC)

That's an interesting idea. I should note that you can already add to the Admin Links page specifically for one wiki by adding the relevant code to LocalSettings.php. Not quite as convenient, though. Yaron Koren (talk) 02:47, 4 February 2013 (UTC)

Hide from normal users? [edit]

  • Can I hide the page "Special:AdminLinks" from normal users?--Harmageddon 17:35, 10 January 2010 (UTC)
Not at the moment; why would you want to? Yaron Koren 18:36, 10 January 2010 (UTC)
  • Because they don't need it ;-)--Harmageddon 18:44, 10 January 2010 (UTC)
Do you mean, not have the link displayed at the top, or have it not viewable once users get to that page? Because normal users should never see the top link. Yaron Koren 19:51, 10 January 2010 (UTC)
  • They don't see the top link, but they can see the page with its direct url or, for example in Special:Specialpages.--Harmageddon 16:16, 11 January 2010 (UTC)
Okay. No, there's no way to hide it, and I haven't yet seen a good reason to do that. I'm going by the basic "wiki philosophy", which is to leave everything out in the open unless there's a good reason not to. Yaron Koren 19:10, 11 January 2010 (UTC)
  • Times have changed. Wikis have moved beyond Wikipedia and open information. Wikis are being used in ways far beyond the original wiki philosophy. Wiki devs need to accept this evolution and allow for controls to implement secure wiki environments. When placed in sensitive environments for collaboration we as admins should be able to lock them down as we see fit to protect our data integrity and to prevent unintentional damage by curious users. 17:25, 9 March 2011 (UTC)
  • You can hide the Special: pages. I posted my working method here:
    Manual_talk:Special_pages#My_WORKING_solution_to_controlling_Special_Pages_access.
    Maybe it will be useful. You can pare it down to control one or two pages as needed. I use it for maximum control of every special page I can in certain installations. It's not perfect and may still have a few issues to iron out but it's the best solution I know of so far. Someone much smarter than me needs to write an extension for securing special pages. Oh and this method prevents direct URL access from the browser address bar. If a user tries to surf directly to a special page you have 'unset' their right to they will get your sites standard error page. Good luck. 17:25, 9 March 2011 (UTC)

Well, as I said, my view of the wiki philosophy is "to leave everything out in the open unless there's a good reason not to". If there were a threat to security or data integrity, that would be a good reason not to - but in this case, Special:AdminLinks is just a page of links, so it doesn't pose any danger. Yaron Koren 18:29, 9 March 2011 (UTC)

SQL [edit]

Uhm Yaron... Getting an error about the SQL table doesn't exist, but I can't find anywhere the required fields for the SQL. Are there anywhere I can get this SQL structure? - In that case, please provide link, and in future, maybe include it in Your install instructions ;) Mikkel Trebbien, Denmark 13:47, 18 August 2010 (UTC)

Hi - that's definitely not coming from Admin Links, which doesn't use SQL. Out of curiosity, what's the name of the table? Yaron Koren 15:34, 18 August 2010 (UTC)

Add Items to Admin List [edit]

How do we add items to the Admin List? This is a great idea but is not near enough complete.

I have successfully added a regular page such as:

$main_row->addItem( ALItem::newFromEditLink( 'Copyright', wfMsg( 'adminlinks_editcopyright' ) ) );

But, when I try to add a special page, using the exact same syntax as other special pages already included, such as:

$main_row->addItem( ALItem::newFromSpecialPage( 'ListGroupRights' ) );

I get this error message:

Fatal error: Call to a member function getTitle() on a non-object in /wiki/extensions/AdminLinks/AdminLinks_body.php on line 268

--Bro. Ignatius Mary 12:22, 17 September 2010 (UTC)

Hi, the documentation should be clearer on that - the actual name of most special pages, for some reason, is all lowercase except for the first letter. So "Listgrouprights" instead should work. Yaron Koren 15:06, 17 September 2010 (UTC)

Thank worked. Thanks.

--Bro. Ignatius Mary 19:52, 27 September 2010 (UTC)

Adding Pages not in Edit Mode [edit]

I would like to add links on the AdminLinks that are not Special and not regular links that open in edit mode.

How can this be done?

Thanks

--Bro. Ignatius Mary 23:29, 29 September 2010 (UTC)

Wow, I guess I missed this question completely. On the off chance that you still want to know the answer, it looks like you can do it using AlItem::newFromPage(). Yaron Koren 20:50, 9 March 2011 (UTC)

Link to Job Queue [edit]

Hi Yaron, since the number of jobs is not displayed on Special:Statistics it might be useful to introduce a nicely formatted link to this information into this extension

Perhaps it is possible just to query for the number of jobs and not for the whole lot. Cheers --[[kgh]] 21:42, 27 June 2011 (UTC)

As an aside there was a reason that count was removed from special:statistics, it was to hide it from admins who misinterpreted it on a regular basis. Just saying ;) Bawolff 04:52, 28 June 2011 (UTC)
Yeah, I know. However it was the only chance for me to determine if I should do a runJobs manually to speed up things or just let the users do the job for me. Still I have come to believe that this might not be the best idea. Since I know the trick ... :) Thanks for ruining my dream :P Cheers --[[kgh]] 07:45, 28 June 2011 (UTC)
It's true that the job number in Special:Statistics, as well as the one provided by the API, are sometimes way off - that's what Bawolff meant by "misinterpreted". I'll think about some alternate way to get at this number, because I think it can be important for admins to see. Yaron Koren 23:41, 28 June 2011 (UTC)
Only do it, if you really think that it is a good idea. Not showing this to the general public which is definitely not able to interpret it correctly is ok. On the other hand I think an (sys)admin should be able to interpret it after gaining some experience. At that stage it is quite a useful indicator, at least to me. Cheers --[[kgh]] 11:39, 29 June 2011 (UTC)

Link to Special:WantedProperties [edit]

Hi Yaron, what about inserting a link to this special page, too? Cheers --[[kgh]] 12:59, 6 July 2011 (UTC)

Link to Special:Log [edit]

Hi, I think that a link to Special:Log would be useful too. Cheers --[[kgh]] 23:23, 11 September 2011 (UTC) PS Hmm, I am wondering why I seem to be one of the few with enhancement requests to this extensions. Either I am one of the few who is using this extension or I have very special needs diverging from the general usage of wikis. I do not suppose that both this is true. :)

Good idea! I finally added this in to SVN now. And I'm not going to speculate on that one. :) Yaron Koren 21:24, 7 October 2011 (UTC)
Cool. Thank you for doing this. Coders do not seem to like speculating a lot, do they? :) Cheers --[[kgh]] 14:40, 8 October 2011 (UTC)

Crash [edit]

MediaWiki crashes after checking checkbox 'createaccount' for general group. Please help!

I believe that's not related to Admin Links. Yaron Koren (talk) 04:44, 20 April 2012 (UTC)

Fatal error: Call to a member function getTitle() on a non-object...xtensions/AdminLinks/AdminLinks_body.php on line 271 [edit]

Hi, I have an error when I try to go to AdminLinks http://domotiki.eu/index.php/Sp%C3%A9cial:AdminLinks

The sentence is : "Fatal error: Call to a member function getTitle() on a non-object in /homez.149/comparatxu/www/domotiki/extensions/AdminLinks/AdminLinks_body.php on line 271"

Any Idea ? Thanx

Nicolas

The issue is apparently that the code doesn't know about the $wgUser global variable, which is strange - that variable has been deprecated, but it hasn't been removed. In any case, this is a good reminder that Admin Links should be updated to no longer use it; I'll try to do that soon. Yaron Koren (talk) 12:54, 25 September 2012 (UTC)
Actually, I just remembered that there's already a patch waiting, that would get rid of $wgUser, among a lot of other stuff, here. However, it would remove backward-compatibility, which is why I haven't merged it yet. However, if you have Git, you could get that patch's code; otherwise, you could just try replacing that instance of "$wgUser->getSkin()->linkKnown" in the code with "Linker::linkKnown". Yaron Koren (talk) 13:17, 25 September 2012 (UTC)

Thanx for your answer, I ha ve replaced $wgUser->getSkin()->linkKnown by Linker::linkKnown at two places in AdminLinks_body.php but it still doesnt work... Nicolas NALLET (talk) 17:14, 26 September 2012 (UTC)

What's the error message it gives? Yaron Koren (talk) 03:12, 27 September 2012 (UTC)

Fatal error: Call to a member function getTitle() on a non-object in /homez.149/comparatxu/www/domotiki/extensions/AdminLinks/AdminLinks_body.php on line 271

Regards Nicolas NALLET (talk) 09:21, 27 September 2012 (UTC)

Oh, oops! I should have looked more closely at the original error message. My original diagnosis was wrong - $wgUser isn't the issue. Instead, one of the links that Admin Links is trying to create is for a page that doesn't exist on your wiki. If possible, could you place the following line of code right above line 271:
print "$page_name. ";

...and let me know what the last name it prints is? Yaron Koren (talk) 13:28, 27 September 2012 (UTC)

Ok so I have remplaced Linker::linkKnown by $wgUser->getSkin()->linkKnown to get the orinigal page and put print "$page_name. "; here (I have paste a little bit of code) :

global $wgUser; $item->text = $wgUser->getSkin()->linkKnown( $page_name, $desc, array(), $params ); print "$page_name. "; } else

And when I try to go to admin link it shows :

Spécial:Connexion. Fatal error: Call to a member function getTitle() on a non-object in /homez.149/comparatxu/www/domotiki/extensions/AdminLinks/AdminLinks_body.php on line 272

Ah - so the issue is the page "Spécial:Connexion", i.e. Special:UserLogin. But that string is not being called from anywhere in the Admin Links code, I don't think... by any chance, do you have any custom code, or custom extension, adding anything to the Admin Links page? Yaron Koren (talk) 19:01, 27 September 2012 (UTC)

No I didnt have any custom code or extension, so I will try to installe new version of MW and see.

Anyway Thank you for your support !

Nicolas NALLET (talk) 21:02, 27 September 2012 (UTC)

How to add an Link? [edit]

I want to add an Link to an external Site were the Admins can meet and diskuss... is this possible? And if, how? THX

Yes, you can add additional links to that page - you can do that in either a custom extension, or directly in LocalSettings.php. See here for more information. Yaron Koren (talk) 16:01, 2 April 2013 (UTC)
Well, I had seen this bevore, but unfortunately I had no idea how to do this...
Hi again, now i think I undertand how to add an internal link via
newFromEditLink so i added $main_row->addItem( ALItem::newFromEditLink( 'Deletereason-dropdown', $this->msg( 'adminlinks_Löschgründe' ) ) );

to AdminLinks_body.php and the message to AdminLinks.i18n.php but my try to add

 $main_row->addItem( ALItem::newFromExternalLink( 'https:/myurl.com, 'MyLinkName') ) );

kills the Extension. What do I wrong? --Dave

What's the error message? Yaron Koren (talk) 15:13, 4 April 2013 (UTC)
The Side Spezial:Admin-Links is blank

Okay - please see here for how to get error messages to display on the screen. Yaron Koren (talk) 15:59, 4 April 2013 (UTC)

Then I see this: Parse error: syntax error, unexpected ')' in /var/www/www.pflegewiki.de/extensions/AdminLinks/AdminLinks_body.php on line 61
Ah, yes - it looks like your 2nd line has one too many ')'. Yaron Koren (talk) 16:45, 4 April 2013 (UTC)

And what do I have to do to Link to a non MediaWiki Site? My Idea was to link to a other Namspace, for example this: PflegeWiki:Entsperrwünsche so I wrote

$main_row->addItem( ALItem::newFromEditLink( 'PflegeWiki:Entsperrwünsche', $this->msg( 'adminlinks_Endsperr' ) ) );

. But this opens an Site Called MediaWiki:PflegeWiki:Entsperrwünsche which doesen't exists. What can I do ? And is it possible to open a sight in readmode?

Yes - call ALItem::newFromPage() instead. Yaron Koren (talk) 21:02, 8 April 2013 (UTC)
OK now I got an Link which doesen't work, it looks like [[Link|Linktext]] I think I need an $params, but which?--82.113.99.194 21:55, 8 April 2013 (UTC)
I don't know - you should look in the Admin Links code to see all the ways in which the ALItem functions are called. Yaron Koren (talk) 22:56, 8 April 2013 (UTC)


I'm so sorry but its me again...
$ul = SpecialPage::getTitleFor( 'PflegeWiki:Endsperrwünsche' );
$main_row->addItem( AlItem::newFromPage( $ul, $this->msg( adminlinks_Endsperr' )->text(), array( 'type' => 'PflegeWiki:Endsperrwünsche', ) ) );
seems to work well but now it still links to Special:MyNameSpace:MySite... My idea is that the part after $ul is the problem.... any idea?
You shouldn't use SpecialPage::getTitleFor(), you should use Title::newFromText(). Yaron Koren (talk) 17:00, 9 April 2013 (UTC)

Add Categories to Admin Links [edit]

I would like to add several categories to my Admin Links page. I have tried:

  • ALItem::newFromEditLink( 'Category:cat name', ......Links to MediaWiki:Category:cat_name
  • ALItem::newFromEditLink( ':Category:cat name', .....errors out with "getFullURL() on a non-object"

Is this possible with Admin Links?

Assuming you want to just link to the categories, and not to the categories' edit pages, try ALItem::newFromPage() instead. Yaron Koren (talk) 17:01, 30 April 2013 (UTC)
Using ALItem::newFromPage( ':Category:cat name' ).... results in the correct link structure, but it is placed on the page as text versus an active link. Is there a special parameter, I need to use to make the result an active link?
Oops! It looks like newFromPage() was only partly working, for recent versions of MediaWiki. I just checked in a fix - if you're getting the code from Git, please get the latest, and if you can, let me know if it worked. Yaron Koren (talk) 13:45, 1 May 2013 (UTC)

Solved the problem. Categories are showing up as expected. All other links are working correctly. Thank you for your fast response and fix. p.s. Thank you for writing a book about wikis.

Great! Thanks for letting me know about the problem. And you're welcome! Yaron Koren (talk) 20:08, 1 May 2013 (UTC)