Project:Support desk

Jump to: navigation, search

About this board

Edit description
vde   Welcome to MediaWiki.org's Support desk, where you can ask MediaWiki questions!

There are also other places where to askCommunication: IRCCommunication#Chat, mailing listsMailing lists, Q&A etc.

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".
By clicking "Add topic", you agree to our Terms of Use and agree to irrevocably release your text under the CC BY-SA 3.0 License and GFDL
Murbaut (talkcontribs)

Can someone help me to write java script blocking manual link to my pt-personal or pt-cactions Such as this can you fixed this

mw.util.addPortletLink(
    'p-personal',
    mw.util.getUrl("/wiki/Special:Block/"   encodedTarget),
    'Block',
    'pt-blocklink',
    'Menu Block',
    null,
    '#pt-watchlist'
)
Reply to "Write Javascript Block Manual"

[RESOLVED] Trouble uploading after installation

24
173.85.173.42 (talkcontribs)

After installing to the latest version of mediawiki, I am unable to upload text files, and get the following messege: Could not open lock file for "mwstore://local-backend/local-public/d/dc"

How can I fix this?

173.85.173.42 (talkcontribs)

I fixed it. chmod 777 images directory.

86.184.214.101 (talkcontribs)

Hi,

I've got the same problem but it is not fixed by chmod 777 images.

Ive just upgraded to 1.19 and

  1. I cannot upload image files - getting the message Could not create directory "mwstore://local-backend/local-public/archive/d/d8".
    • I have made the mediawiki/images directory and all sub-directories writeable
    • I had added $wgFileExtensions = {'gif', 'png'); to LocalSettings.php
    • I have tried incuding $wgUploadPath = '/mediawiki/images'; to LocalSetting.php
  2. Current images files stored in the wiki
    1. are displayed correctly using [[Image:pic.gif]],
    2. but not if resized e.g. [[Image:pic.gif|640px]]

Amy suggestions appreciated

Kirby

86.184.214.101 (talkcontribs)
70.81.74.132 (talkcontribs)

le dossier mediawiki et tout son contenu devrait apartenir au même usager que celui utilisé par le service Apache... Dans mon cas, www-data... Alors j'ai fait "chown -R www-data: mediawiki" pour régler mon problème.

70.81.74.132 (talkcontribs)

... En passant, je ne pense pas que ce soit une bonne idée de tout le mettre en 777, ça peut causer une brèche de sécurité.

DHR (talkcontribs)

My french is rusty, but I think that I agree with you.

Setting 777 permissions is really a bad idea.

On my system, I had this problem too. I got here by googling the error message.

I fixed the problem by setting the image directory's owner to apache. And since nothing but a readme was in that directory, I didn't even need a recursive chown.

 chown apache. /var/www/mediawiki119/images

That was the path on my CentOS 6.3 system.

I wonder if there is an even less crude solution.

There is. Read Manual:Configuring file uploads

77.119.255.167 (talkcontribs)

In my case (ubuntu server 12.04) it was

me@someplace:/var/www/w$ sudo chown -R www-data images/

142.110.189.223 (talkcontribs)

sudo chown -R www-data:www-data images/

(also make sure permissions are proper)

sudo chmod -R 755 images/

174.137.113.68 (talkcontribs)

Setting www-data as the owner fixed this issue for me! (Ubuntu server 12.04) Thanks!

TiloWiki (talkcontribs)

copy that ran on Ubuntu 12.04.2 with MW 1.20:

sudo chown -R www-data /var/www/MyWikiName/images
MetalHellsAngel (talkcontribs)

In my case I had a virtual server with a public_html directory in my home folder so I added my user to the www-data group


sudo useradd -G www-data my-username

logged out and back in to have the new group permission take effect and then I did.

sudo chown -R /home/my-username/public_html www-data

and that fixed the problem for me.

71.184.94.103 (talkcontribs)

This worked for me also on Debian 6 AMD64

86.2.83.34 (talkcontribs)

Yup. Works on Raspbian too, so this should work for x86, x64 and ARM servers.

DHR (talkcontribs)

I should have been clearer: read https://www.mediawiki.org/wiki/Manual:Configuring_file_uploads#Check_directory_security

That talks about chowning to www-data:www-data.

On my system (CentOS 6.5) it should be apache:apache.

Note that a chgrp isn't necessary since chown incorporates that functionality. An old-fashioned notation for chown used . instead of : to separate the owner from the group.

2001:480:10:160:0:0:0:3121 (talkcontribs)

check your "$wgFileExtensions = {'gif', 'png');" entry

you need to create an array, something like this:

$wgFileExtensions = array('gif','png');

89.103.184.112 (talkcontribs)

For me chmoding uploads, uploads/*, uploads/*/* uploads/*/*/* to 777 helped (but please check with someone mor wiki-security aware that this doesn't imply any threats). For you it may be images, images/*, ... as it seems our wiki has some special settings.

Bawolff (talkcontribs)

Making things 777 means any user can write to the directory, which means if anyone somehow gets access to your server (aka security vulnrability in something else), or if there are other users of your server, they can write stuff to the images directory. A better approach is to make the images folder either owned by the apache user, or in the apache's user's group, and only let the apache user have said permissions.

AceroChevalosta (talkcontribs)

Mi sukcesis per

# chown apache -R /path/to/your/wiki/
# chgrp apache -R /path/to/your/wiki/
Ogredeschnique~mediawikiwiki (talkcontribs)

I just solved this issue on Fedora by installing mod_fcgid.

I hope this helps someone. :-)

This post was posted by Ogredeschnique~mediawikiwiki, but signed as Ogredeschnique.

Carlc888 (talkcontribs)

made the change [$sudo chmod 777 /etc/mediawiki/images] on Ubuntu 12.04, Mediawiki version 1.22.1

Boom problem gone

80.119.70.60 (talkcontribs)

Just an update after a few minutes trying to fix that problem on my Mac : I would had this step to solve the access problem :

- add a $wgTmpDirectory = "/Applications/XAMPP/xamppfiles/htdocs/your_wiki/images/temp"; OR whatever path you want... and do the chmod on this specific folder

[$sudo chmod 777 /Applications/XAMPP/xamppfiles/htdocs/your_wiki/images/temp]

Only then you know what the fu** the wiki is doing! ;)

Have fun.

5.115.21.230 (talkcontribs)

I have the same problem on windows and I have installed wiki under IIS .

Reply to "[RESOLVED] Trouble uploading after installation"

"badcachekey" error from API after 1.27 > 1.28 update

2
217.149.135.43 (talkcontribs)

Hi, after successfully using Mediawiki 1.27 with VisualEditor for a while; we wanted to upgrade to the newest version because the editor starting to show some weird problems.

So I did an upgrade to Mediawiki 1.28, VisualEditor-REL1_28-93528b7 and Parsoid 0.6.1.

Now an error message occurs when saving a page which says "Unknown error". However the page does get saved. If you look at the 3 POST requests (to api.php) made by the save actions 1 fails (the 2nd one). It returns an error object with code "badcachekey" and info "No cached serialization found with that key".

If anyone can help us by explaining why this error occurs and/or what we can do to fix it, it will be greatly appreciated! We're kind of at a loss since downgrading doesn't seems to be possible?

Versions: MediaWiki 1.28.0 PHP 7.0.8 (apache2handler) MySQL 5.7.13 ICU 52.1

207.250.18.198 (talkcontribs)

I can confirm this issue. Currently running WAMP Server 2.5 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b) with Mediawiki 1.28.

Reply to ""badcachekey" error from API after 1.27 > 1.28 update"
DerekPeaceTech (talkcontribs)

Hi there,

I'm using Semantic MediaWiki with the MediaWiki Language Extension Bundle to create a multilingual tools library for peacebuilders. Unfortunately, this has resulted in strange Category pages where each language of a tool is listed. (eg, "Apollo", "Apollo/ar", "Apollo/en", etc.) I'd like to have just one version of the tool listed but can't seem to figure out how to make it happen.

I have tried to modify the individual tool pages, but the Translate Extension doesn't allow me to modify translated pages through anything but the translation interface. I can't remove the "'[[Category:Tool]]" tag from individual tool pages because it is embedded within a template. Is it possible to modify the category pages so that they filter any page with a "/" in their name or duplicates of the same page?

Thanks,

Derek

Product Version
MediaWiki 1.26.2
PHP 5.6.21 (fpm-fcgi)
MySQL 5.6.30
ICU 52.1
Reply to "Filtering Entries in Categories"

Template which expands to 4 columns (Conditional Table)

4
Summary by AhmadF.Cheema

Newlines can cause weird behaviours.

Blumenfuchs (talkcontribs)

Hey,

I`ve got problems building a template, which should be a table that expands up to 4 columns.

That´s the template-code:

<onlyinclude>{| class="wikitable"

|- {{#if: {{{Skills 1-4|}}} |

{{!}} Skills: {{!!}}

{{{Skills 1-4}}} {{!!}} {{{Skills 5-8}}} {{!!}} {{{Skills 9-12}}}

}}

|- |}

Including it into a page, it would look like that:

{{NameofmyTemplate

|Skills 1-4= |Skills 5-8= |Skills 9-12=

}}

But the {{!!}} after {{{Skills 1-4}}} and {{{Skills 5-8}}} don´t work, I just get displayed pipes, but actually I wanted that the Skills 5-8 and will be shown in additional columns. I only get displayed the column "Skills" and a second column where the contents of Skills 1-4, Skills 5-8 and Skills 9-12 are displayed. The skills should be listed with bullet points, so I typed them in like

*1. Skill

*2. Skill

Could anybody tell me how I get more columns, but only if there´s content in Skills 5-8 or 9-12?

AhmadF.Cheema (talkcontribs)

Apparently, the newline after the line {{!}} Skills: {{!!}} in your code is causing problems. Try the following:

{| class="wikitable"
|-
{{#if: {{{Skills 1-4|}}} |
{{!}} Skills: {{!!}} {{{Skills 1-4|}}} {{#if: {{{Skills 5-8|}}} | {{!!}} {{{Skills 5-8|}}} |}} {{#if: {{{Skills 9-12|}}} | {{!!}} {{{Skills 9-12|}}} |}}
|}}
|}

Don't know yet how to get the bullet points included in the table, though.

Update: For bullet points you can use the following::

{| class="wikitable"
|-
{{#if: {{{Skills 1-4|}}} |
{{!}} Skills: {{!!}} <li>{{{Skills 1-4|}}}</li> {{#if: {{{Skills 5-8|}}} | {{!!}} <li>{{{Skills 5-8|}}}</li> |}} {{#if: {{{Skills 9-12|}}} | {{!!}} <li>{{{Skills 9-12|}}}</li> |}}
|}}
|}

A practically exact copy of the above, but with better template page representation:

{| class="wikitable"
|-
{{#if: {{{Skills 1-4|<noinclude>a</noinclude>}}} |
{{!}} Skills: {{!!}} <li>{{{Skills 1-4|<noinclude>Skill alpha</noinclude>}}}</li> {{#if: {{{Skills 5-8|<noinclude>b</noinclude>}}} | {{!!}} <li>{{{Skills 5-8|<noinclude>Skill beta</noinclude>}}}</li> |}} {{#if: {{{Skills 9-12|<noinclude>c</noinclude>}}} | {{!!}} <li>{{{Skills 9-12|<noinclude>Skill gamma</noinclude>}}}</li> |}}
|}}
|}
This comment was hidden by Neil P. Quinn (history)
Blumenfuchs (talkcontribs)

Thank you so much :)

Bulk Delete Files From Wiki

4
Summary by Arnab vani

deleteBatch.php not only allows deleting pages in bulk but also all sorts of files uploaded to the wiki.

Arnab vani (talkcontribs)

Hey there guys,

MW 1.27.2

I noticed there are few extensions to bulk upload files to Mediawiki installation.

Currently, I have been trying to do the opposite. And I'd like to be able to bulk delete files with specific file extensions.

For example, in my case, I want to mass delete all files with extension .mp3 which I had uploaded in our Mediawiki (once upon a time) in the past. There are over a few thousand .mp3 files which I have to delete and since I used $wgHashedUploadDirectory, these files are spread across various sub-directories on the server.

So my question is...

Is there a MediaWiki maintenance script or a specific Mediawiki plugin which allows to batch delete files that have been uploaded to a wiki? (I searched a lot but couldn't find a single one... which is why I'm asking you guys here)

Also, If there is no such plugin or script to automate this task, what would be the manual way to delete all the files cleanly from both the database and the webserver?

~ Arnab

Arnab vani (talkcontribs)

Hey guys... Any ideas or advice on how to deal with this?

~ arnab

Ciencia Al Poder (talkcontribs)

You can use deleteBatch.php

Arnab vani (talkcontribs)

Okay, awesome this worked like charm. Thanks @Ciencia Al Poderfor taking the time to help me out here.

Getting message: Warning: [page-name] is calling Template:[template-name] with more than one value for the "" parameter. Only the last value provided will be used.

1
Wf49670 (talkcontribs)

Since upgrading from 1.23.15 to 1.27.1 our wiki pages that use one of our templates are getting the above message when we preview an edit. Example: Warning: DP Official Documentation:General/wf-test-language is calling Template:Languages with more than one value for the "" parameter. Only the last value provided will be used.

MediaWiki level: 1.27.1 PHP: 5.5.9-1ubuntu4.21 (apache2handler) Database: MySQL 5.5.55-0ubuntu0.14.04.1

URL of wiki page that has this error: https://www.pgdp.org/wiki/DP_Official_Documentation:General/wf-test-language

The call to the Languages template looks like this:

{{Languages|Languages:|=
|en|{{NAMESPACE}}:General/Code of Conduct|=
|fr|{{NAMESPACE}}:General/French/Code de la Conduite|=
|es|{{NAMESPACE}}:General/Spanish/Código de Conducta|=
|de|{{NAMESPACE}}:General/German/Verhaltenskodex|=
}}  

It uses a layout style suggested in https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Template#Template_tag_lay-out ending each line with |= to make the coding more legible to the page editor.

Since migrating to 1.27.1 that style results in the message shown above. To avoid the message we have to delete all the |= characters and collapse the template call onto one long line of wiki code. That makes it harder to maintain, so we would like to be able to use the formerly supported approach.

Reply to "Getting message: Warning: [page-name] is calling Template:[template-name] with more than one value for the "" parameter. Only the last value provided will be used."

How to integrate statistic into wiki

3
Chan15tw (talkcontribs)

Is there any popular statistic extension or software can easily intergate to mediawiki?

AhmadF.Cheema (talkcontribs)

Category:Statistics extensions

Haven't come around to using any personally though.

2003:72:6D15:D600:A56C:97DA:BF2A:84A9 (talkcontribs)

I am using Piwik and I have just used one of the hooks to get the default Piwik code put into my pages.

Reply to "How to integrate statistic into wiki"

Я не могу разместить статью о компании на Вики

6
Таня Коренева (talkcontribs)

Доброго дня!

Уже несколько раз размещала статью о компании "Омские кабельные сети" в В.

Но она удаляется с ошибкой  "Вы не можете создать эту страницу: это название было защищено от создания.

Что это значит? Помогите, пожалуйста, разобраться.

Fokebox (talkcontribs)

Это где Вы статью пытались создать? В Википедии чтоль?

Таня Коренева (talkcontribs)

да, в ней самой

Fokebox (talkcontribs)

Стало быть статья не соответсвует критериям и требованиям Википедии

AKlapper (WMF) (talkcontribs)

Hi Tanja, if this is about Russian Wikipedia, see https://ru.wikipedia.org/wiki/Омские_кабельные_сети for reasons why the article has been removed in the past. In general, this is something to bring up in the Russian community as their rules apply, for example on https://ru.wikipedia.org/wiki/Википедия:Форум.

This comment was hidden by AhmadF.Cheema (history)
Reply to "Я не могу разместить статью о компании на Вики"

Where do I put Google AdSense code in Vector.php for a banner ad at the top?

15
Lieutenant S. Reznov (talkcontribs)

Here's an excerpt of the code:

		// Output HTML Page
		$this->html( 'headelement' );
?>
		<div id="mw-page-base" class="noprint"></div>
		<div id="mw-head-base" class="noprint"></div>
		<!-- content -->
		<div id="content" class="mw-body" role="main">
			<a id="top"></a>
			<div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
			<?php if ( $this->data['sitenotice'] ): ?>
<!-- Google AdSense -->
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxxxxxxx";
/* Banner Ad */
google_ad_slot = "xxxxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- /Google AdSense -->
			<!-- sitenotice -->
			<div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
			<!-- /sitenotice -->
			<?php endif; ?>
			<!-- firstHeading -->
			<h1 id="firstHeading" class="firstHeading" lang="<?php
				$this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getCode();
				$this->html( 'pageLanguage' );
			?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1>
			<!-- /firstHeading -->
			<!-- bodyContent -->
			<div id="bodyContent">

http://community.wikihub.ssu.lt/WikiHub

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

88.130.120.37 (talkcontribs)

Yes, if it's working... :-/

Lieutenant S. Reznov (talkcontribs)

It doesn't seem to be displaying.

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

88.130.109.50 (talkcontribs)

Why?

IAlex (talkcontribs)

It's inside the if ( $this->data['sitenotice'] ): block. If you want it to show even where there are no site notices, you need to move it outside of that block.

Lieutenant S. Reznov (talkcontribs)

Thanks. Yeah, I just realized that when it seemed to only display when there was content on the sitenotice page. I fixed it.

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

Krinkle (talkcontribs)

Don't hack core files (Vector.php in this case).

There's many routes to take that don't involve hacking core, here's two that should work fine for you:

These hooks would be created in your LocalSettings.php file.

Lieutenant S. Reznov (talkcontribs)

I used this:

public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxx";
/* Banner Ad */
google_ad_slot = "xxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
}

$wgHooks['BeforePageDisplay'][] = 'OutputPage::addInlineScript';

Could you please show me how I should set it up?

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

88.130.64.43 (talkcontribs)

What should the code, which you posted, do? Where did you put these lines? There should be functions in LocalSettings.php, but the code you posted is JavaScript, or - as a PHP programmer would say: A syntax error. And how should things work together? Your hook definition does not call the function, which you have defined. Looks all very strange...

Basically this should work - in LocalSettings.php to be sure:

$wgHooks['BeforePageDisplay'][] = 'addGoogleAdSense';

function addGoogleAdSense( OutputPage &$out, Skin &$skin ) {
  $adSenseCode = 'foo bar'; // add the content of the script tag (not also the script tag itself!) of your JavaScript here.
  
  $out->addInlineScript( $adSenseCode );
  
  // Do the same again, if you still need another script...
  // After you did it wrong, think about it yourself and fix it.
  
  return TRUE; // ohh yeah!
}

That should give you an idea of how to really use hooks.

Lieutenant S. Reznov (talkcontribs)

Thanks. I had no idea what to do before. I'll try this.

EDIT

I just used this, but it didn't work. If I didn't give enough information before, it's being used with Vector and I'd like it to display like the banner here.

$wgHooks['BeforePageDisplay'][] = 'addGoogleAdSense';

function addGoogleAdSense( OutputPage &$out, Skin &$skin ) {
  $adSenseCode = '
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxxxxx";
/* Banner Ad */
google_ad_slot = "xxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
';

$out->addInlineScript( $adSenseCode );

  return TRUE;
}

EDIT

I saw that I put in too much. I'm not supposed to include the tag.

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

Lieutenant S. Reznov (talkcontribs)

I just tried this but it's still not working.

EDIT

Should I do each part of the code separately?

$wgHooks['BeforePageDisplay'][] = 'addGoogleAdSense';

function addGoogleAdSense( OutputPage &$out, Skin &$skin ) {
  $adSenseCode = '
google_ad_client = "ca-pub-xxxxxxxxxxxxx";
/* Banner Ad */
google_ad_slot = "xxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
';

$out->addInlineScript( $adSenseCode );

  return TRUE;
}

{{LQT post imported with different signature user|authorUser=Lieutenant S. Reznov|signatureUser=Inquisitor Ehrenstein}}
Lieutenant S. Reznov (talkcontribs)

I just figured this out using addHTML() as addInlineScript() doesn't work because the whole second part of the script is inside the script tag, which isn't supposed to be included, so there's then nothing to include.

The problem is that it appears at the bottom of the page, when it should appear at the top.

Adds at the end of an article are useful, but this isn't what I need. For one reason, I need to included a hosted by WikiHub and report abuse link.

EDIT

By using prependHTML() I was able to get it to appear at the top, but it's below the title rather than above it, which would be preferable.

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

Krinkle (talkcontribs)

I have to conclude from above attempts that you seem to have little to no understanding of HTML or PHP. Obvious syntax conflicts with adding raw HTML inside a PHP function body, passing HTML as a string where javascript code is expected, and now passing in half of an HTML script tag (src="..." >) inside of javascript.

I could give the entire answer, but I wouldn't feel comfortable leaving that in your hands to further maintain in the future. It also seems moot as you wouldn't have learned anything and wouldn't know what to do with it further.

If someone asked you to do this, I'd recommend going back and telling them to ask someone else do this, because that's what it would be if I gave the full answer to you now. The internet would be the indefinite proxy for whatever it is you are supposed to do.

If this for an adventure of your own making, I'd recommend you make a choice. Either drop it, or take it on all the way and start by taking a step back and first learning HTML and PHP.

You're welcome.

Lieutenant S. Reznov (talkcontribs)

I have HTML fairly well and a basic understanding of PHP. I was basically just trying things quickly without taking the time to understand them before. I see the problem with the partial tag and the src there.

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

Lieutenant S. Reznov (talkcontribs)

I'll modify this one Extension:Google AdSense 2 to use an ad banner.

This post was posted by Lieutenant S. Reznov, but signed as Inquisitor Ehrenstein.

Reply to "Where do I put Google AdSense code in Vector.php for a banner ad at the top?"