Jump to content

Topic on Extension talk:PageAuthors

Summary by Sophivorus

Seems a local issue and user stopped replying.

Stefahn (talkcontribs)

First of all thanks for your good work and the helpful extension!

I have a strange thing going on: On one of my wikis the extension works fine, on the other it doesn't generate any output. I don't see any error messages in the console nor in php_errors.log. On my test install with $wgShowExceptionDetails = true; $wgShowDBErrorBacktrace = true; there is no error either.

Both the working and the not working wiki run with MW 1.35.7 and PageAuthors 1.4 (f63a4b4). The two wikis are different in terms of installed extensions and different versions (for example SMW). Could another extension interfere with PageAuthors?

Maybe you have another hint that is causing the issue?

Sophivorus (talkcontribs)

Hi! Maybe no one that edited the page you're viewing qualifies as an author? In other words, no one reaches the default criteria (or the criteria you configured) for being an author? This often happens with test pages with placeholder text, or the main page of a new wiki where the only author is a system user that gets ignored by the default config.

Stefahn (talkcontribs)

Hi. Thanks for your quick reply. I also tested it on big pages that have 10 authors and hundreds of edits, still no luck.

I used the extension Contributors before and I deleted the SQL table "Contributors" manually. Could that interfere with PageAuthors?

I still have the extension ContributionsScores running. I disabled it for testing but still no output from PageAuthors.

Maybe I can run some database cleanup?

Could I somehow debug my issue?

Sophivorus (talkcontribs)

Hm, none of that should affect the list of page authors. Can you share a link to a page containing the {{PAGEAUTHORS}} call that should definitely return something but doesn't? Also are you using the default config? If not, could you share your config? Thanks!

Stefahn (talkcontribs)

Thanks for your reply. I use the default config - I have no line except wfLoadExtension.

Here's a page that was heavily edited. See "Authors" above the yellow box towards the bottom of the page: https://secret-wiki.de/wiki/Empathie

Sophivorus (talkcontribs)

Hi, I'm a bit baffled by this bug. Perhaps it's something about that particular page? Did you try other pages? Could you create a test page and simulate a few edits that should definitely produce an author list? Perhaps the cause of the error is that secret-wiki.de is using MySQL 5.7.28 while marketingunited.org is using MySQL 8.0.25 (appropedia.org uses MariaDB 10.3.35)? But MediaWiki supports MySQL 5.7.28 and this extension just uses selectFieldValues and other standard methods to query the database, so it should work... Can you add the code below to the LocalSettings.php of secret-wiki.de, then visit https://secret-wiki.de/wiki/Empathie?debug=1 and let me know of any clues?

$debug = $_GET['debug'] ?? false;
if ( $debug ) {
	error_reporting( E_ALL );
	ini_set( 'display_errors', 1 );
	$wgShowSQLErrors = true;
	$wgShowExceptionDetails = true;
	$wgDebugToolbar = true;
	$wgDevelopmentWarnings = true;
}

We'll get to the bottom of this!

Stefahn (talkcontribs)

Thanks a lot for diving into this!

I added the debugging code. It throws some deprecated warning because I don't use wfLoadExtension for some extensions. Do you think this could cause the problem?

Regarding MySQL: On my test install for secret-wiki.de I already upgraded to MySQL 8. But this didn't change things.

Already tried it on other pages too, yes.

Is there any way to clean up database trash? Maybe something is wrong with some tables...

Sophivorus (talkcontribs)

Hmm, the only table this extension consults is the core revision table, so I doubt this is a database trash issue, and in any case I wouldn't know how to clean that up. Try editing https://secret-wiki.de/wiki/Empathie, replace everything for just {{PAGEAUTHORS}} and then preview the changes, to rule out that some other element in the page is causing conflict. Then, try editing the main PageAuthors.php file and replace each "continue;" statement for "return 1;", "return 2;" etc. This could give us a clue of what conditional is falsely firing.

Stefahn (talkcontribs)

Thanks for your efforts, much appreciated! I did everything you suggested but there was still no output at all.

I also added <code>echo "Something";</code> within the function <code>getPageAuthors</code> but this was not printed too. So it seems the function is not called at all?

I not only tried it in preview mode, but also with saving the page.

Another information: When adding ?debug=1 I also get this warning by the way:

A ParserGetVariableValueSwitch hook handler bypassed the cache, this is deprecated since MediaWiki 1.35 in
/html/website/mediawiki/includes/debug/MWDebug.php
on line 430
Sophivorus (talkcontribs)

Hmm! Could you try adding return 1; to the very beginning of getPageAuthors? This is to make sure it isn't firing, because using echo like you did is not definitive. Then, could you try adding {{PAGEAUTHORS:{{FULLPAGENAME}}}} to the page? This is to see if the problem is with the PAGEAUTHORS magic word only, or with the PAGEAUTHORS parser function too. Thanks again, this is a tricky bug!!

Stefahn (talkcontribs)

We're making progress. {{PAGEAUTHORS:{{FULLPAGENAME}}}} is working fine. At least when I remove the return statements. If I let it run with return, it goes into the conditional if ( $wgPageAuthorsIgnoreMinorEdits && $revision->isMinor() ). But that might be not a problem.

{{PAGEAUTHORS}} itself still doesn't output anything at all. Also if I add a return directly below <?php there is no output of that number.

Does that help?

Sophivorus (talkcontribs)

Hmm! Why is the PAGEAUTHORS magic word not returning anything? It seems to be recognizing the magic word, else MediaWiki would treat PAGEAUTHORS as a non-existent template and show a red link. Adding a return statement below <?php won't work (you can try adding echo 1; exit; instead) but in any case we're sure the file is loading because the PAGEAUTHORS parser function works fine. I double checked the code of the extension against the patterns at Manual:Variable and elsewhere and everything looks super ok. Furthermore, the extension works at Appropedia and even at your other wiki, so it seems a local issue. I checked your installed extensions and none seems able to cause a conflict. Perhaps it's related to MediaWiki's variable cache system? Try adding echo $ret; exit; right before the return statement of onParserGetVariableValueSwitch to rule out this possibility. Meanwhile, I guess you can use {{PAGEAUTHORS:{{FULLPAGENAME}}}} for your purposes!