Project:Support desk

Jump to: navigation, search

About this board

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

Create new page by Perl via MediaWiki::API

5
JanTappenbeck (talkcontribs)

I want to create simple pages in a company-wiki by Perl. In reposetory i found the modul MediaWiki::API - but not a simple example to create a page.

can someone help to me ?

MarkAHershberger (talkcontribs)

This is really a question for the maintainer of the CPAN module (Jools Wills), but there is an example in the documentation that may help. Note I have not tested this.

use MediaWiki::API;

my $mw = MediaWiki::API->new();
$mw->{config}->{api_url} = 'YOUR-API-URL';

# log in to the wiki
$mw->login( { lgname => 'username', lgpassword => 'password' } )
    || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};

my $pagename = "Project:Sandbox";
my $ref = $mw->get_page( { title => $pagename } );
$mw->edit( {
      action => 'edit',
      title => $pagename,
      text => "Additional text"
} ) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};

If you try that, does it work? If not, what problems do you run into?

JanTappenbeck (talkcontribs)

thanks and first i try to login - but get following message:

2: Failed to decode JSON returned by http://ma22-wiki-001/eblwiki/api.php
Decoding Error:
malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "\x{feff}{"login":{"r...") at C:/strawberry/perl/site/lib/MediaWiki/API.pm line 400.

in other websites the reason will be declare by wrong api.php-url - but when i call the url in browser i get the dokumentation-side like http://www.exotica.org.uk/mediawiki/api.php but with xml source at the beginning and and like:

<?xml version="1.0"?>
<api>
  <error code="help" info="" xml:space="preserve">
i use 1.23.5 of mediawiki.
Ciencia Al Poder (talkcontribs)

Maybe it complains from the \x{feff} character? It's the Byte order mark that usually start unicode streams... looks like that perl script doesn't support that?

Note that on the browser you see the documentation because the perl script calls the api passing parameters probably in a HTTP POST request, while your browser is using HTTP GET

Reply to "Create new page by Perl via MediaWiki::API"

Fresh Wiki with over 500+ bot accounts.

2
Summary by MarkAHershberger

Manual:Combating spam and Manual:Combating vandalism have an overview on the topic.

Serena Eclipse (talkcontribs)

Greetings everyone. Im just seeking some help. Im veey new to this software and cant do much without guides quite yet. I found this link http://thread.gmane.org/gmane.org.wikimedia.mediawiki/41614/focus=41697 but im honestly unsure of how to implement anything suggested. I had the link to my wiki available for maybe 1 day before it was slammed with trash pages and bots. Bots registering and posting trash. Im not sure if any anonomous bots have created any pages. I just want it to stop and to clean the wiki. Is there a quick way I can delete all the spam pages and bots? I do have some legitimate users so I believe purging the database is not a good idea. Any help including telling me how to implement the sigges

88.130.117.48 (talkcontribs)

Hi!

Manual:Combating spam and Manual:Combating vandalism have an overview on the topic.

If you know, which users are legitimate, it could be an idea to create a list with all spam users and remove all contributions by these users. Another idea would be, if you have a list of spam pages, to delete all those pages. The latter can be done by Extension:Nuke.

Urhixidur (talkcontribs)

On the French Wiktionary, I notice occasional odd sort glitches. For instance, http://fr.wiktionary.org/w/index.php?title=Cat%C3%A9gorie:Noms_communs&subcatfrom=bok%0ANoms+communs+en+bok#mw-subcategories will show "Noms communs en bokobaru‎", "Noms communs en boko‎", "Noms communs en bokyi‎" despite the fact that the first two sub-categories are indexed with Catégorie:Noms communs|bokobaru‏‎ and Catégorie:Noms communs|boko, respectively. The few times this happens, it is always the case that the out-of-sequence sort key is a prolongation of the key it should go after.

Another particularly bad example is http://fr.wiktionary.org/w/index.php?title=Cat%C3%A9gorie:Noms_communs&subcatfrom=dan%0ANoms+communs+en+dan#mw-subcategories where we have danaru‎, dangaléat, dani de l’Ouest, dani de Mid Grand Valley, danois, dano, and only then dan (so we have dan moved down six slots, and dano moved down one slot).

Reply to "Odd sort problems"

[RESOLVED] MediaWiki don't work with PCRE 8.34

4
87.252.72.81 (talkcontribs)

I was running MediaWiki 1.20.8 with no problems. Then after upgrading PCRE from version 8.33 to 8.34, the content on most of the pages in my MediaWiki site does not display, only empty pages without content. Then I upgraded to MediaWIki 1.22.0, but the same problem still exist there.

The Apache Error Log shows many lines like this (note there is different line numbers in the errors, so its not only line number 902 like in this example) (I have changed the domain name and user name and ip from the error):

[Wed Dec 18 14:07:46.351691 2013] [:error] [pid 8193] [client 12.12.12.12:53455] PHP Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/xxx/domains/xxx.com/public_html/w/includes/MagicWord.php on line 907, referer: http:// xxx.no/w/index.php/Hovedside

Then I look at PCRE 8.34 changelog at pcre.org/news.txt wich says this:

"Perl no longer allows group names to start with digits, so I have made this change also in PCRE."

Please look into this and make MediaWiki compatible with newest PCRE 8.34

Also, please help me about what changes I need to do in order to patch this problem manually in MagicWord.php, so that I don't have to downgrade PCRE, please help.

88.130.117.159 (talkcontribs)

Thanks for the very good problem description!

I have just checked the bugtracker and here already is an issue about this problem:

https://bugzilla.wikimedia.org/show_bug.cgi?id=58640

Please add your findings there, especially this:

Then I look at PCRE 8.34 changelog at pcre.org/news.txt wich says this:
"Perl no longer allows group names to start with digits, so I have made this change also in PCRE."
Lucy Tech (talkcontribs)

The patch on the link above and running php update.php fixed this issue for me. Thanks for directing us to the correct place.

Bennylin (talkcontribs)

Thanks for the patch

Reply to "[RESOLVED] MediaWiki don't work with PCRE 8.34"

HTTP user and password parametrization

4
Summary by Ciencia Al Poder

use $wgSMTP

Lmaltier (talkcontribs)

Hello!

I use an internal wiki shared by a small team. When I try to confirm my e-mail address, I don't receive anything. I suspect the reason might be that we use a secure http server, and that the Http user and password must be provided when the software sends a mail.

Which parameters should be used in such a case in Mediawiki parameter files, and in which files?

Thanks

Lmaltier (talkcontribs)

No idea? I would have expected to find this information in Manual:Configuration_settings but I can't find it.

Ciencia Al Poder (talkcontribs)

Email auth should be provided in Manual:$wgSMTP. You can also set a debug log to see what's happening when the mail is sent.

Lmaltier (talkcontribs)

Thanks. I should have found it...

178.114.20.135 (talkcontribs)

Good day,

The wiki of whonix.org is using the MediaWiki software, as well as the accompanying language extension bundle with its language selector. However, noone really knows how to use it. And after reading through the guidelines written on the "mediawiki wiki", I still am unable to understand it. As far as I could gather, to translate a page, each section of text needs to be surrounded by the <language> tag. However, doing so simply doesn't work. The tags just appear in the text, as if they would serve no purpose. Also, adding the language selector, by using the <languages /> tag, doesn't work either. Only the homepage, was affected by these changes, however other sites of the forum seem to be unaffected.

If someone would be able to explain, what I'm doing wrong, I would be more than thankful.

Have a nice day,

Ego

178.114.20.135 (talkcontribs)

Good day,

I've just had a nice chat with some on the IRC chat. They recommended I should try copying the contents of a page where it does work on a page where it doesn't, to see, whether it would then work. Sadly, the answer is no. No matter what we do the language selector seems to be weirdly selective (no pun intended) about where it works and where it doesn't.

If someone could help me with this, I would be more than grateful.

Have a nice day.

Ego

MarkAHershberger (talkcontribs)

Did you talk to nikerabbit or siebrand in #mediawiki-i18n about this? I don't have any experience with the language bundle, myself.

This comment was hidden by Ciencia Al Poder (history)
Reply to "How does translating work?"

Transfer content of category to other category

3
Stunteltje (talkcontribs)

The dutch Nationaal Register Varende Monumenten got a new name: Register Varend Erfgoed Nederland. How can I transfer the categories in Category:Nationaal Register Varende Monumenten to the new Category:Register Varend Erfgoed Nederland without doing it by hand? Cat-a-Lot doesn't do the job. @Stunteltje

Ciencia Al Poder (talkcontribs)

2 options:

Stunteltje (talkcontribs)

Sorry, not experienced enough to use a bot.

Reply to "Transfer content of category to other category"

How can i delete the files for ever, which are located in image/deleted

4
95.172.68.155 (talkcontribs)

Software Version MediaWiki 1.22.3

PHP 5.4.20 (apache2handler)

MariaDB 5.5.33-MariaDB

My wiki isn't available in the Internet, only intranet. Sorry.

My question is:

We deleted a lot of old files from our wiki, because it wasn't connected and needed any more. Now we would like to do some maintenance and remove the deleted files from the "images/deleted" Folder.

Can i do just rm -r * in "images/deleted" Folder or is there some maintenance tool available for that? And what does the wiki say, when the file is deleted on the filesystem?

Thank you in advance for help.

Daniel

from Essen, Germany.

Malyacko (talkcontribs)

Please run supported software for your own safety. Version 1.22.3 is ancient and has security vulnerabilities. See https://www.mediawiki.org/wiki/Download

MarkAHershberger (talkcontribs)

You can test this out yourself by just moving the files out of the way initially. For example, log in with a sysop account and visit a deleted image's file page. Then, in a shell:

$ cd $IP/images
$ mv deleted not-yet-deleted

Now reload the page in your browser -- add ?action=purge to be sure you're seeing something up-to-date -- and see how the page's appearance has changed.

You should also log out of the wiki and see if there is a noticeable problem for less privileged users of the site.

If everything is good, then you can really delete the images. If there is a problem, you can move them back to the deleted folder.

88.130.117.48 (talkcontribs)

The maintenance script deleteArchivedFiles.php does what you want.

Greetings from ... Essen, btw. :-)

Reply to "How can i delete the files for ever, which are located in image/deleted"

Updating a Realy Realy old version (1.15)

7
Summary by MarkAHershberger

Don't forget to update php, too!

Jessemcternan (talkcontribs)

I would like to update my local wiki to the most up-to-date version. The majority of the webpages on this topic I found were for version much newer than mine. Can this level of upgrade even be done? I have quite a bit of information that I don't want to manually re-enter.

MediaWiki 1.15.1
PHP 5.3.2-1ubuntu4.30 (apache2handler)
MySQL 5.1.73-0ubuntu0.10.04.1

My wiki is local. I don't have a link for anyone to follow.

Thank you very kindly for your help.

88.130.95.230 (talkcontribs)

Hi Jesse!

Yes, what you want is possible.

It is important that you make sure you have a working backup of your wiki: The database and the files. Put that on an external disk, unplug it and keep it far away from your actual computer. After that you can try the upgrade and you won't loose anything, should you screw up.

Here is a complete guide on how to upgrade: Upgrade!

If you have further questions, do not hesitate to ask!

Florianschmidtwelzow (talkcontribs)

Hi! First: Good decision to upgrade, MediaWiki 1.15 is already unsupported for a long time :P

You should following the Upgrade tutorial when upgrading. In the FAQ section you'll find a question "How do I upgrade from a really old version? In one step, or in several steps?" :) If you have any specific problem when upgrading, feel free to ask here!

Btw.: You should really really do a backup, it's always possible, that data will be lost after or during an upgrade, even if the last 999 upgrades went fine :)

Please remember, that the latest MediaWiki version needs at least PHP 5.3.2, so you have to upgrade your php version, too.

88.130.95.230 (talkcontribs)
Please remember, that the latest MediaWiki version needs at least PHP 5.3.2, so you have to upgrade your php version, too.

Oh, that's right and not right at the same time. :-) MediaWiki 1.25 in fact needs PHP 5.3.3 at least. That means, if Jesse wants to upgrade to 1.25, he will in fact need to upgrade PHP as well. I missed that. However, according to Compatibility#PHP, MediaWiki 1.24 will work nicely also with PHP 5.3.2.

So for MediaWiki 1.25, a PHP upgrade would be necessary. MediaWiki 1.25 is working nicely also on newer PHP versions; e.g. for Ubuntu, PHP 5.5 is available. This version can be used to run MediaWiki on it.

Florianschmidtwelzow (talkcontribs)

> to the most up-to-date version

:D :P But you're right, 1.24 would work :)

Jessemcternan (talkcontribs)

UPDATE (and thanks for your support so far):

- I backed up my config files, extensions, and images

- I then updated to Ubuntu 12 (from 10). The wiki was still working!

- Then (curse my brash impatience) I updated to Ubutnu 14

Now, the wiki is not found, "Not Found  The requested URL /mediawiki/ was not found on this server."

Any suggestions? I should have stayed with Ubuntu 12...

-

My current Setup:

PHP 5.5.9-1ubuntu4.12

mysql  Ver 14.14 Distrib 5.5.44, for debian-linux-gnu (x86_64) using readline 6.3

Apache/2.4.7 (Ubuntu)

88.130.117.48 (talkcontribs)

Hi!

I guess the Ubuntu upgrade has also upgraded the Apache webserver, right? In that case, I think that something in the server configuration is missing now... Maybe the webroot is pointing to a wrong path now or a virtual host configuration (I don't know if you used one in your old Ubuntu version) is missing.

Reply to "Updating a Realy Realy old version (1.15)"

Approved Revs: Allowing the creators of a page to approve their own content

1
Jaisonmb (talkcontribs)

Hello,

First I apologize if this seems to be a repetitive question however, I have been searching and testing numerous things for a few weeks now. My organization is currently using the ApprovedRevs format of MediaWiki which I understand means that users with Admin/Bureaucrat permissions can approve newly created wiki pages as well as any/all revisions. However, the amount of approvals is getting rather big as more and more of our organization is taking advantage of this wonderful tool so we would like the creator/owner of a wiki page to be able to approval revisions themselves. We do NOT want everyone to be given admin/Bureaucrat permissions as to avoid users going to other pages they did NOT create and editing them whether accidently or on purpose. I have implanted many commands and lines of syntax to try and allow this including the below lines however, I can not seem to get the desired results. Can anyone assist? Thank you very much, Jaison

$egApprovedRevsAutomaticApprovals= false;

$egApprovedRevsApproveLatest = True;

$egApprovedRevsBlankIfUnapproved = True;

$egApprovedrevsSelfOwnedNamespace[] = array (NS_Main, NS_USER)

Reply to "Approved Revs: Allowing the creators of a page to approve their own content"