Jump to content

Project:Support desk

Add topic
From mediawiki.org
(Redirected from Talk:MediaWiki)
Latest comment: 2 hours ago by Speravir in topic Gadget for auto numeration and Vector-2022
Welcome to the MediaWiki Support desk. This is a place where you can ask any questions you have about installing, using or administrating the MediaWiki software.

(Read this message in a different language)

See also

Before you post

Post a new question

  1. To help us answer your questions, please indicate which version of MediaWiki you are using, as found on your wiki's Special:Version page:
  2. If possible, add $wgShowExceptionDetails = true;error_reporting( -1 );ini_set( 'display_errors', 1 ); to LocalSettings.php in order to make MediaWiki show more detailed error messages.
  3. Please include the web address (URL) to your wiki if possible. It's often easier for us to identify the source of the problem if we can see the error directly.
  4. To start a new thread, click the box with the text "Add topic".

Embedding a Google Form into my Miraheze wiki page

[edit]

Need permissions to embed HTML on your wiki page. I tried to embed HTML code generated for my GOOGLE Form. But it's not working. Please help. Jeetudas (talk) 19:03, 3 April 2025 (UTC)Reply

You could try Extension:Widgets. Jonathan3 (talk) 20:24, 3 April 2025 (UTC)Reply
Afraid not. Widgets has been disabled on MH since late December 2020 over security concerns. The only way out is through highly intricate custom JS on your own domain, which not everyone (this wiki-veteran included!) has prolonged experience or confidence with. --Slgrandson (talk) 01:41, 18 April 2025 (UTC)Reply
Thanks. I'd not heard about that, but am currently using the Widgets extension on my own wiki. I've asked for further details on the extension talk page: https://www.mediawiki.org/wiki/Extension_talk:Widgets#Extension_update_since_Miraheze_%222020-12-23_Security_Disclosure%22? Jonathan3 (talk) 20:17, 24 April 2025 (UTC)Reply
@Jeetudas For security reasons only specific bits of HTML are allowed to be used in wiki pages, see Help:HTML in wikitext. You would need to ask the Miraheze system administrators for help, though I suspect they will not allow this for security reasons. Could you not just provide a link to the form? 86.23.109.101 12:55, 4 April 2025 (UTC)Reply

Safe to clear mw_objectcache?

[edit]

I am encountering the known bug with sessions data loss when setting $wgMainCacheType to CACHE_ACCEL. I added $wgSessionCacheType = CACHE_DB; to store the session data in the database to go around this issue. Now I am wondering if I should clear the table mw_objectcache to remove old cache which should now be handled by APCu. I don't really mind to log out all users with this move, but I could also just delete all non-session files. Is this safe to do? Or is it maybe unnecessary 'cause it'll clear itself over time? I had $wgMainCacheType set to CACHE_NONE for years until now. DonnyPro (talk) 12:00, 11 April 2025 (UTC)Reply

Yes, from my experience the object cache can be cleared at any time. But it should not be necessary. Osnard (talk) 14:48, 25 April 2025 (UTC)Reply

[RESOLVED] Sortable tables no longer working?

[edit]

In my wiki, sortable tables have stopped sorting---clicking on the arrows in the header does nothing. They certainly worked in the past, and I have no idea when exactly this happened. Sortable tables work fine in wikipedia and in this wiki. Looking for some ideas on what's wrong.

My wiki: https://horawiki.org/

Example failing page: https://horawiki.org/page/Original_Music (but AFAIK sortable tables fail everywhere)

MediaWiki version: 1.42.3

Browsers tested: Brave, Safari

Larrydberg (talk) 20:47, 14 April 2025 (UTC)Reply

There are some errors there (e.g. typing F12 on Chrome). The second URL gives details of this error: Error: Class "ResourceLoaderModule" not found. https://horawiki.org/load.php?lang=en-gb&modules=startup&only=scripts&raw=1&skin=vector. I don't know the answer though. Maybe it would be worth checking your skin is up to date, or downloading the MediaWiki core files again? Jonathan3 (talk) 00:27, 15 April 2025 (UTC)Reply
Many thanks, Jonathan3. From the backtrace I found that ResourceLoaderModule, which was deprecated in 1.39 and completely removed in 1.42, was still being used in the (old) version of UniversalLanguageSelector that I had. Updating that extension fixed everything. (Tracing the connection between ULS and sortable tables is more than I care to handle, but no doubt it's just order of loading, with ULS aborting before something important gets its turn.) Thanks again. (Now: Not sure what to do about a resolved issue, so I'm just fixing the title.)
Larrydberg (talk) 17:03, 15 April 2025 (UTC)Reply

Syntax when protecting pages for a non-standard length of time

[edit]

I'm a bureaucrat at Wikispecies and an administrator at Swedish Wikivoyage and Wikimedia Sweden (WMSE). When protecting a page on any of those wikis I'm faced with the option to protect it for a fixed period of time (one week, one month, "infinitely" etc.), but there's also an option to chose "Other time" by entering code into a text box. However, I can't seem to find any information about how this command should be formatted, nor anything about the preferred date format and such. I've looked in Help:Protected pages and similar MediaWiki help pages, but struck no luck. (Most Meta-Wiki pages on the subject simply soft-redirects to MediaWiki). Even though protecting pages is (and should be) a fairly rare event, any help would be much appreciated. –Best regards, Tommy Kronkvist (talk), 19:19, 16 April 2025 (UTC).Reply

[edit]

On my Miraheze wiki, the Minerva.js settings currently contain this code:

mw.util.addPortletLink('p-navigation', '/wiki/Special:WhatLinksHere/' + mw.config.get( 'wgPageName' ), 'What links here', 'nav-wlh');

However, it should be quickly noted that "What links here" is invalid for pages in the Special namespace themselves; to that end, I'd like to know exactly what wraparound to use for cancelling it out if special pages are visited. Once I receive a tip (from @Bawolff or otherwise), the same procedure will apply for overviews of related changes.

Still, with Good Friday and Easter weekend close at hand, this might take a little while. --Slgrandson (talk) 01:56, 18 April 2025 (UTC)Reply

@Slgrandson I havent tested, but generally an ISO timestamp will likely work yyyy-mm-dd hh:mm:ss —TheDJ (Not WMF) (talkcontribs) 08:16, 21 April 2025 (UTC)Reply
@TheDJ: If so, which part of the calls is the timestamp appended to? --Slgrandson (talk) 20:58, 21 April 2025 (UTC)Reply

Fediverse Creator meta tag

[edit]

Wiki: https://joinfediverse.wiki Version: 1.41.0

Hi, Mastodon has a feature where you can make sure your profile is linked to with every link to your homepage on the Fediverse. You can see an example here: https://fedi.at/@FediverseFoundation/114065155360271846 On the bottom of the link preview it says "Mehr von Fediverse Foundation" which links back to the same profile that posted the post in that case. I'd like to do that with my wiki's Fediverse profile.

Mastodon's simple instruction is to put the following html code on the website (either in every article or somehow globally):

<meta name="fediverse:creator" content="@[email protected]">

Where can I put that in my wiki so it will work with every article on the wiki? Do I need an extension for it? PKFP (talk) 18:19, 19 April 2025 (UTC)Reply

@PKFP You can write a hook in your localsettings.php that hooks into something like Manual:Hooks/BeforePageDisplay adding a setMeta to every single pageview. —TheDJ (Not WMF) (talkcontribs) 08:12, 21 April 2025 (UTC)Reply
Hey, thanks for your tip. Could you explain this a bit further? I forwarded it to the tech person for the wiki, but he didn't get it yet. PKFP (talk) 06:26, 24 April 2025 (UTC)Reply
@PKFP Something like this in LocalSettings.php might work, using the BeforePageDisplay hook, $wgHooks & OutputPage::addMeta():
$wgHooks["BeforePageDisplay"][] = function($out, $skin) {
    $out->addMeta("fediverse:creator", "@[email protected]");
};
(disclaimer: this code comes with no warranty, etc.!)
Best, ‍—‍a smart kitten[meow] 20:28, 25 April 2025 (UTC)Reply
Maybe this would be a suitable addition to Extension:WikiSEO? It might be worth raising a feature request for that (it used to support twitter:creator). Sam Wilson 09:16, 21 April 2025 (UTC)Reply
Thanks, I'll try. PKFP (talk) 06:26, 24 April 2025 (UTC)Reply

How do I change the article content's background color by assigned category?

[edit]

I tried to use Ciencia Al Poder's Snippets/Style pages based on categories, and modified it to work with the article's content background but it didn't work.

I tried something like this:

/** * Adds CSS classes to the body tag based on the categories this page belongs to * * @source * @revision 2016-01-18 */ (function($, mw) { var fn = function() { var cats = mw.config.get('wgCategories'), newClasses; if (cats) { newClasses = $.map(cats, function(el) { return 'cat-' + encodeURIComponent(el.replace(/[ .]/g, '_')).replace(/%/g, '_'); }).join(' '); $(document.body).addClass(newClasses); } }; if (document.body) { fn(); } else { $(fn); } })(jQuery, mw); WongIsNotOK (talk) 17:26, 21 April 2025 (UTC)Reply

Quickstart

[edit]

I just became an interface administrator of Tagalog Wiktionary. The only admin before me has been very inactive in the site for around a decade now. I'm now lost. I want to begin with UI changes but the MediaWiki FAQ says I should have SSH access or something but how do I have those? How do I run automation bots as well? And how do I know the mediawiki version of the site? Can I upgrade it? Ysrael214 (talk) 11:09, 23 April 2025 (UTC)Reply

SSH access is mainly a means to upgrade the MediaWiki software when it's running on a remote server. Fortunately you don't need any of that because the WMF takes care of upgrades for you. To check the version of MediaWiki you're working with you take a look in Special:Version. For bots, see Manual:Bots. Being an interface admin, I presume you also want to take a look at Manual:CSS and probably to the CSS code used by other chapters of Wiktionary. Tactica (talk) 00:02, 24 April 2025 (UTC)Reply

Diff API for comapring 2 texts (not existing pages)?

[edit]

I'm writing a userscript for editing a page. I let users compose text before saving. So I want to compare 2 text (multi-row) strings with the MW's internal diff logic as it is better than other open source libraries.

How can I pass two text strings to the Diff API? All I found is API:Compare which requires existing pages. Subfader (talk) 13:31, 24 April 2025 (UTC)Reply

@Subfader There is indeed no arbitrary string comparison service inside MediaWiki. —TheDJ (Not WMF) (talkcontribs) 07:51, 25 April 2025 (UTC)Reply

Discussion at Extension_talk:CategoryTree#Suppressing_"no_subcategories"

[edit]

 You are invited to join the discussion at Extension_talk:CategoryTree#Suppressing_"no_subcategories". Sdkbtalk 18:45, 24 April 2025 (UTC)Reply

DNS Blacklist issues

[edit]

Hello. I have been using DNS Blacklist URLs on my wiki to combat spam, and I also have the ConfirmAccount extension installed and enabled on my wiki family. However, I still get account requests from spambots.

Here is the code that I added to my Localsettings.php file:

$wgEnableDnsBlacklist = true; $wgDnsBlacklistUrls = array( 'xbl.spamhaus.org.', 'zen.spamhaus.org.', 'dnsbl.tornevall.org.', 'spam.dnsbl.sorbs.net.', 'rbl.dnsbl.im.', 'noptr.spamrats.com.', 'all.s5h.net.', 'z.mailspike.net.' );

Is there something wrong with the DNS blacklist configuration? Does this feature only affect editing from the blacklisted IPs? If there is something wrong, then how do I fix it? Thank you for reading. Newman2 (talk) 20:48, 24 April 2025 (UTC)Reply

@Newman2 All relevant information is collected here Manual:Combating spam. In general, whenever you run a server (of any type) on the internet these modern days, you should be prepared for a barrage of never stopping spam and abuse. I looked at the DnsBlacklistUrl documentation page, and it was a bit sparse, so I perused the source code to figure out how it is supposed to work and added that here Manual:$wgEnableDnsBlacklist. —TheDJ (Not WMF) (talkcontribs) 07:48, 25 April 2025 (UTC)Reply
Isn't this setting supposed to be a boolean? I suspect you edited the wrong article. Tactica (talk) 00:08, 26 April 2025 (UTC)Reply

Gadget for auto numeration and Vector-2022

[edit]

Hello, the auto numeration activated with MediaWiki:Gadget-autonum.css and MediaWiki:Gadget-autonum.js (I load them in my global.js) does not work well together with Vector-2022 skin, because the counter reset does not work, and so all lower sections are just counted up. Note, that in vector-2022 only the else tree of the script is active and the code of the CSS is used. If you think, why I do not just ask the author Krinkle – well he wrote almost a year ago “I do not use the autonum gadget myself. For now, I have exceed the time I'm willing to spend on this gadget. I suggest gathering support and awareness of other people in the community, to hopefully find someone who is able and willing to maintain this JS/CSS snippet for further modifications.” (Krinkle’s user talk page on meta, cf. meta:Special:Diff/26715423 or the full conversation at m:Special:PermaLink/26721127#Section autonumeration with Parsoid). As an example: Manual:FAQ (itself not ready for vector-2022, at least the toc part I looked for) has 12 sections, and the latest one has 6 subsections which is fine displayed in (legacy) Vector from 2010, but with Vector 2022 I see the count 12.107. — Speravir (talk) – 00:35, 25 April 2025 (UTC)Reply

Hello sir, I saw your problem. From my investigation, Vector-2022 relies on the CSS-based numbering (the else branch in autonum.js, using autonum.css) when no table of contents (TOC) is present, as per the gadget’s design. The CSS (https://en.wikipedia.org/wiki/MediaWiki:Gadget-autonum.css) uses counter-reset properties, but these seem incompatible with Vector-2022’s DOM structure or styling, possibly due to changes in how headings are rendered (e.g., .mw-headingclasses, per Vector-2022 documentation).
I’m aware that Krinkle, the gadget’s author, noted in 2024 that they no longer maintain this gadget and suggested community collaboration for further fixes (see meta:Special:PermaLink/26721127#Section_autonumeration_with_Parsoid). I’m hoping to gather insights or assistance from others familiar with Vector-2022’s CSS/JS or gadget maintenance. Has anyone encountered similar issues with autonum or other CSS-based numbering gadgets in Vector-2022? Are there known workarounds, such as adjusting the counter-reset selectors to match Vector-2022’s heading structure, or modifying the JS to handle TOC-less pages differently? ProfessorNikolaus (talk) 18:53, 25 April 2025 (UTC)Reply
Your reply reminded me that I had myself written to Krinkle about the issue for pages without toc. I just did not consider now that the new skin has the same section structure in DOM. But because I ask for a change of a page gadget I seem to be wrong in the support desk. I'll ask at the Village Pump, instead, see VP: Gadget for auto numeration and Vector-2022. — Speravir (talk) – 00:16, 29 April 2025 (UTC)Reply

Importing pages from old wiki into newest wiki 8.3.0

[edit]

I want to manually insert all my pages from an old wiki project into a new wiki website (using mediawiki 8.3.0). The database in my new wiki shows pages are stored in "ew7o_page". In my old wiki this was calles "page" What is the best way to export from old wiki and import (insert) in newest wiki ? Same for "pagelinks" : need to be inserted in "ew7o_pagelinks" . When I try this now it's creating a new row in my SQL with the name "page". The "ew7o_page" reamains unchanged.

Stevy7 (talk) 10:14, 27 April 2025 (UTC)Reply

Error messages in SkyWiki wikis

[edit]

Hi, I've reported several error messages on SkyWiki wikis, including phabricator.skywiki.org. I've tracked them as issues in Wikimedia Phabricator (see links to issues at the right of this message), but these issues were all rejected as invalid. How can I contact SkyWiki founder in order to have those bugs fixed? --Agusbou2015 (talk) 18:26, 27 April 2025 (UTC)Reply

Extensions and skins not working (most of the time)

[edit]

Hi everyone, I am new here, so i might not get everything at first or botch some specialistic MW wording.

Getting to the problem - I appear to have a problem with LESS variables. Many skins are affected, like Vector, Minerva and Timeless, possibly many more (currently only one "working" is Chameleon). The symptoms are: broken CSS, buttons not working, extensions not working (happens in Chameleon too). There are images present, so I don't think that the solution from here applies, but I tried it either way and it does not make a change.

With broken LESS variables comes more problems - when I try to enable extensions like WikiEditor or VisualEditor I get 50kB of console errors with Less_Exception_Compiler saying that @variable_name is not defined (which clearly is defined in mediawiki.skins.defaults.less). It also frequently happens with @cdx_variable_name which i deduce is some codex variable which is not defined in mediawiki.skins.defaults.less, but i don't know how to handle this. It's a shame, but it can be worked around by writing in pure wikicode. Yet, there are problems still (which I didn't find the cause for), thumbnails and frames are not rendering correctly. The image is here, there is a caption, but there is no frame, image is not snapping to the right (if set to |right|), text isn't wrapping around it.

I am wandering if this is something on my hosting server side or with my installation, but I don't really know... I'll get you through installation steps i went through:

  1. download and unpack mediawiki, push it to my host ftp, import php.ini file and make /tmp
  2. run the installation following the tutorial
  3. wiki breaks and sends me a giant list of errors with Less_Exception_Compiler
  4. I download and install Chameleon via Composer (site isn't that broken now)
  5. I download a REL1_43 extension and put it in /extensions/, set (eg) wfLoadExtension( 'VisualEditor' );
  6. I try to edit a page using VE, but nothing is showing, console is red full with errors

So yeah, not much here to be honest... Right now I have almost every important extension disables, because it breaks my site. What can be the cause? What am i doing wrong?

I tried installing the 1.43.0 version, but it gives me the same results.

Nazwa Wersja
MediaWiki 1.43.1
PHP 8.4.0 (uwsgi)
ICU 69.1
MySQL 8.0.33-25
Pygments 2.17.2
Lua 5.1.5

Thanks for help in advance! Astroksiezyc wiki (talk) 01:45, 28 April 2025 (UTC)Reply

(for anyone looking at this, there are some stacktrace screenshots at phab:T392761) ‍—‍a smart kitten[meow] 09:50, 28 April 2025 (UTC)Reply