Extension talk:SpecialInterwiki

From MediaWiki.org

Jump to: navigation, search

Contents

The following discussion has been transferred from meta.wikimedia.org.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

Just a note to say that this works with 1.5 too! Thanks.

[edit] Database?

Maybe I'm doing something wrong, but is it supposed to produce the database tables for me, or do I have to create them? I keep getting errors that the table it wants doesn't exist. I don't mind editing them manually, but there doesn't appear to be any instructions for doing so... --69.250.40.75 03:09, 23 December 2005 (UTC)

[edit] Function error

Doesn't work in the new version(1.5.7) of wikimedia.

I get Fatal error: Call to undefined function: includable() in /extensions/SpecialInterwiki.php on line 65 --Sgrayban 14:37, 24 March 2006 (UTC)

Me too, but mine's: Fatal error: Call to a member function on a non-object in /includes/SkinTemplate.php on line 306 - 154.20.86.196 05:25, 16 April 2006 (UTC)
Me too - Mediawiki 1.6.3, php 5.1.2, my error is: PHP Fatal error: Call to a member function getID() on a non-object in /usr/local/www/data-dist/mediawiki/includes/SkinTemplate.php on line 306, referer: http://wiki.bitparts.org/index.php/Special:Specialpages 71.11.157.24 04:32, 20 April 2006 (UTC)
I also get this error: Fatal error: Call to a member function on a non-object in /includes/SkinTemplate.php on line 306 --68.220.84.93 21:29, 21 April 2006 (UTC)

[edit] Security fixes

The original version of this code had some bugs, including some security issues:

  • cross-site request forging
  • cross-site scripting via HTML/JavaScript injection
  • SQL injection

Additionally some of the HTML output wasn't well-formed so it would break XML-strict browsers when the wiki is configured for sending the 'real' XHTML Content-Type.

I've made some corrections to the copy on the wiki page:

  • Use of the edit token to protect against forged form submissions
  • Escaping of HTML output to protect against JavaScript injection/XSS
  • Switched from manual SQL (missing escaping) to the database query builder functions which provide safety automatically

Also the bug running on current 1.6 versions is fixed by adding the call to $this->setHeaders(). --brion 08:26, 22 April 2006 (UTC)

[edit] SVN?

Anyone know what the process is on getting this into svn? It seems it would be of much more benefit there. --Ymmotrojam 17:47, 17 August 2006 (UTC)

Seconded. This is such a basic feature it ought to be at least in the Extensions Subversion repository, and probably in the main SVN. I don't know how to request that but I imagine Bugzilla is as good a way as any. Unfortunately Wikimedia's Bugzilla is down right now. --Kingboyk 17:31, 4 January 2007 (UTC)

[edit] Read-only version

Upon reflection, this doesn't really fulfill my need. To manipulate the interwiki list I just use phpMyAdmin or MS Access. What I would like - and I think this ought to be built-in Mediawiki - is a read-only list of interwiki links for the benefit of the users.

Anyway I'll have a play and maybe will come up with something I can post back here. --Kingboyk 19:59, 4 January 2007 (UTC)

OK, it's read only for those without privileges ("developer" group in my install). Works fine on 1.8.2 (r18799). --Kingboyk 20:15, 4 January 2007 (UTC)

[edit] Dutch translation

If you are interested in more translations, this is the Dutch (nl) translation:

$wgSpecialInterwikiMessages['nl'] = array(
        'interwiki' => 'Interwikidata bekijken en wijzigen',
        'interwiki_delquestion' => '"$1" aan het verwijderen',
        'interwiki_deleted' =>  '$1 is succesvol verwijderd van de interwikitabel.',
        'interwiki_prefix' => 'Prefix',
        'interwiki_prefix2' => 'Prefix:',
        'interwiki_url' => 'URL',
        'interwiki_local' => 'Local',
        'interwiki_trans' => 'Trans',
        'interwiki_delete' => 'Verwijderen',
        'interwiki_yes' => 'Ja',
        'interwiki_delfailed' => '$1 kon niet worden verwijderd van de interwikitabel.',
        'interwiki_added' => '$1 is succesvol toegevoegd aan de interwikitabel.',
        'interwiki_addfailed' => '$1 kon niet worden toegevoegd aan de interwikitabel.',
        'interwiki_log_added' => 'Voegde "$1" ($2) (local: $3) (trans: $4) toe aan de interwikitabel: $5',
        'interwiki_alreadyexists' => '$1 bestaat al in de interwikitabel!',
        'interwiki_log_deleted' => 'Verwijderde prefix "$1" van de interwikitabel: $2',
        'interwiki_add' => '*Een interwikiprefix toevoegen',
        'interwiki_show' => '*Alle interwikiprefixen bekijken',
        'interwiki_logpagename' => 'Logboek interwikitabel',
        'interwiki_logpagetext' => 'Dit is een logboek van wijzigingen aan de interwikitabel.',
        'interwiki_logentry' => '',
        'interwiki_reasonfield' => 'Reden',
        'interwiki_addtext' => 'Een interwikiprefix toevoegen',
        'interwiki_delbutton' => 'Verwijderen',
        'interwiki_addbutton' => 'Toevoegen',

SPQRobin 12:51, 2 September 2007 (UTC)

[edit] How to add the translation file

I've added the SpecialInterwiki.i18n.php file, and I have to change something in the SpecialInterwiki.php file, but I don't know what. The information for this is unclear :-( SPQRobin 14:09, 22 September 2007 (UTC)

The necessary update to SpecialInterwiki.php is presented as a diff(1) - and not even one in unified format -, so I agree, it's unclear. Basically, though, all you need to do is replace the two blocks of lines marked with exclamation marks with the versions below. First of all,
global $IP, $wgMessageCache, $wgHooks;
becomes
global $IP, $wgMessageCache, $wgHooks, $wgSpecialInterwikiMessages;
And second, the entire block of $wgMessageCache->addMessage calls get replaced by:
require_once( 'SpecialInterwiki.i18n.php');
foreach( $wgSpecialInterwikiMessages as $key => $value ) {
$wgMessageCache->addMessages( $wgSpecialInterwikiMessages[$key], $key );}
Hope this helps. :) (Assuming you still need help with this, but if not, well, maybe the next person who's got the same problem will find this useful.) -- Schneelocke 17:33, 10 October 2007 (UTC)
This works. Thanks! SPQRobin 15:46, 12 October 2007 (UTC)

[edit] Suggestions

Here's a few things I'd suggest for this extension - any thoughts?

  • The warning message for empty interwiki tables should use the message cache.
  • The i18n patch should be integrated into the file.
  • The "add" form for new interwiki prefixes needs to be de-uglified.
  • The "add successful" message should present the interwiki table again for further edits (having to go back in your browser is annoying and breaks your workflow).

-- Schneelocke 17:41, 10 October 2007 (UTC)

I agree with you, except the i18n file should stay separately from the main file, but it should be mentioned in the main file by default (so there aren't problems like mine above :p). SPQRobin 15:46, 12 October 2007 (UTC)
I now changed the file so that it uses the i18n file by default (no need to patch). --MF-Warburg 08:09, 13 October 2007 (UTC)
Oh, yes, I agree, the i18n stuff should stay in a separate file. -- Schneelocke 19:40, 13 October 2007 (UTC)
I have "de-uglified" the add and delete form. I hope everyone finds it good :-) SPQRobin 15:09, 14 November 2007 (UTC)

[edit] Bug?

I think I have found a bug:

  • First, I go to the form to add a new prefix, e.g. 'mw' for http://www.mediawiki.org/, and I click on "local"
  • Then I see in the log and in the recent changes: (Added "mw" (http://www.mediawiki.org/wiki/$1) (local: 0) (trans: 1) to the interwiki table)
  • I was thinking "Maybe I clicked on 'trans' instead of 'local'?" But no, when I go to Special:Interwiki, I see in the table "local: 1" and "trans: 0"

Strange... SPQRobin 14:09, 13 October 2007 (UTC)

We can just change the message
'interwiki_log_added' => 'Added "$1" ($2) (local: $3) (trans: $4) to the interwiki table: $5',
to
'interwiki_log_added' => 'Added "$1" ($2) (trans: $3) (local: $4) to the interwiki table: $5',
but I'm not sure this would be the right solution. SPQRobin 14:42, 13 October 2007 (UTC)
I looked to the source code and that is indeed the mistake. I've changed it. SPQRobin 18:17, 18 October 2007 (UTC)

[edit] Wrong Language

I installed this, it works, but I have to do some guessing work. Instead of English, is shows up as

Просмотр и изменение префиксов интервики

Nothing shows up as English. IS there a way to change it? 69.54.2.147 21:48, 18 October 2007 (UTC)

Never mind, It's been fixed. I replaced
$wgMessageCache->addMessages( $wgSpecialInterwikiMessages[$key], $key );}

with

$wgMessageCache->addMessages( $wgSpecialInterwikiMessages[en], $key );}

69.54.2.147 22:35, 18 October 2007 (UTC)

[edit] Couple of bugs?

The page wasn't showing up in Special:Specialpages, so I changed the line 46 from

SpecialPage::SpecialPage( 'Interwiki' );

to

SpecialPage::SpecialPage( 'Interwiki', 'interwiki' );

Was there any reason this wasn't done like this anyway?

Also, I was getting PHP errors about undefined variable out in lines 91 and 219. Obviously some paths through the function don't define this variable. To fix, I changed line 66:

if ($do == "delete") {

to

$out = '';
if ($do == "delete") {

193.36.230.96 09:44, 23 November 2007 (UTC)

Which version of MediaWiki do you use? I use the latest version and it works fine. SPQRobin 16:07, 23 November 2007 (UTC)
Mediawiki 1.11 (and php 5.2.4). Do you mean the Special page shows up fine, or you don't get php errors? The latter will definitely happen through certain paths ($do = delete, delete2 and add2). Just to be clear, even though the page didn't show in Special:Specialpages, I could still access it at Special:Interwiki ok. My LocalSettings.php contains the lines below and I'm in the sysop group. 193.36.230.96 23:58, 23 November 2007 (UTC)
$wgGroupPermissions['*']['interwiki'] = false;
$wgGroupPermissions['sysop']['interwiki'] = true;
Everything works fine on my testwiki. Do you use the latest version of SVN? SPQRobin 12:35, 24 November 2007 (UTC)

Yes, the latest version. To reproduce the undefined variable problem:

  1. Go to Special:Interwiki.
  2. Click delete on any entry (you don't need to confirm the deletion).
  3. View your webserver error log (apache 2.2.4 in my case) and there will be an entry saying something like

PHP Notice: Undefined variable: out in C:\\apache\\htdocs\\w\\extensions\\Interwiki\\SpecialInterwiki.php on line 91, referer: http://localhost/wiki/Special:Interwiki

If this doesn't produce an error, I guess your webserver must be different.

To reproduce the other problem:

  1. Using latest version of extension in SVN, on MW v1.11.
  2. Add the following lines to LocalSettings.php
require_once('extensions/Interwiki/SpecialInterwiki.php');
$wgGroupPermissions['*']['interwiki'] = false;
$wgGroupPermissions['sysop']['interwiki'] = true;
  1. Log in as a user with sysop (and beaurocrat) rights.
  2. Go to Special:Specialpages and there is no entry for Interwiki.

If this does work for you, I can only assume you have some different entries for your wgGroupPermissions and/or you are using a user account with different permissions

[edit] FIXED Undefined Variable ('out' on line 195)

FIXED version 2008-01-11

Notice: Undefined variable: out in /home/bzc/public_html/wiki/extensions/Interwiki/SpecialInterwiki.php on line 195

I get this eror at the top of the page and it makes the rest of the fonts on the page look bad too. (Side effect of any error message I think)

Hi. Can you please provide some more information? Which version of MediaWiki? Which version/date of the Interwiki extension? Greetings, SPQRobin 22:09, 8 January 2008 (UTC)
Oh yes. SpecialInterwiki (version 14-12-07) on MediaWiki (version 1.11.0 ). Do I have to turn globals on or something? Version Page
I have set up a wiki with version 1.11.0rc1 and SpecialInterwiki version 14-12-07 but I hadn't any error. Also, on line 195 there is nothing what could cause an error. Did you change anything in the file? SPQRobin 16:58, 10 January 2008 (UTC)
I have made no modifications. I just upload the extensions and throw em in LocalSettings.php. The only customization is the cloning of the standard theme for my CSS and template modifications. I occasionally get a radom error of similar nature from a youtube extension on pages it isn't even used on. As soon as I figure out how, I will turn globals on and see if it fixes it. Since it is a warning about an undefining variable, it may be that the variable WAS defined as global and because of my current settings cannot be accesed. I guess I should start signing... -76.116.57.5 21:23, 10 January 2008 (UTC)
Resolved in a recent commit. Siebrand 12:07, 11 January 2008 (UTC)
I'm sory, I'm new to this. "commit"? --76.116.57.5 07:27, 13 January 2008 (UTC)
If you are using MediaWiki 1.11 or later, please update your extension code from the download location that is noted on the extension page. Cheers! Siebrand 08:54, 13 January 2008 (UTC)
A "commit" is, in this case, an update to the code in the Wikimedia Foundation repository. On other projects, a commit refers to a change to the code in Subversion (SVN), which is the "official" copy, usually. All patches (changes) are generally made against the latest commit, or version, in SVN. But I go into too much detail... :D Tuvok[Talk/en.wp] 08:59, 13 January 2008 (UTC)
That's what I thought, but I must have downloaded it again before it was updated. I got it again, its working this time. I felt I should relabe the header for this part as FIXED and be more specific on the error for it to. Now I have to find out why some of my other mods have similar errors. Thanks again.--76.116.57.5 11:46, 13 January 2008 (UTC)

[edit] what does the local and trans checks mean on the special page?

what does the local and trans checks mean on the special page? --Emesee 09:27, 30 January 2008 (UTC)

'local' tells MediaWiki that it can redirect to that page if the link is included in either a #REDIRECT statement or is typed into the URL (compare Wikipedia's possibility to do things like http://en.wikipedia.org/wiki/fr:Accueil, which sends you to fr.wikipedia.org). 'trans' means you can transclude from that wiki if $wgEnableScaryTranscluding is enabled. For more info, take a look at Manual:Interwiki table. Tuvok[Talk/en.wp] 18:07, 30 January 2008 (UTC)

[edit] Version number please

It would be helpful if the developers of this extension assigned a version number to this extension. This could be in both the code (so it shows up in special:version) and the {{extension}} infobox on this extension page. This way at a glance we can know if our MediaWiki installations are up to to date. --Maxelrod 22:08, 25 February 2008 (UTC)

Code contains 'version' => '2008-01-11', Siebrand 00:03, 26 February 2008 (UTC)

[edit] How to "manipulate" the interwiki table ?

The description says : "Adds a special page to view and manipulate the interwiki table." I suppose I can change the table right from this special page, but can I do that ? There are no "modify" options or anything letting me work on it, is there ?

You have to be a user in the "sysop" (administrator) group to be able to "manipulate" (edit/modify) the interwiki table. SPQRobin 12:01, 24 July 2008 (UTC)
I am Sysop, and definitly have to "manipulate" this through PhpMyAdmin. The special page only let me see the changes...--NewMorning 12:19, 24 July 2008 (UTC)
Is your wiki on the internet so I could take a look at it? SPQRobin 12:30, 24 July 2008 (UTC)
You can see the same as I do as a sysop folowing this link (most pages locked) --NewMorning 12:49, 24 July 2008 (UTC)
Ah, I found the problem. You need to explicitly include the user right line in LocalSettings:
$wgGroupPermissions['sysop']['interwiki'] = true;
I thought it was by default. SPQRobin 13:12, 24 July 2008 (UTC)
YES, that was the point ! I might not be by default on a "secured" wiki... I'm fixed anyway, many thanks !

[edit] interlanguage links

I have no idea how the interlanguage links work and I was wondering if it is possible to have completely different sites appear in the language section of the side bar. ex if a page on my site is at 123wiki.com/foo is it possible to have a language link that goes to asdf.com/foo? Thanks for any help you can give me on this I'm really confused.

Personal tools