Project:Support desk

About this board

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 "Start a new topic".

JS Library for MediaWiki

5
מיכי י-ם (talkcontribs)

I want to create a js library for using indexedDB Where do I upload the code and how? In addition, where are development guidelines?

Bawolff (talkcontribs)

Can you give more context? Who is this library for, what code would be using it?

מיכי י-ם (talkcontribs)

I didn't understand the question. I want to create a basic library for a variety of uses, it will be used on wikis to create local databases, store information in them and retrieve it.

Bawolff (talkcontribs)

MediaWiki is not a general place to store libraries. We generally expect code contributed to MediaWiki is going to be used by MediaWiki.

מיכי י-ם (talkcontribs)

Absolutely agree, I think it will be used by MediaWiki users like mw.storage.

Reply to "JS Library for MediaWiki"

Block Video Uploads for Non Admins - Extension Troubleshooting

2
Kimmywingz (talkcontribs)

Hello,

I am working on a custom extension that would only allow admin users to upload video files, the extension is enabled and appears under Special:Version. The permission also appears under the correct category under Special:ListGroupRights.

However, when I attempt to upload a video (mp4) under Special:Upload, it goes through.

I just enabled error reporting / showExceptionDetails / debugToolbar / ShowDebug / DevelopmentWarnings and added print statements to my extension file, but I am not seeing any indicators that it's trying to work but is failing.

I am hoping somebody could point me in the right direction on how to debug this more efficiently or offer insight into the problem. Thank you for your time and expertise.


In the PHP file:

namespace MediaWiki\Extension\VideoPermissions;

use MediaWiki\Hook\UploadVerifyUploadHook;

use User;

use UploadBase;

class PermissionCheck implements UploadVerifyUploadHook {

public function onUploadVerifyUpload (UploadBase $upload, User $user, ?array $props, $comment, $pageText, &$error) {

$file = $upload->getLocalFile();

if ($file->getMediaType() !== MEDIATYPE_VIDEO) {

return;

} else {

$title = $upload->getTitle();

if ($user->definitelyCan('videopermission-allow', $title)) {

} else {

$error = 'videopermission-no-perm-to-upload';

return false;

}}}


in the extension.json file:

"AvailableRights": ["videopermissions-allow"],

"GroupPermissions": {"sysop": {

"videopermissions-allow": true

}},

"Hooks": {"UploadVerifyUpload": "main"

},

"HookHandlers": {"main": {

"class": "\\MediaWiki\\Extension\\VideoPermissions\\PermissionCheck"

}},

Bawolff (talkcontribs)

So, first of all, print() (and echo) won't work in mediawiki due to output buffering. Always use var_dump() if you want to output something for debugging purposes to the page (or if you want to output to the debug log, use the debug logging system. You can use wfDebug() as a one off, or add a LoggerFactory as a dependency if you want to do it more properly for longer lived code). I personally tend to use var_dump() for one off debugging instead of debug log system, as i find it easier, but its a matter of personal preference.

One thing to note is that in workflows where a POST request is made, processing happens, and then the user is redirected to a different page, the debug messages will be associated with the redirect not the target. I believe that upload processing is one such example of this. In these cases wgDebugToolbar and var_dump wont work (a hack sometimes used is to follow var_dump() immediately by die() to stop processing). In such a case i reccomend setting $wgDebugLogFile to some file and then using wfDebug() for debugging. That way you wont miss the debug messages on redirects.


Based on your description it sounds like permissions are being setup correctly, but the hook is not firing. My suggestion would be to verify if that is true, by putting wfDebug("HERE"); as the first line of your onUploadVerifyUpload function and checking the debug log file to see if it is called at all. If it is being called then i would suggest recording the values of various conditions variables to ensure they match what you think they should be.

Another thing to check - i'm not sure at what point this hook is called. Determining media type is part of file verification. Possibly this hook happens before the file object knows the file is a video. If so, you might have better luck using the $props array passed to the hook. I believe it should also have media type information.

Reply to "Block Video Uploads for Non Admins - Extension Troubleshooting"
ItsGerryz (talkcontribs)

I should begin with saying im completely unfamiliar with coding in HTML or anything that has to do with MediaWiki.

I have managed to install MediaWiki on Localhost (Im using Apache2 on an old linux laptop i recently got, its a miracle that i even managed that!)

I want to be able to arrange a wiki page as i wish (for example, Wikimedia's home page has an interesting format! I want to make something parralel to that) and also i want to be able to put these boxes that are found both in the MediaWiki website and Wikipedia itself, that are blue with an 'i' icon, or red with an '!' icon. I think i have also seen yellow boxes with a coresponding triangular symbol. (just to illustrate my unfamiliarity, i dont even know how these 3 are called.)

Any help will be extremely appreciated!

Bawolff (talkcontribs)
Reply to "Help with formating"

Page not getting marked for translation

2
Dan Shick (WMDE) (talkcontribs)

Hi there,

We created a template for the new Wikibase main page. The latest revisions are two weeks old and have not been marked for translation -- perhaps because this is the revision set in which we removed the DoNotTranslate template. Would it be possible to get this page marked for translation?: Template:Wikibase main page

Thanks, and if we did something wrong in this process please let us know so we can avoid this situation in future.

Bawolff (talkcontribs)

Yes Done

For future reference, these types of requests should go to Project:Village pump not this page.

Reply to "Page not getting marked for translation"

$wgUsePathInfo A problem by any definition

4
77.127.126.137 (talkcontribs)

MediaWiki ver 1.41

I had this problem shown here:

Topic:Xmvyl460z5y8k72q

So as written there I set $wgUsePathInfo = false; and that solved it

But then we get this problem:

Topic:X7zabcz2fkhb68rs

And here they write that the solution to this is: $wgUsePathInfo=true;

What to do? Is there a way to solve this?

Osnard (talkcontribs)
77.127.126.137 (talkcontribs)

I don't have this word in the LocalSettings folder

I didn't have wgUsePathInfo either until this problem

Osnard (talkcontribs)
Reply to "$wgUsePathInfo A problem by any definition"

Adding a template to a Mediawiki installation.

2
PeterEasthope (talkcontribs)

Hi,

My ISP allows an instance of Mediawiki 1.41.1. A color template renders as "Template:color" in red. Similarly for the font color template. Meaning that the templates are not available; correct? How can that be fixed? Where can definitions of the color and font color templates be found? How can I add them to my Mediawiki instance? Thanks, ... PeterEasthope (talk) 16:10, 7 May 2024 (UTC)

Bawolff (talkcontribs)
Reply to "Adding a template to a Mediawiki installation."

remove personal identifiable information

4
Luciferindcok21 (talkcontribs)

How to remove personal identifiable information from a given user.Is there any extensions similar to Extension:RemovePII . How to get the RemovePII for mediawiki 1.39, the default download is compatible only with mediawiki 1.41.

  1. How to remove page history older than 2 months?@Osnard
Bawolff (talkcontribs)

See Suppression.


By default this feature isn't enabled but it is builtin, so you have to gove admins additional user rights

Luciferindcok21 (talkcontribs)

@Bawolff could you please explain how?

Osnard (talkcontribs)
  1. How to remove page history older than 2 months?

I don't think one can do that. But there is Manual:DeleteOldRevisions.php. Be very careful with this, as it will actually remove data. Make a backup before running anything like this.

Reply to "remove personal identifiable information"

I successfully uploaded files with 'hwp' and 'hwpx' extensions on MediaWiki, but they're not downloadable. What should I do?

5
Shb06202 (talkcontribs)

You've successfully uploaded files with 'hwp' and 'hwpx' extensions on MediaWiki, but they're not downloadable. What should you do?

Shb06202 (talkcontribs)

In the LocalSettings.php file, I added the following lines:

# File upload $wgStrictFileExtensions = false; $wgCheckFileExtensions = false; $wgVerifyMimeType = false; $wgFileExtensions[] = 'hwpx'; $wgFileExtensions[] = 'zip'; $wgProhibitedFileExtensions = array_diff($wgProhibitedFileExtensions, ['hwpx']); // $wgTrustedMediaFormats[] = 'ARCHIVE'; $wgTrustedMediaFormats[] = 'application/zip';


Despite adding these lines, only uploads are possible, and downloads are not working.

Ciencia Al Poder (talkcontribs)

What error do you get when downloading them?

Shb06202 (talkcontribs)

When attempting to download, instead of a download popup, a broken screen is displayed, and the download is not initiated.

Ciencia Al Poder (talkcontribs)

Unless you're using an extension that stores files in AWS, Swift or other custom location, files are stored directly on disk. And if you haven't configured MediaWiki to serve files through img_auth.php, clicking on any file would point to an URL that directly maps a file on the server. This means MediaWiki doesn't do anything to serve the file to you, it's your webserver's matter.

Maybe you must configure your webserver to download those files, if for some reason it refuses to serve a file with an unknown extension. Or maybe an intermediate proxy, a firewall or antivirus is blocking the file from being downloaded. Or even your browser may be blocking it.

You'll have to check the URL of the file it tries to download, ensure the file exists on the web server, and check webserver logs for any error or warning. Then try different servers or tools to download that URL.

Reply to "I successfully uploaded files with 'hwp' and 'hwpx' extensions on MediaWiki, but they're not downloadable. What should I do?"
Freedomfighterz (talkcontribs)

Hello,

Not sure if this is the right place to ask but i want to ask something.

When blocking people on my own wiki i noticed they cant use the usertalk page. Is there any way i can make it so they can use that function to use on an admin usertalk for something like appealing a ban?

Any help would be appreciated, thanks.

P858snake (talkcontribs)
Reply to "Blocks"
2001:1C03:5F0F:1800:F6AE:FA91:87A3:8FA9 (talkcontribs)

My account is gone I can't log in and I pait for the membership

TheDJ (talkcontribs)

We dont have memberships. You are likely in the wrong place, this is the support desk for the free Mediawiki software package.

Reply to "Hello"