Page MenuHomePhabricator

Mass rename/move of pages?
Open, LowestPublic

Assigned To
None
Authored By
jayantanth
Nov 5 2015, 8:24 PM
Referenced Files
F31759540: Screenshot (115).png
Apr 16 2020, 3:08 PM
F2923177: 2.png
Nov 6 2015, 6:19 PM
F2923162: 2.png
Nov 6 2015, 6:16 PM
F2923120: 1.png
Nov 6 2015, 6:04 PM
Tokens
"Love" token, awarded by Aram.

Description

Revived from archive as there were no answers.

I am trying to use AWB for a Bengali wikisource. We have a large number of pages (200-300 at least, page1, page2...) that we want to move to different name with a specific subpage. This is easily achieved by simply Moving the page and putting name ( "Name/page1" , "Name/page2"....) in front of the existing page name. Is there any way to accomplish this task with AWB? If not, does anyone know of any other extensions or bots that could do this based on a list of pages?

Event Timeline

jayantanth raised the priority of this task from to High.
jayantanth updated the task description. (Show Details)
jayantanth updated the task description. (Show Details)
jayantanth set Security to None.

If you want dynamic control over a list and have admin rights AWB will
allow you to move your pages wherever without a redirect. It is still
one-by-one.

Pywikibot would probably do it more easily if you have your origins and
targets already mapped out. Maybe @Mpaa or I can assist with wikisource-bot
though that would mean redirects, unless your community approved temp
admin.

@Billinghurst, you can move w/o redirects with pywikibot, if that is what you meant.

I have just missed to find out , https://phabricator.wikimedia.org/T100292 task quite similar. I have not use pywikipedia scripts (''movepages.py'' and ''pagerename.py''), but as per previous feedback , there is a problem in Unicode. So we wish to at AWB.

You could do it in a Custom Module if you're renaming based on some pattern...

In Bengali wikisource, I have to move the pages in following way... we have a book of poem called "Gitanjali" with 200 poems with a different name, like Poem1, Poem2.....and I have to move all poem to subpage as like "Gitanjali/Poem1", "Gitanjali/Poem2".......

As of now I am using AWB with move function for move mutiple page one by one. could you please create one module for me to use?

So, starting with a list of articles, you want to move them ALL from "current name" to "Gitanjali/current name"

Do you want to leave redirects behind?

Version 1...

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
    Skip = true;
    Summary = "Moved page";
    Variables.MainForm.TheSession.Editor.SynchronousEditor.Move(ArticleTitle, "Gitanjali/" + ArticleTitle, Summary, true, false);

    return ArticleText;
}

It will move a page, with the associated talk page, leaving no redirect. AWB will then make like it's "skipping" the page.

I wonder if I can get AWB to behave better after moving a page...

Are you literally just moving the page? Or are you doing any AWB processing on it afterwards?

I note there is no error handling either

Thanks @Reedy for prompt coding. Lets try this code leaving no redirect.

Tried with first with skip option "Doesn't exist" its apend text "test" screenshot attached.

1.png (768×1 px, 71 KB)

Did you paste the code into the custom module window, enable the module, and then compile it?

The default code is to prend test, so it sounds like you didn't replace the code, or, if you did, you didn't recompile it

So, after pasting it, press the "Make module" button up in the top right

Oh. I just updated the code too. I noticed an extra comma that shouldn't have been there

Yes, Please look at screenshot{F2923177}

Thanks @Reedy now its works and move the pages to subpage as desire properly.

Reedy lowered the priority of this task from High to Lowest.Nov 15 2015, 8:38 PM

Hi @Reedy, we need another module for mass move for the following condition.....

We have few pages as like below....
Gitanjali/Poem1
Gitanjali/Poem2
Gitanjali/Poem3
.......

we need to move all pages as like below

Geetanjalee/Poem1
Geetanjalee/Poem2
Geetanjalee/Poem3
.......
Respectively...

Please make a module for that. Thank you in advance.

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
    Skip = true;
    Summary = "Moved page";
    string newTitle = "Geetanjalee" + ArticleTitle.Substring(ArticleTitle.IndexOf('/'));
    Variables.MainForm.TheSession.Editor.SynchronousEditor.Move(ArticleTitle, newTitle, Summary, true, false);

    return ArticleText;
}

I believe that should do what you want...

Hi @Reedy, its works nicely. Thank you again.

Hi @Reedy, I need move hundreds of pages on ur.wiki with leaving redirect. And these pages come from different categroies. Will you please make such module which takes page names from text file?

Hello @Reedy, Can you make a module to moving over than 100 categories names? Just i replace a word with another one due to typo error. For example, We have 100 categories named "Category:Cba..." and we want to change their names all to "Category:Abc...". ckbwiki is our project. Thanks for help!

Can you be more specific? Got a few full examples?

@Reedy Sure, See here. Now, Can you see ئاڵمانیا in bold? So, I want to replace ئاڵمانیا with ئەڵمانیا in all categories names. Thanks!

LTR is harder to work with... But this should work

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
    Skip = true;
    Summary = "Moved category";
    string newTitle = ArticleTitle.Replace("ئاڵمانیا", "ئەڵمانیا");
    Variables.MainForm.TheSession.Editor.SynchronousEditor.Move(ArticleTitle, newTitle, Summary, true, false);

    return ArticleText;
}

@Reedy After making the module and click on Start button, this message box appeared for me.

Screenshot (115).png (726×1 px, 83 KB)

Right. You don’t have permission to move categories as it says. This isn’t an AWB issue

@Reedy What should i do to get permission?

In T117909#6063007, @AramBakir wrote:

@Reedy What should i do to get permission?

That's onwiki policy thing

@Reedy I'm one of the sysops on ckbwiki. Can you tell me the processes?

In T117909#6063591, @AramBakir wrote:

@Reedy I'm one of the sysops on ckbwiki. Can you tell me the processes?

Ok, so you should have that right - https://ckb.wikipedia.org/wiki/%D8%AA%D8%A7%DB%8C%D8%A8%DB%95%D8%AA:ListGroupRights

MW/MW API bug?

Can you move them manually via the interface?

MW/MW API bug?

I'd guess that the BotPassword doesn't have the relevant grant (Create, edit, and move pages / createeditmovepage).

MW/MW API bug?

I'd guess that the BotPassword doesn't have the relevant grant (Create, edit, and move pages / createeditmovepage).

Seems likely

The grants do have move-categorypages

$wgGrantPermissions['createeditmovepage'] = $wgGrantPermissions['editpage'];
$wgGrantPermissions['createeditmovepage']['createpage'] = true;
$wgGrantPermissions['createeditmovepage']['createtalk'] = true;
$wgGrantPermissions['createeditmovepage']['move'] = true;
$wgGrantPermissions['createeditmovepage']['move-rootuserpages'] = true;
$wgGrantPermissions['createeditmovepage']['move-subpages'] = true;
$wgGrantPermissions['createeditmovepage']['move-categorypages'] = true;
$wgGrantPermissions['createeditmovepage']['suppressredirect'] = true;

@JJMC89 You were right! I checked the box and done successfully! And @Reedy Thank you for your C# codes, you saved us!
The last thing: How can i change the C# codes to move the pages without leaving redirect pages?

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
    Skip = true;
    Summary = "Moved category";
    string newTitle = ArticleTitle.Replace("ئاڵمانیا", "ئەڵمانیا");
    Variables.MainForm.TheSession.Editor.SynchronousEditor.Move(ArticleTitle, newTitle, Summary, true, true);

    return ArticleText;
}

I have a question about mass renaming

Let’s say there are 3 pages, titled:
Cucumber (vegetable)
Banana (fruit)
Cashew (nut)

Is it possible using pywikibot or autowikibrowser to rename each page to replace what’s inside the parentheses to follow the same pattern, like so:
Cucumber (food)
Banana (food)
Cashew (food)

@Reedy

Hi @VG5001 Sure, you have a chance to do so using Regex class in AWB, but you have to understand using regular expression.

Try this:

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
    Skip = true;
    Summary = "Regex Test";
    string newTitle = Regex.Replace(ArticleTitle, "\\(.+\\)", "(food)");  
    Variables.MainForm.TheSession.Editor.SynchronousEditor.Move(ArticleTitle, newTitle, Summary, true, false);
    return ArticleText;
}

The code above does exactly what you want (with leaving a redirect page for each page)
See the log for:

on ckbwiki. Thanks!

@AramBakir Thanks for the help