Jump to content

Manual talk:How to debug/Login problems

About this board

Post request trouble (mwapi bot)

7
Summary by MvGulik

Local code troubles combined with a unexpected api-path change. ('/api.php' vs '/w/api.php')

See: [Special:SpecialPages >> Special:Version >> "Entry point URLs"] for active api path.

MvGulik (talkcontribs)

Been using mwapi for bot related stuff as admin on some MW-wiki. (I'm not hosting it, nor do I have any experiences in hosting or running MW.)But after some MW update of the site it seems I can't do any Post request anymore. (preventing properly logging).The thing it that I do not get an api error message. But MW response with the general MediaWiki API help "This is an auto-generated MediaWiki API documentation page." html page (so triggering a "Could not decode as JSON" code error). This suggest to me the problem resides at the MW-site.Not sure if this might be related to the potential updating process that was used by the host.Anything I can try or test so collect more info on this. (before contacting the host)(I know how to create a raw html/api:get request. Not sure how to format a raw html/api:post request though.)

MediaWiki: 1.39.10PHP: 8.1.30 (apache2handler)MariaDB: 11.5.2-MariaDB-ubu2404ICU: 72.1

Crap: While switching edit mode to preview the message the text got suddenly compressed. (not going to fight the editor anymore. If it thinks this is better. Ok, fine by me. (+and no more previewing on my part ofc)

Tgr (WMF) (talkcontribs)

Sounds like an URL routing problem (wrong Apache rewrite rule or such). You could try doing some requests via Special:ApiSandbox just to make sure the problem is not on your side.

MvGulik (talkcontribs)

ApiSandbox works ok, as I could create(edit) a new page with it.

The "URL routing problem" reminds me that the related wiki also switched to a Cloudflare server. Which did trigger some odd loosing-login-state issues on image pages. If it is a potential URL routing problem on my end, I'm not sure if ApiSandbox would also trigger them in that case.

(still working(cleaning) on my code, as I currently can't positively rule out it not being the problem. Although it used to work ok before the wiki's MW-updates & Cloudflare server switch.)

+(Hmm. I should run some login tests on some other wiki's for comparison.)

MvGulik (talkcontribs)

Took some time to add support for easier switching between wiki's & accounts.

Api login on "mediawiki.org" & "publictestwiki.com" work as expected. Login successful. (Main-user login and Bot-Passwords(Both old & newer style)).

But on the intended target wiki ... no joy, still failing with the same error. ... Guess its time to contact the host.

(OAuth mode login a bit outside my skill/knowledge/motivation level)

MvGulik (talkcontribs)

Humbug ... I noted that the target wiki failed on getting a login token, while in earlier testing that part completed successful. But than failed at the actual login part.

So, as I had some api-path troubles in earlier testing ... I changes the api path (now globally set!) from '/w/api.php' to '/api.php'. And now its back to working order. No wonder I got lost, never expected something like that. (+my code is a bit messy, which did not help.)

Problem solved I guess. (at least on my end .. for now)

Tgr (WMF) (talkcontribs)

You can find out the path from Special:Version, FWIW.

MvGulik (talkcontribs)

... Aha. Don't recall seeing, on the target wiki, the "Entry point URLs" section before though. Although that's probably because that very selective memory of mine. ;-)

Loizbec (talkcontribs)

Hi, I'm developing for my own needs an extension that allows to show different content based on whether the user is logged in or not. I don't think it's mature enough to be distributed yet :(

I also wanted to load a different css, based on that.

I proceeded as follows : if (!self::is_registered()) { $out->addStyle('/w/index.php?title=MediaWiki:NotLoggedIn.css&action=raw&ctype=text/css'); $out->addMeta( "logged", "no" ); } else{ $out->addStyle('/w/index.php?title=MediaWiki:LoggedIn.css&action=raw&ctype=text/css'); $out->addMeta( "logged", "yes" ); }

It works, but even though MediaWiki:NotLoggedIn.css is in my LocalSettings whitelist : $wgWhitelistRead=array(

       "MediaWiki:NotLoggedIn.css",//etc.

It can be displayed by users which are not authenticated. But '/w/index.php?title=MediaWiki:NotLoggedIn.css&action=raw&ctype=text/css' cannot.

Any idea of a workaround I could use ?

Thanks in advance for any suggestion anyone might have.

Tgr (WMF) (talkcontribs)

Use a normal file or ResourceLoader module rather than a wiki page, I suppose?

This kind of question is better suited for the Support desk, though.

Loizbec (talkcontribs)

I want the css to be editable by wiki users, so I want it to be a wiki page. I'll look at the ResourceLoader, and if I don't manage, I'll move it to the Support desk.

Thank you!

Reply to "Extension development"

Error Message from Mediawiki

4
This post was hidden by Jawitkien (history)
Jawitkien (talkcontribs)

After I logged out as suggested by the above error, the wiki won't let me login and I get the message (again in red):

There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Go back to the previous page, reload that page and then try again.


Anyway, I added this line to my LocalSettings.php

$wgDebugLogFile = "/tmp/debug-mw20190724.log";

and saw that I'm getting database errors:

[SQLBagOStuff] DBError: A database query error has occurred.

[DBQuery] SQL ERROR: Table './wiki/objectcache' is marked as crashed and should be repaired (localhost)

So now I need to find out how to repair an objectcache...

Tgr (WMF) (talkcontribs)

It's a cache, probably you can just delete it and things will be regenerated eventually.

Wargo (talkcontribs)

You can run query: REPAIR TABLE objectcache

Reply to "Error Message from Mediawiki"
There are no older topics