Project:Support desk

Jump to navigation Jump to search

About this board

Welcome to's Support desk, where you can ask MediaWiki questions!

There are also other places where to ask :

Before you post

Post a new question

  1. To help us answer your questions, please always indicate which versions you are using (reported by your wiki's Special:Version page):
    • MediaWiki
    • PHP
    • Database
  2. Please include the URL of your wiki unless you absolutely can't. It's often a lot easier for us to identify the source of the problem if we can look for ourselves.
  3. To start a new thread, click "Start a new topic".
Previous page history was archived for backup purposes at Project:Support_desk/old on 2015-07-30.

How to update articles after extension changes?

3 (talkcontribs)

Hi, everybody. I have template changes to the Embedvideo extension, but the changes were not applied in my articles. Only after updating manually in the admin panel.

I found this solution

Manual:Purge#Examples, but this is for one article. Does the cli interface has this solution?

Majavah (talkcontribs)
Bawolff (talkcontribs)

generally making any edit to LocalSettings.php will force all pages to be reparsed on next view.

Reply to "How to update articles after extension changes?"

Mediawiki is not clearing Varnish cache

Lucasbasquerotto (talkcontribs)

Hi, I'm setting up Mediawiki with Varnish and the pages are being correctly cached by Varnish, but when I edit a Mediawiki page, the cache is not purged, so the outdated page still shows to users. I even removed the acl to make varnish accept calls from any source.

In Mediawiki settings, I defined both the host (name of the docker container) as well as the docker IP, but it didn't worked.

I've added to the settings:

$wgUseCdn = true;

$wgCdnServers = [];

$wgCdnServers[] = "";

(the docker container had the above IP at that time)

I enabled Mediawiki logs and see the error:

[squid] CdnCacheUpdate::purge: https://localhost:8443/index.php/Test_Page https://localhost:8443/index.php?title=Test_Page&action=history

[DeferredUpdates] Deferred update CdnCacheUpdate failed: Call to undefined function socket_create()

I have found no solution for undefined socket_create() in Mediawiki.

Installed software

Product Version
MediaWiki 1.34.1
PHP 7.3.18 (apache2handler)
MariaDB 10.5.3-MariaDB-1:10.5.3+maria~bionic-log
ICU 63.1

I'm using varnish 6.4.0 (vcl 4.0). I'm using the docker image mediawiki:1.34.1

I don't know how to proceed and haven't found a solution.


If I try to enable sockets (docker-php-ext-enable sockets) it shows that it's already enabled: warning: sockets ( is already loaded!, but from the error it seems as if it's not enabled tough.

Lucasbasquerotto (talkcontribs)

I've installed and enabled the sockets extension (docker-php-ext-install sockets and docker-php-ext-enable sockets) and restarted the docker container, and it works now.

I think it's important to document that the sockets extension needs to be enabled at Manual:Varnish caching and update $wgUseSquid and similar variables to $wgUseCdn and the other new variables.

Reply to "Mediawiki is not clearing Varnish cache"

Flagging an article for removal

2601:805:C182:C90:24EC:31CA:51EA:118F (talkcontribs)
Malyacko (talkcontribs)

Welcome to the support desk for the MediaWiki software. For random content on random websites, please contact those websites - we have nothing to do with

Reply to "Flagging an article for removal" (talkcontribs)

When editing an article, MediaWiki seems to add a line break at the end of the existing text. It seems like it gets stripped on save, but it can be annoying for our use. Is there a way to prevent from this line break from being added when editing an article?

Reply to "Remove Line Break" (talkcontribs)

Hello mediawiki

Kindly assist me with login

Majavah (talkcontribs)

Please be more specific with your question.

Reply to "login problem"
Minteck (talkcontribs)

Hello, I have setup a MediaWiki installation for a private wiki, and now I'd like to create my own website, but make it only available to people who are logged in to my MediaWiki installation.

I didn't found any straight-forward and simple API to validate a token (maybe the mediawiki_session cookie, or another one?) that my server could call to check if the token is valid.

The website I'll create and my MediaWiki instance are on the same domain. I found ?action=checktoken but when I try api.php?action=checktoken&type=login&token=<token> with the mediawiki_session it says it's invalid.

Here's a summary on how I want it to be:

  • The server should make the request, not the client
  • Validate the token easily
  • I know how to do the rest


Bawolff (talkcontribs)

checktoken is for csrf tokens only. You should not use that for access control.

The hacky way to do this is to take all the user's cookies, make a server side request with the user's cookies to api.php?action=query&meta=userinfo and see what user is returned.

For the non hacky way of doing this - im not sure i understand what you are trying to accomplish. I assume you are not doing some sort of single-sign-on since you are using mediawiki's authorization (if you are doing some sort of single-sign-on see AuthManager). At the same time you don't want to use MediaWiki's builtin access control to only allow logged in users? I could probably better advise if i understood why you are trying to do this.

Nonetheless, if you didnt trust mediawiki's access control, and want to use some sort of interstitial access portal instead, probably the most proper approach would be to use a custom SessionManager and have all authorization be in your thing instead of just the access control. See AuthManager

Minteck (talkcontribs)

Thanks, it's working!

Here's my code if some are interested:


// We grab all the cookies
$cookies = "";
$keys = array_keys($_COOKIE);
$index = 0;
foreach ($_COOKIE as $cookie) {
    $cookies = $cookies . $keys[$index] . "=" . $cookie . ";";

// Make the request to the MediaWiki API
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://{$_SERVER['HTTP_HOST']}/api.php?action=query&meta=userinfo&format=json");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIE, $cookies);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($curl);

// Process the data
$data = json_decode($result);
header("Content-Type: application/json");

if (json_last_error() !== JSON_ERROR_NONE) {

if (isset($data->batchcomplete) && $data->batchcomplete == "") {
} else {

And it's surprisingly fast! I can even improve the speed using localhost instead of the domain name used by the client.

Bawolff (talkcontribs)

note: this is insecure if using client host header since it can be anything (see SSRF attack). In certain circumstances it may be possible to turn SSRF into code execution.

You may also want to urlencode the value of the cookies.

Batchcomplete is the wrong key to look for as it is present regardless of if the session is valid.

Minteck (talkcontribs)

What I want to do is just, using client's cookies, make the server check if a MediaWiki session is valid. I'll tell you what api.php?action=query&meta=userinfo gives me.

Reply to "Token validation API"

How to show specific article on Main Page?

Smilewhj (talkcontribs)

I want to show one part of specific article (actually, most recently revised article) on main page, how can I do this?

Malyacko (talkcontribs)
Reply to "How to show specific article on Main Page?"

Media Viewer doesn't work on a page with a template?

Keren - WMIL (talkcontribs)

I have a project page with two tabs that are separate pages. Why does Media Viewer open the photos (as I want it) on the separate pages (e,g, this one), but not on the project page?

Reply to "Media Viewer doesn't work on a page with a template?"

No login possible after Rename AdminUser

2003:F9:F71B:5078:41C3:8A2C:67B6:3B55 (talkcontribs)

I renamed the AdminUser of my Wiki with Special:RenameUser and know i can't login anymore. It does not say that the inserts were wrong, and acts like a normal login, but in the end i'm on the mainpage not logged in.

I'm not into coding so i just completely reinstalled the wiki, but the problem still exists, even with a new AdminUserName.

Thanks for any help.

Bawolff (talkcontribs)

does clearing all cookies help?

2003:F9:F707:7F03:FC13:DE40:8D1:AA4A (talkcontribs)

unfortunately not

Hazard-SJ (talkcontribs)

Have you also tried using another browser?

Reply to "No login possible after Rename AdminUser"

Best practices for updating LocalSettings.php for a live MediaWiki

Nnaka1 (talkcontribs)

I am currently developing on my own instance of MediaWiki, which means making changes to the LocalSettings.php.

I have found that in order for my changes to the LocalSettings.php to be picked up, I need to "bounce" / restart my php fpm. This seems quite heavy handed and not the best practice because if I were to have other PHP processes running, they would be impacted. May I know what the best way to do runtime LocalSettings.php updates to an instance of MediaWiki?

Bawolff (talkcontribs)

normally you dont need to do anything for changes to be picked up. Whatever you are experiencing might be some sort of php config issue.

Check also you dont have your php on an NFS (or SMB, etc) file system as network filesystems can sometimes mess this up.

Hazard-SJ (talkcontribs)

Also look into whether you have any PHP caching in place.

Reply to "Best practices for updating LocalSettings.php for a live MediaWiki"