Jump to content

Topic on Extension talk:Replace Text/Archive 2019 to 2024

replaceAll.php returns "Couldn't translate '**' to a user."

2
Albert Ke (talkcontribs)

Hi all,

I have used the replaceAll.php script in the past without a problem, but for some reason it doesn't work for me anymore. What I try to do from the command line is the following:

php ./maintenance/replaceAll.php "some text" "the text that will replace the some text"

This returns: Couldn't translate '1' to a user.

php ./maintenance/replaceAll.php "some text" "the text that will replace the some text" --user="WikiSysop"

This returns: Couldn't translate 'WikiSysop' to a user.


The settings in the LocalSettings.php are:

wfLoadExtension( 'ReplaceText' );

$wgReplaceTextUser = "WikiSysop"; /*Just added this without success*/

$wgGroupPermissions['sysop']['replacetext'] = true;

$wgRunJobsAsync = false;


And this is on a mediawiki that runs:

- MW 1.41.2

- PHP 7.4.33 (fpm-fcgi)

- MySQL 8.0.36


Any idea what I might do wrong? Thanks!

@Albert Ke

128.138.65.230 (talkcontribs)

And just to add some more info: The web interface of Replace Text does work fine, it is just that the script (replaceAll.php) doesn't for some reason. It tries to determine the user, which it can't find.....


FYI: In case somebody is running into the same thing; I hacked ReplaceAll.php; removed in the 'private function getUser()', the lines that check the User (if ( get_class( $user) !== 'User') {....}. The variable 'get_class ( $user )' gives as output 'Mediawiki\user\user', which doesn't match 'User'. Not sure why the get_class returns this, but the script ran well for me without this.

So by far not 'Solved', more like a dirty workaround.

@Albert Ke

Reply to "replaceAll.php returns "Couldn't translate '**' to a user.""