Project:Support desk

About this board

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

(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 versions you are using, as found on your wiki's Special:Version page:
    • MediaWiki version
    • PHP version
    • Database type and version
  2. 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.
  3. To start a new thread, click "Start a new topic".

how to transclude automatically the translated page

1
Wladek92 (talkcontribs)

If I want to transclude a translated subpage I can write:

{{Special:MyLanguage/User:Wladek92/save/doc}} 

to transclude Special:MyLanguage/User:Wladek92/save/doc/fr for example but I only get the link to this page as => Special:MyLanguage/User:Wladek92/save/doc .

How can I make the transclusion effective ?

Christian 🇫🇷 FR (talk) 08:37, 25 September 2022 (UTC)

Reply to "how to transclude automatically the translated page"

Getting the page tools and personal tools for a skin

3
ArrakisMiner (talkcontribs)

I'm trying to create a skin in PHP for my wiki, and I'm having issues with getting the page tools (edit, view, history etc) and the user tools (login, watch, talk, contribs etc) to display properly. I've taken a look at some of the skins around, and it seems that the best way, and recommended way, to do this is via this snipped:

$personalTools = $this->getPersonalTools();
foreach ( $personalTools as $key => $item ) {
echo $this->makeListItem( $key, $item );
}

And for the namespace tools:

$pageNav = $this->data['content_navigation'];
foreach ( $pageNav['namespaces'] as $key => $tab ) {
echo $this->makeListItem( $key, $tab );
}

This is causing me issues, however, and both variants of the code, for either the page tools or the user tools, display in the top left of the screen and at the top of the skin code (when viewed in Inspect Element) irregardless of where they're placed in the code — how do I get them to respect the div they're placed into and not go to the top left of the page?

TheDJ (talkcontribs)

echo outputs wherever the output position currently is. Perhaps you need to concatenate to a previously generated string variable ? It really depends. Its issues like these which are why we are switching to a mustache template based architecture for skins btw.

ArrakisMiner (talkcontribs)

Hmm, maybe, I'm following the code here and here respectively, so I'm not entirely sure what I'm doing differently?

Reply to "Getting the page tools and personal tools for a skin"

"Passwords must be at least 10 characters" even though I have an 8 character password policy

10
Vicarage (talkcontribs)

Mediawiki 1.35.0, LocalSettings.php has

$wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = 8;

But when I try to change my (administrator account) password, I get the red text 'Passwords must be at least 10 characters', and it won't accept the 8 character password I want

Ammarpad (talkcontribs)

That is the 'default' only as the name suggests. Any more specific policy will override it. You're being asked for 10 because that's the requirement for users in 'sysop' group. You must to change it there too: $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = 8;. If you're in interface-admin or bureaucrat groups you must also change it for each group.

Vicarage (talkcontribs)

That occurred to me, though its hardly obvious, as a default I specify should override something set inside code so I added the lines to correspond to Special:ActiveUsers

$wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = 8; $wgPasswordPolicy['policies']['administrator']['MinimalPasswordLength'] = 8; $wgPasswordPolicy['policies']['interface administrator']['MinimalPasswordLength'] = 8; $wgPasswordPolicy['policies']['bureaucrat']['MinimalPasswordLength'] = 8;

And nothing changed. I even added sysop, in case that was some daft hidden group

Only by editing includes/DefaultSettings.php and changing all the 10s to 8s did I manage to beat it into submission. Grrrr

Bawolff (talkcontribs)

$wgPasswordPolicy['policies'] = [ 'default' => ['MinimalPasswordLength' => 8]];

Alternatively, you can put var_dump( $wgPasswordPolicy); die(); at the very end of LocalSettings.php to figure out the final value and see if its what you expect.

Ammarpad (talkcontribs)

There's no group 'administrator', so that line would not do any anything. The canonical name of the group is 'sysop'. You're not supposed to edit DefaultSettings.php. You better copy the relevant lines to LocalSettings.php

Vicarage (talkcontribs)

Basic information

Username:John: Member of groups:Administrators, Autoconfirmed users, Bureaucrats, Interface administrators, Users

No sign of sysop here

$wgPasswordPolicy['policies'] = [ 'default' => ['MinimalPasswordLength' => 12];

makes my system lock up. I will stick with editing includes/DefaultSettings.php and moaning

TheDJ (talkcontribs)

"No sign of sysop here"

Sysop is the technical name of the administrators group in the software. The 'human' name value of it is "Administrator". This fact is arguably so well hidden in the interface these days, that it is hard to know if you don't know about the old name. A place where you can still see it is in the url of list users: Special:ListUsers/sysop

$wgPasswordPolicy['policies'] = [ 'default' => ['MinimalPasswordLength' => 12];

[] need to be balanced. you are missing a ] at the end there.

Vicarage (talkcontribs)
158.174.93.211 (talkcontribs)

Maybe you solved this by now but if someone else struggle with this like I did today, here's what worked for me (added to LocalSettings.php):

## Change MinimalPasswordLength

$wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = 8;

$wgPasswordPolicy['policies']['sysop']['MinimalPasswordLength'] = 8;

$wgPasswordPolicy['policies']['interface-admin']['MinimalPasswordLength'] = 8;

$wgPasswordPolicy['policies']['bureaucrat']['MinimalPasswordLength'] = 8;

KHFischbach (talkcontribs)

Hi,

I yesterday installed a local copy of mediawiki and have the same problem as @Vicarage. I have set the the dump as recommended by @Bawolff. Result is:

array(2) {  ["policies"]=>  array(5) {    ["bureaucrat"]=>    array(2) {      ["MinimalPasswordLength"]=>      int(6)      ["MinimumPasswordLengthToLogin"]=>      int(1)    }    ["sysop"]=>    array(2) {      ["MinimalPasswordLength"]=>      int(6)      ["MinimumPasswordLengthToLogin"]=>      int(1)    }    ["interface-admin"]=>    array(2) {      ["MinimalPasswordLength"]=>      int(10)      ["MinimumPasswordLengthToLogin"]=>      int(1)    }    ["bot"]=>    array(2) {      ["MinimalPasswordLength"]=>      int(10)      ["MinimumPasswordLengthToLogin"]=>      int(1)    }    ["default"]=>    array(5) {      ["MinimalPasswordLength"]=>      int(6)      ["PasswordCannotBeSubstringInUsername"]=>      array(2) {        ["value"]=>        bool(true)        ["suggestChangeOnLogin"]=>        bool(true)      }      ["PasswordCannotMatchDefaults"]=>      array(2) {        ["value"]=>        bool(true)        ["suggestChangeOnLogin"]=>        bool(true)      }      ["MaximalPasswordLength"]=>      array(2) {        ["value"]=>        int(4096)        ["suggestChangeOnLogin"]=>        bool(true)      }      ["PasswordNotInCommonList"]=>      array(2) {        ["value"]=>        bool(true)        ["suggestChangeOnLogin"]=>        bool(true)      }    }  }  ["checks"]=>  array(6) {    ["MinimalPasswordLength"]=>    string(48) "PasswordPolicyChecks::checkMinimalPasswordLength"    ["MinimumPasswordLengthToLogin"]=>    string(55) "PasswordPolicyChecks::checkMinimumPasswordLengthToLogin"    ["PasswordCannotBeSubstringInUsername"]=>    string(62) "PasswordPolicyChecks::checkPasswordCannotBeSubstringInUsername"    ["PasswordCannotMatchDefaults"]=>    string(54) "PasswordPolicyChecks::checkPasswordCannotMatchDefaults"    ["MaximalPasswordLength"]=>    string(48) "PasswordPolicyChecks::checkMaximalPasswordLength"    ["PasswordNotInCommonList"]=>    string(50) "PasswordPolicyChecks::checkPasswordNotInCommonList"  } }

From my perspective it shows the param is set and accepted.

But still, when trying to change the password for a user (the only user created as admin during setup), i get the message the minimum password length is 10.

$wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = 6;

$wgPasswordPolicy['policies']['bureaucrat']['MinimalPasswordLength'] = 6;

$wgPasswordPolicy['policies']['sysop']['MinimalPasswordLength'] = 6;

Any idea why this happens?

Regards

Kallewirsch


Upate:

when writing the reply I reconcnized the user created during setup might be of role "interface-admin" (makes sense). I added this to the params and now it works for the user where I tested it.

Reply to ""Passwords must be at least 10 characters" even though I have an 8 character password policy"

Excess paragraphs (<p>) on pages

9
Mukilol (talkcontribs)

Hey! I have had issues with excess paragraphs on my wiki for months. Initially I tried to solve it with CSS but was unable to do so due to how random the content structure can be and thought about asking for help here instead.

We have a template called {{skill}} on our wiki which returns a hoverable image and text inside a div which is set to display: inline-block. Whenever this template is called, any text before and after it gets wrapped in paragraph tags which results in a minimum of 3 rows when it should be 1. This was not always the case and was probably introduced with an upgrade but I can't say for sure.

As a hacky workaround for this we are currently placing all content in lists where the {{skill}} template is used, this prevents the excess paragraphs and makes everything inline.

Has anyone experienced anything like this or knows what could be causing it?

AhmadF.Cheema (talkcontribs)

The {{skill}} template, does it have extra newlines in its beginning or end?

Mukilol (talkcontribs)

The includeonly within that template has no newlines, the noinclude has a few though.

AhmadF.Cheema (talkcontribs)

Are there any between the includeonly and noinclude tags?

Note that even starting the noinclude tags on the next line might cause the template to render with extra newlines. It's better to type the opening noinclude tag on the same line, directly after the previous closing includeonly tag.

<includeonly>
Foo
</includeonly>
<noinclude>
Bar
</noinclude>
Mukilol (talkcontribs)

They are at the same line right now, there are no spaces/newlines at the start, end or between. Would it help if I post a link to the template here? Not sure if it's allowed.

Ciencia Al Poder (talkcontribs)

Yes, please, a link would help

Mukilol (talkcontribs)

I managed to fix the problem which was that the content inside {{skill}} was within a div and MediaWiki decided that everything before and after that should be in separate paragraphs. I changed from div to span and it worked. I initially had display:inline-block on the div but that didn't make any difference.

Ciencia Al Poder (talkcontribs)

This usually happens when you have several div on separate lines:

<div>something</div>
<div>something</div>
<div>something</div>

And can be solved by removing the line break between div:

<div>something</div><div>something</div><div>something</div>

or:

<div>something</div><!--
--><div>something</div><!--
--><div>something</div>
77.10.98.82 (talkcontribs)

Had the exact same issue, replacing div with span worked, thanks!

And the template did not have a single line break in it, it's just a single line, so that is most definitely not the issue, mediawiki for some reason just seems to wrap everything before and after a div in paragraphs.

Reply to "Excess paragraphs (<p>) on pages"

Eliminating Wiki Markup from Search Results

3
65.122.93.130 (talkcontribs)

Is there any solution to removing Wiki markup from Search results?

76.102.130.155 (talkcontribs)

If you understand how hooks work (and thus were able to define this hook that's really not documented), that might work.

For mere mortals who understand a little php, edit includes/search/SqlSearchResult.php, define the function strip_tags_content (as found in the comments for strip-tag), and then use it on mText:

$clean = $this->strip_tags_content($this->mText);

 if ( $wgAdvancedSearchHighlighting ) {

  return $h->highlightText( $clean, $this->terms );

 } else {

  return $h->highlightSimple( $clean, $this->terms );

 }

This ensures that you're stripping out the HTML before the highlighting is applied (or else that would get stripped out too!). It looks like getTextSnippet is only/mostly used for search results, so hopefully the impact is limited there.

Maybe someone will add mortal-level doc on how to use that Hook, though it's been 9 years since this question was asked, so...

Reply to "Eliminating Wiki Markup from Search Results"

MediaWiki runtime error:: No such service: HookContainer

2
Ewaszkow (talkcontribs)

I have installed the very latest mediawiki 1.38.2 and I am running PHP version 8.0.13 under RedHat Linux 9. When I try to run MediaWiki on any brower AND when I try to run php update.php in the /maintenence directory, I get the following error.


PHP Fatal error:  Uncaught Wikimedia\Services\NoSuchServiceException: No such service: HookContainer in /export/mediawiki-1.38.2/vendor/wikimedia/services/src/ServiceContainer.php:468

Stack trace:

#0 /export/mediawiki-1.38.2/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService()

#1 /export/mediawiki-1.38.2/includes/MediaWikiServices.php(294): Wikimedia\Services\ServiceContainer->getService()

#2 /export/mediawiki-1.38.2/includes/MediaWikiServices.php(1024): MediaWiki\MediaWikiServices->getService()

#3 /export/mediawiki-1.38.2/includes/MediaWikiServices.php(282): MediaWiki\MediaWikiServices->getHookContainer()

#4 /export/mediawiki-1.38.2/includes/exception/MWExceptionHandler.php(130): MediaWiki\MediaWikiServices::getInstance()

#5 /export/mediawiki-1.38.2/includes/exception/MWExceptionHandler.php(201): MWExceptionHandler::rollbackPrimaryChangesAndLog()

#6 /export/mediawiki-1.38.2/includes/exception/MWExceptionHandler.php(170): MWExceptionHandler::handleException()

#7 [internal function]: MWExceptionHandler::handleUncaughtException()

#8 {main}

  thrown in /export/mediawiki-1.38.2/vendor/wikimedia/services/src/ServiceContainer.php on line 468


PLEASE HELP.

Bawolff (talkcontribs)
Reply to "MediaWiki runtime error:: No such service: HookContainer"

MySQL binlog files filling up rapidly (sometimes)

2
2003:C2:3F12:5F00:4991:A98C:6259:6575 (talkcontribs)

Ubuntu 20.04, Apache 2.4, PHP 7.4.3, MySQL 8.0 & MediaWiki 1.35.7


Howdy,

usually the binlogs match (roughly) with the activities shown in the recent changes page. Sometimes within the last days I encountered a mysterious phenomenon; the binlog grows rapidly while there is only few activity in the wiki for some hours.


Example:

-rw-r-----  1 mysql mysql    3697808 Sep 22 01:25 mysql-bin.001100

-rw-r-----  1 mysql mysql  157288660 Sep 22 18:53 mysql-bin.001101

-rw-r-----  1 mysql mysql  157372133 Sep 22 20:50 mysql-bin.001102

-rw-r-----  1 mysql mysql  157311099 Sep 22 21:25 mysql-bin.001103

-rw-r-----  1 mysql mysql  157388609 Sep 22 21:50 mysql-bin.001104

-rw-r-----  1 mysql mysql  157291160 Sep 22 22:07 mysql-bin.001105

-rw-r-----  1 mysql mysql  157367584 Sep 22 22:34 mysql-bin.001106

-rw-r-----  1 mysql mysql  157343097 Sep 22 22:42 mysql-bin.001107

-rw-r-----  1 mysql mysql  157383979 Sep 22 22:50 mysql-bin.001108

-rw-r-----  1 mysql mysql  157354101 Sep 22 22:57 mysql-bin.001109

-rw-r-----  1 mysql mysql  157420107 Sep 22 23:17 mysql-bin.001110

-rw-r-----  1 mysql mysql  157487073 Sep 22 23:37 mysql-bin.001111

-rw-r-----  1 mysql mysql  157536460 Sep 22 23:55 mysql-bin.001112

-rw-r-----  1 mysql mysql  130376490 Sep 23 00:13 mysql-bin.001113

-rw-r-----  1 mysql mysql  157559320 Sep 23 00:35 mysql-bin.001114

-rw-r-----  1 mysql mysql  157322415 Sep 23 01:02 mysql-bin.001115

-rw-r-----  1 mysql mysql   72729153 Sep 23 01:25 mysql-bin.001116


On September 22th, from 0:01 am till 20:50 pm, I count approx. 130 changes. I don't quite understand why this few changes can produce 2 x 150 MB binlogs, but even worse: from 20:50 pm - 23:55 pm there are no more than 31 edits <-> 10 x 150 MB binlogs!?


Does anyone have any ideas WHAT the database is doing here?

Bawolff (talkcontribs)

I would suggest looking in the binlogs and seeing which tables are being modified.

Reply to "MySQL binlog files filling up rapidly (sometimes)"
BHPphil (talkcontribs)

I'm trying to download a table I've created in our wiki. It's not huge -- I could re-type the 20 or so rows, or paste cell contents, but I'd like to capture the current table, and take it offline. Is there a way other than print it and scrape it?

Version details:

Product Version
MediaWiki 1.35.7
PHP 7.4.30 (fpm-fcgi)
MariaDB 10.3.34-MariaDB-0+deb10u1-log
Jonathan3 (talkcontribs)

Do you mean you want the HTML version of a wikitext table?

BHPphil (talkcontribs)

That would be fine. We want to give it to something like Excel or Google Sheets, turn it into a spreadsheet.

Jonathan3 (talkcontribs)
Reply to "download a page?"

Make Mediawiki work on older browsers?

9
JulianMalcolm08 (talkcontribs)

Hi,

I noticed that Mediawiki cut off support for many legacy browsers. Is there any way with an extension or something to make the site basic html only when on an old browser.


Cheers!

Bawolff (talkcontribs)

Mediawiki should work fine out of the box on legacy browsers. JS stuff wont work, and any browser specific hacks wont be there (so css might be messed up on really old browsers) but things like editing pages should work fine. When we say we've cut support we generally mean just JS.

what issues are you experiencing and in what browser?


If you want the old timey look, check out Skin:nostalgia

JulianMalcolm08 (talkcontribs)

The page just wont load at all.

JulianMalcolm08 (talkcontribs)

I am not worried about the distortion but when the page does not load it is a problem.

TheDJ (talkcontribs)

Well which specific browser and version are we talking about ?

Malyacko (talkcontribs)

@JulianMalcolm08 If something somehow doesn't work somewhere, then please provide clear and exact info what somehow, somewhere, and something are (and why you think so), without leaving room for interpretation. Jumping to incorrect conclusions ("MediaWiki doesn't work on older browsers") without any hints or proof doesn't help. Thanks.

JulianMalcolm08 (talkcontribs)

Sorry. I was testing it on internet explorer 6. I know it is old but it is helpful for my tests. I was running it on Windows XP if that matters.

TheDJ (talkcontribs)

That’s very old. For en.wp (Wmf services) that’s probably because the HTTPS support on that platform is no longer up to par. If you are running your own server and explicitly made it insecure to load on old platforms and it is still a problem, then possibly something with CSS or HTML5 isn’t compatible. However, by virtue of the platform not being supported, you are pretty much on your own trying to figure out what that issue would be.

JulianMalcolm08 (talkcontribs)

Ok thanks.

Google Login Extension Not Working.

1
JulianMalcolm08 (talkcontribs)

Hi,


I am trying to add the ability to login to my wiki with google and I did all of the chrome developer stuff and ran the update scripts and the page nedefenses.com does not work still.

Cheers!