Manual talk:How to debug/Login problems

About this board

Extension development

3
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
Return to "How to debug/Login problems" page.