Page MenuHomePhabricator

Reply tool doesn't show when the wiki not run on subFolder like /wiki/
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):
If you setup your wiki to run directly under the URL e.q. https://wiki.company.net/ then the reply and subscribe buttons are not shown on discussion Pages.

If you change the wiki to run under a sub folder e.g. https://wiki.company.net/wiki/, then it works

$wgArticlePath = "/$1"; # doesn't work
$wgArticlePath = "/wiki/$1"; # works

Reason
I found out that the problem results from an wrong regex built within CommentUtils::getTitleFromUrl().

If you run the wiki with subFolder e.g. /wiki/, then the value of $articlePathRegexp is "/\/wiki\/([^?]*)/"

The value from $config->get( 'ArticlePath' ) is https://local/wiki/User_talk:Tom_Ramm

So the result from this function will be: User_talk:Tom_Ramm

But if you change the LocalSettings.php to $wgArticlePath = "/$1";, then the value of $articlePathRegexp is "/\/([^?]*)/ "

The value from $config->get( 'ArticlePath' ) is https://local/User_talk:Tom_Ramm

So the result from this function will be: /local/User_talk:Tom_Ramm

the starting /local/ in the result is the problem.

Solution
my solution is to change the code (starting from line 488) to:

		$articlePath = $config->get( 'ArticlePath' );
		if ($articlePath === "/$1") {
			$articlePath = "/local/$1";
		}

		$articlePathRegexp = '/' . str_replace(
			preg_quote( '$1', '/' ),
			'([^?]*)',
			preg_quote( $articlePath, '/' )
		) . '/';

Software version
MW 1.40.0
Discussion tools 0.0.0 (as showing in Special:Version) / REL_140

Event Timeline

Yes! This solved the issue that I reported here and had me baffled, thanks! The code you shared didn't quite work for me (perhaps because I'm using REL1_39) but after understanding what's happening and doing a few tweaks, I made it work. Thanks again!!!

ppelberg moved this task from Backlog to Triaged on the DiscussionTools board.
ppelberg edited projects, added Editing-team (Tracking); removed Editing-team.
ppelberg moved this task from Backlog to External on the Editing-team (Tracking) board.
ppelberg subscribed.

I think this was fixed in 1.42 when the same problem was reported again in T358321.