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
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."
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?"
64.134.221.150 (talkcontribs)

Please help. I set up an account but I am not able to log in as the password appears not to be working. I am not able to email a new password as it is stating there is no email address set up with my account.

What can I do?

Thank you,

Vanessa

Tropicalkitty (talkcontribs)

If the question is related to Wikimedia projects, see w:Help:Logging in#What if I forget the password.3F .

Reply to "Vanessa Karpio"
50.59.126.67 (talkcontribs)

I am running Mediawiki on Windows and the math section which has links for Linear Regression are coming up with parsing errors. I am not sure how to trouble shoot this. I understand that this is using php.

Malyacko (talkcontribs)

Which MediaWiki version? What exact "parsing errors"?

Reply to "Failed to parse Missing code"
Olds98 (talkcontribs)

Hello all. I am not a software programmer or a web designer.. I have a basic wiki running for my company and every time I try to set up an extension like PDFHandler or now Visual Editor and each time i follow the directions only to get errors. Clearly these setups are designed for people who do this stuff regularly. Now I am getting an error VisualEditorHooks::onBeforePageDisplay.... and SkinTemplateNavigation... and onResourceLoaderRegisterModules... and all refer to Hooks.php... is there someone i can pay to remote in and make this stuff work? Thank you

Ciencia Al Poder (talkcontribs)

If you're interested in professional consulting, look at Professional development and consulting.

Visual Editor is rather complex to setup, and latest version usually works only with latest MediaWiki version, which is probably the hook errors you're getting, because there are lots of hook changes to add new features for Visual Editor