Wikipedia talk:Rename of Image-class to File-class

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Wikipedia talk:RIF)

Script[edit]

I noticed that Happy-melon mentioned he had a script that could be used to help with this task. Here is what he provided:

Script
def catMaintenance():   #Used to populate [[:Category:C-Class articles]]

    if 'y' in raw_input('Confirm questionable actions? '):
        prompt = True
    else:
        prompt = False

    import api

    bcats = api.category('Category:B-Class articles')[1]
    ccats = api.category('Category:C-Class articles')[1]
    for bcat in bcats[:]:
        cat = re.sub(r'B\-Class',r'C-Class',bcat)
        if cat in ccats:
            bcats.remove(bcat)

    num = len(bcats)

    for cat in bcats:
        bclass = wikipedia.Page(site, cat)
        cclass = wikipedia.Page(site, re.sub('B\-Class','C-Class',cat) )
        #print cclass
        if cclass.exists():
            print cclass.title()+' already exists. Skipping'
            continue
        elif api.logEvents(cclass.title(),events='delete'):
            print cclass.title()+' has previously been deleted. Skipping...'
            continue
        else:
            btext = bclass.get()
            ctext = btext
            
            ctext = re.sub('B(?=[ \-][Cc]lass)','C',ctext)
            ctext = re.sub(r'class=B','class=C',ctext)
            ctext = re.sub(r'\[\[\s*[Cc]ategory:\s*C-Class[ _]articles\s*\]\]','[[Category:C-Class articles|'+re.sub(r'(?i)[Cc]ategory:C-Class (.*) [Aa]rticles',r'\1',cclass.title())+']]',ctext)
            ctext = re.sub(r'(\|\s*)B([\|\}\]])',r'\1C\2',ctext)
            ctext = re.sub(r"(['\"])B(['\"])",r'\1C\2',ctext)
            
            print '***********************************************************************'
            wikipedia.output(ctext)
            print '********************************************'

            check = ctext
            check = re.sub(r'(?i)(\[\[\s*category:.*?\]\]|\{\{\s*(catmore(1)?|cat class|categorytoc|wpmilhist task force assessment level category|tlx?).*?\}\})','',check)
            check = re.sub(r'\{\{[^\|]+?\}\}','',check)
            check = re.sub(r'(?i)(\[\[.+?\]\]|\.|\;|\,|\'|\")','',check)
            check = re.sub(r'[ \n]*','',check)
            check = re.sub(r"(?i)thiscategorycontainsarticlesthathavebeen(ratedasC-Class|assessed)by(the)?Articlesareautomaticallyplacedinthiscategorywhenthecorrespondingratingisgivenpleaseseetheformoreinformation",'',check)
            check = re.sub(r'[^bB]','',check)
            
            #print check
            
            if not check or (prompt and 'y' not in raw_input('Skip '+cclass.title()+'? ')): 
                cclass.put(ctext,'Populating [[:Category:C-Class articles]]')
            elif prompt and 'y' in raw_input('Use a regex? '):
                ctext = re.sub(raw_input('Pattern: '),raw_input('Replace with: '),ctext)
                print ctext
                if 'y' in raw_input('OK? '):
                    cclass.put(ctext,'Populating [[:Category:C-Class articles]]')
            num -= 1
            print str(num) + ' to go...'
            print '***********************************************************************'
            
        
    
    return

It seems to relate to C-class categories, but I suppose we could adapt it maybe? — Martin (MSGJ · talk) 17:52, 25 July 2010 (UTC)[reply]

Cydebot[edit]

I've set Cydebot to work through creating the File-Class categories that haven't been yet (so attribution is preserved). –xenotalk 13:52, 26 July 2010 (UTC)[reply]

Looks good. So will the bot delete the old categories as well when they are empty? — Martin (MSGJ · talk) 16:44, 26 July 2010 (UTC)[reply]
Yea, it should... Not sure if it checks that incoming links were fixed though, are there many hard-coded links to these types of cats? –xenotalk 16:46, 26 July 2010 (UTC)[reply]
Don't think so. {{cat class}} will detect the new categories automatically, and an edit to {{grading scheme}} might be in order. — Martin (MSGJ · talk) 17:03, 26 July 2010 (UTC)[reply]

Renaming the class[edit]

Is this going to require editing of every banner using Image-Class, or can it be done automagically somehow? (If not exist Image-Class cat, then use File-Class or something). –xenotalk 14:08, 26 July 2010 (UTC)[reply]

Once all the categories are created, it will just be a simple change in Template:Class mask I think. — Martin (MSGJ · talk) 16:24, 26 July 2010 (UTC)[reply]
Cydebot is doing the final run thru now. –xenotalk 18:04, 26 July 2010 (UTC)[reply]
(edit conflict)What I was thinking was this: setting |image=yes should still turn on Image-class. This is for consistency with how all the other classes behave in this template. For example |sausage=yes turns on Sausage-class. It would not be logical to prevent WikiPrpjects from using Image-class if that is what they actually want. This would only affect the small number of projects shown in Category:WikiProjects explicitly using Image-class. —Preceding unsigned comment added by MSGJ (talkcontribs) 18:08, 26 July 2010 (UTC)[reply]
Guess I was just looking for the easiest way to do it. But it would be sloppy, I admit. –xenotalk 18:10, 26 July 2010 (UTC)[reply]
This is the easiest way I think. 99% of projects using Image-class do so by setting |FQS=yes and these will all be changed with one edit. — Martin (MSGJ · talk) 18:12, 26 July 2010 (UTC)[reply]
Oh ok, excellent. I agree that projects that want to explicitly use Image-Class should have a way to do so. –xenotalk 18:15, 26 July 2010 (UTC)[reply]
Don't forget the 8 banners at Category:WikiProject banners that don't use WPBS and hence the class mask. -- WOSlinker (talk) 19:07, 26 July 2010 (UTC)[reply]
Looks like they are all of them created now, and the class mask can be updated. –xenotalk 20:00, 26 July 2010 (UTC)[reply]
Okay, but WOSlinker is making my head hurt. — Martin (MSGJ · talk) 21:14, 26 July 2010 (UTC)[reply]
 Done — Martin (MSGJ · talk) 21:53, 26 July 2010 (UTC)[reply]

@MSGJ re [1] so are these not going to live in the former Image-Class toplevel? So this is not necessary? –xenotalk 20:34, 26 July 2010 (UTC)[reply]

Well I did suggest that we perhaps don't need that category anymore. — Martin (MSGJ · talk) 21:15, 26 July 2010 (UTC)[reply]

Like watching grass grow[edit]

Or paint dry. Lol. –xenotalk 14:04, 21 August 2010 (UTC)[reply]

Lol. Not many left now. — Martin (MSGJ · talk) 17:17, 21 August 2010 (UTC)[reply]
You could start applying null edits to the relevant pages with your bot account. — Martin (MSGJ · talk) 16:39, 1 September 2010 (UTC)[reply]
Only 6 categories left now. -- WOSlinker (talk) 19:48, 18 September 2010 (UTC)[reply]
Category Pages
Category:Image-Class Baseball articles 0
Category:Image-Class Cannabis articles 0
Category:Image-Class Greek articles 0
Category:Image-Class numismatic articles 0
Category:Image-Class Ohio articles 0
Category:Image-Class Scouting articles 0
I have added {{delete when empty}} to the remaining two categories. — Martin (MSGJ · talk) 14:29, 14 October 2010 (UTC)[reply]