Hi everyone,
ATM I’m fiddeling around with a little enigma (for me). − I hope some one can help me … :-)
# I wanna do Moving a page as a bot (written in PHP) with api.php without leaving a redirect.
# the problem I can move the page. − But the parameter "noredirect" (value = 1) seems to be ignored. So every moved page exists with the redirect after moving …
# my guess I guess there is something not correct with the (implementation of the) user right "suppressredirect" (which is required for using the API parameter "noredirect"; see [0]).
[0] https://www.mediawiki.org/wiki/API:Move#Parameters
# my conditions ## MW * v1.27.3
## the bot * I created a bot with my main account. * the bot can do everything (edit, query, …) so far * the bot is listed in the group "bot"
## /includes/DefaultSettings.php L 5076: "$wgGroupPermissions['bot']['suppressredirect'] = true;"
# one more point If I query the API (api.php) for the moved page with the parameters * prop=contributors * titles=$MYPAGENAME * pcrights=suppressrevision I get empty (= no) contributors − so my bot has not the correct right …
I hope you can give me a hint how I can accomplish such a basic task.
Thanks a lot in advance and best regards Kai
On Tue, Jun 27, 2017 at 11:10 AM, Kai Sommer sommer@leibniz-gei.de wrote:
# the problem I can move the page. − But the parameter "noredirect" (value = 1) seems to be ignored. So every moved page exists with the redirect after moving …
# my guess I guess there is something not correct with the (implementation of the) user right "suppressredirect" (which is required for using the API parameter "noredirect"; see [0]).
It works fine when I try it on my local test wiki. Although I'm using MediaWiki master rather than 1.27.3.
# one more point If I query the API (api.php) for the moved page with the parameters
- prop=contributors
- titles=$MYPAGENAME
- pcrights=suppressrevision
suppressrevision and suppressredirect are different rights. prop=contributors is also a poor method to check rights, action=query&list=allusers&aurights=suppressredirect would make much more sense. Or, while logged in as your bot, try action=query&meta=userinfo&uiprop=groups|rights.
Hi again!
1st: Thanks Brad for your comment!
Am 27.06.2017 um 18:03 schrieb Brad Jorsch (Anomie):
On Tue, Jun 27, 2017 at 11:10 AM, Kai Sommer sommer@leibniz-gei.de wrote:
# the problem I can move the page. − But the parameter "noredirect" (value = 1) seems to be ignored. So every moved page exists with the redirect after moving …
# my guess I guess there is something not correct with the (implementation of the) user right "suppressredirect" (which is required for using the API parameter "noredirect"; see [0]).
It works fine when I try it on my local test wiki. Although I'm using MediaWiki master rather than 1.27.3.
#hmmm I had the same problem with 1.27.2.
# one more point If I query the API (api.php) for the moved page with the parameters
- prop=contributors
- titles=$MYPAGENAME
- pcrights=suppressrevision
suppressrevision and suppressredirect are different rights.
Oh yes, you are right! − I coundfounded that both parameters … #sry
[…]
Or, while logged in as your bot, try
action=query&meta=userinfo&uiprop=groups|rights.
That was a good hint! − That’s my output:
----- 8< ----- array(2) { ["batchcomplete"]=> bool(true) ["query"]=> array(1) { ["userinfo"]=> array(4) { ["id"]=> int(2) ["name"]=> string(5) "WVbot" ["groups"]=> array(4) { [0]=> string(3) "bot" [1]=> string(1) "*" [2]=> string(4) "user" [3]=> string(13) "autoconfirmed" } ["rights"]=> array(17) { [0]=> string(13) "autoconfirmed" [1]=> string(17) "editsemiprotected" [2]=> string(14) "nominornewtalk" [3]=> string(10) "autopatrol" [4]=> string(8) "writeapi" [5]=> string(4) "read" [6]=> string(10) "createpage" [7]=> string(10) "createtalk" [8]=> string(4) "move" [9]=> string(13) "move-subpages" [10]=> string(18) "move-rootuserpages" [11]=> string(18) "move-categorypages" [12]=> string(4) "edit" [13]=> string(9) "minoredit" [14]=> string(5) "purge" [15]=> string(15) "applychangetags" [16]=> string(10) "changetags" } } } } ----- >8 -----
So it’s fact that my bot is missing the right "suppressredirect". :-| => What shall I do!? (I wanna stay with th 1.27 = LTS.)
Thanks Kai
On Tue, Jun 27, 2017 at 12:17 PM, Kai Sommer sommer@leibniz-gei.de wrote:
["rights"]=> array(17) { [0]=> string(13) "autoconfirmed" [1]=> string(17) "editsemiprotected" [2]=> string(14) "nominornewtalk" [3]=> string(10) "autopatrol" [4]=> string(8) "writeapi" [5]=> string(4) "read" [6]=> string(10) "createpage" [7]=> string(10) "createtalk" [8]=> string(4) "move" [9]=> string(13) "move-subpages" [10]=> string(18) "move-rootuserpages" [11]=> string(18) "move-categorypages" [12]=> string(4) "edit" [13]=> string(9) "minoredit" [14]=> string(5) "purge" [15]=> string(15) "applychangetags" [16]=> string(10) "changetags" }
That list of rights looks like you're using OAuth or BotPasswords for the bot login, which means you probably did not select a grant that includes the 'suppressredirect' right.
Thanks Brad, again!
Am 27.06.2017 um 18:35 schrieb Brad Jorsch (Anomie):
[…]
That list of rights looks like you're using OAuth or BotPasswords for the bot login,
Yes, my bot is (such) a "BotPasswords"-login. − I thought that’s the correct way to achieve my goals (interacting with my API) and my bot is in the "bot" user-group. (So I thought it’s a bot and has bot rights …)
which means you probably did not select a grant that includes the 'suppressredirect' right.
=> Can you tell me how I can grant that right to my "BotPasswords"-bot?
Thanks in advance Kai
Hey …
Am 27.06.2017 um 18:44 schrieb Kai Sommer:
[…]
=> Can you tell me how I can grant that right to my "BotPasswords"-bot?
Only FYI: „Bot passwords allow access to a user account via the API without using the account's main login credentials. The user rights available when logged in with a bot password may be restricted.“ [1]
[1] https://en.wikipedia.org/wiki/MediaWiki:Botpasswords-summary
Caused by the restricted access rights, I created a normal user account and assigned it to the „bot“ group. − And so it’s working now.
Thanks @Brad and #cu Kai
mediawiki-api@lists.wikimedia.org