This is the talk page for discussing improvements to the CategoryRenameAuto-update page.



I noticed that this script adds the "Rename" button to every drop-down menu with the 'wikia-menu-button' class, including the Contribute menu. My suggestion would be to change

$('.wikia-menu-button .WikiaMenuElement').append(...


$('#WikiaPageHeader > .wikia-menu-button .WikiaMenuElement').append(...

so that it only targets the Edit menu.

RyaNayR (talkcontribs) 08:09, February 21, 2014 (UTC)

REALLY late, but thank you! — Foodbandlt (talk) 06:39, December 22, 2014 (UTC)

Removal/Delete functionality?

What would be nice is if there was a way to *not* give a new name. Perhaps by leaving the New Category field blank, or however it can be coded, it would then *remove* the Old Category entry from pages, replacing it with nothing, and in effect simply removing Outdated/Unnecessary Cats. Combined with the "Delete old Cat" function, and it we'd have it all. --Love Robin (talk) 13:41, April 4, 2014 (UTC)

I love this suggestion! :) — SpikeToronto 13:53, December 22, 2014 (UTC)
MassCategorization has the mode to remove categories. – Ozuzanna 14:04, December 22, 2014 (UTC)
Going to agree with Oz. I hate to say import two scripts, but this is a very specific script and others have already invented the wheel for what you described. — Foodbandlt (talk) 15:00, December 22, 2014 (UTC)
Hmmm … one more script to load … *groan* … my poor little iPad is going to up and die under the strain … :'( — SpikeToronto 15:17, December 22, 2014 (UTC)

Occasional error message

Every so often I get the error message: The page "PAGENAME" could not be created due to error code: "emptypage"

Any idea what this is?

The last one I got this was for w:c:braceface:Category:Villians which I want to rename to "Antagonists", and is misspelled anyway. --Love Robin (talk) 06:30, August 13, 2014 (UTC)

Again, really late, but I've fixed it. If a category page is empty it now adds a period as I don't know how to actually make an empty page (and it's not obvious). — Foodbandlt (talk) 06:40, December 22, 2014 (UTC)

Page Rename

will there be equivalent for page renames? ie change all links on "what links here" Reasno 杰诺斯·史林特 04:03, August 26, 2014 (UTC)

I'll make it conditionally update links as well at some point. I didn't get to it tonight.Foodbandlt (talk) 06:41, December 22, 2014 (UTC)
I think I misunderstood you, actually. PageRenameAuto-update might be what you're looking for. — Foodbandlt (talk) 19:28, December 22, 2014 (UTC)

User group restrictons

Would it be possible to restrict this script to sysops-only? Perhaps as a variable preceding the import statement in Common.js. Thanks! :) — SpikeToronto 05:56, November 18, 2014 (UTC)

I would disagree with that notion on the Dev Wiki script because I know some wikis who use the script and are not sysop. I would suggest adding that yourself to your own version of the script somewhere. – Ozuzanna 19:06, November 18, 2014 (UTC)
One would have to know JS to do that… :( Would it be possible to alter the dev script so that, just above the import over at another wiki, there could be some parameter setting/value that limits the user groups for which the script operates? It could default to autoconfirmed if no parameter is supplied at the importing wiki. Thanks! — SpikeToronto 02:58, November 26, 2014 (UTC)
Instead of altering the script, you could add a conditional in your import, like so:
if (mw.config.get('wgUserGroups').indexOf('sysop') > -1) {
    importScriptPage('CategoryRenameAuto-update/code.js', 'dev');
-- sqm talk 14:03, 11.26.2014
[edit]→ Or, add the import to mediaWiki:group-sysop.js. -- sqm talk 14:07, 11.26.2014
That’s perfect! I’ll give that a try. Thanks! :) — SpikeToronto 08:08, December 2, 2014 (UTC)
It just occurred to me, though, that that will not prevent someone from adding CategoryRenameAuto-update to their personal JS and running it. Will it? — SpikeToronto 08:18, December 2, 2014 (UTC)
No, it won't. There are ways to prevent it on a per wiki basis, but there are way to get around it just with minimal js knowledge.
For example, the author of this could add a check for a global config that disables the import for non-sysops. But the user could just unset that config before importing it. Another option would be to add the restriction to the code, but then I could just copy the code to another location and remove that restriction.
Perhaps a lot of users lack the knowledge to do wither of those examples, but if I can think of ways around it I'm sure someone else can. cqm 11:17, 3 Dec 2014 (UTC)
Anyone whose javascript knowledge is at that level is not someone one has to worry about messing things up inadvertently. ;) — SpikeToronto 06:35, December 15, 2014 (UTC)

Error code

I tested the CategoryRenameAuto-update script on Test 12 Wiki and received the following error message for some, but not all, of the pages that were re-categorised:

The page at says:

The page "<page name>" could not be submitted because of error code:"internal_api_error_DBQueryError". Please update the link(s) on that page manually.

Could someone please explain why these errors occurred and if they're significant? --LegendFPS (Talk) (Contribs) 06:28, December 2, 2014 (UTC)

That's likely a error in wikia's config or code, it's not a standard api error code afaik. I'd suggest trying again in a couple of days to see if it's fixed. cqm 10:28, 2 Dec 2014 (UTC)
Ok, I'll do that. Thanks. --LegendFPS (Talk) (Contribs) 06:46, December 3, 2014 (UTC)
It worked fine on the second attempt. --LêgêndFPŠ (Talk) (Edits) 03:06, December 9, 2014 (UTC)

Non-English languages

The script doesn't seem to work on non-English wikias. Could someone please try and fix this ? Thank you in advance. —Hulothe 16:26, December 21, 2014 (UTC)

I'll try to get this done today. I might need help with translation for some things though if you're willing to help. — Foodbandlt (talk) 19:01, December 21, 2014 (UTC)
Thank you. I'm willing to help with translations. —Hulothe 21:51, December 21, 2014 (UTC)
Multilingual support update is now up, it just needs translations. Sorry this took so long. There was a lot more text than I originally thought there was. — Foodbandlt (talk) 06:42, December 22, 2014 (UTC)
I added fr, it works great ! Thank you very much. I will add some other languages if I'm able to. —Hulothe 10:26, December 22, 2014 (UTC)
I thought that, in order to not have the script become too long, we make separate versions per language, like
  • CategoryRenameAuto-update/code.js
  • CategoryRenameAuto-update/fr/code.js
  • CategoryRenameAuto-update/pl/code.js
  • CategoryRenameAuto-update/de/code.js
  • etc.
Or, does that not apply in this case. (confused) :) — SpikeToronto 15:22, December 22, 2014 (UTC)
I actually don't know, this is the first script that I've ever included multiple language support on. A couple that I looked at didn't split it up but mentioned it. I'll look around, thanks Spike! — Foodbandlt (talk) 15:33, December 22, 2014 (UTC)
You’re welcome! :) — SpikeToronto 15:57, December 22, 2014 (UTC)

Why piping?!

Why is it “piping” the categories it changes on the changed categories’ constituent pages? For example, see

This raises serious issues:

  1. The righthand-side of the pipe in a category is used to specify sort order.

    • Thus, the “Cindy Lou Who” page (see example) categorized as

[[Category:Characters with antlers|Characters with a antlers]]

means that on the “Characters with antlers” page, it files not by “cindy …”, but by “characters …”

    • “cindy” and “characters” are alphabetically close, but suppose that the page being categorized thusly were instead called “Thomas the Tank Engine”

      • the page would slot in under the C’s — as in “characters” — instead or under the T’s — as in “Thomas”.
    • It’s really up to each wiki’s categorization policy to determine the sort order of its articles.
  1. It is counterintuitive to use a pipe to continue to show the category on the page as it was — in this case, the incorrect "characters with a antlers” — especially since “as it was” was wrong and renamed for that reason.(It doesn't really do this anyway: it's all about sort order right of the pipe. :P)
  2. Compounding this issue, editors at our wiki have begin copying the method — unnecessarily piping categories — yet having zero understanding of the consequences of piping them. Moreover, the two sides of the pipe often bear no resemblance to each other, or any relation to the page on which it is placed! For example,

    [[Category:Horror films|Turtle McGurtle]]

    on a page about Friday the 13th! You can imagine the chaos this is creating.

Thanks. — SpikeToronto 13:06, December 22, 2014 (UTC)

Ahh, you're right. I hadn't considered it because MLP Wiki doesn't generally ever use pipes in categories other than when Wikia bugs pop up. Would you suggest that I remove the pipe and text after it, then? Or be able to specify what should come after the pipe? — Foodbandlt (talk) 14:00, December 22, 2014 (UTC)
@Foodie: It should just replace the category, no pipe. So, in the example above,

[[Category:Characters with a antlers]]

would just become

[[Category:Characters with antlers]]

without the extra a. This is essentially how one would do it if one were doing it manually. (By the way, on one wiki, we use sort order a lot, most often in the form


to ensure that the category pages list the entries correctly. Anyway, thanks for fixing this! :) — SpikeToronto 15:14, December 22, 2014 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── It’s official ==> I’m an idiot. :$ — SpikeToronto 15:53, December 22, 2014 (UTC)

Links to category on page

(See EDIT 2 too)
I found something thats prevents the script from working as it should: if a link to the category being renamed is already present on the page, then the script will only change this one instead of the actual category. An example here. What it should have done corresponds to the next change that I've made manually. Could you please try and find a solution to this problem? Thank you again for your great work. —Hulothe 22:58, December 22, 2014 (UTC)

EDIT : if, by the way, it could replace (optionally, by checking a checkbox) all the links to this category on any page just like does FileUsageAuto-update for images, it'd be great, too :-)

EDIT 2 : It seems that the error mentionned above doesn't affect only links to the category, but every single word that is the same as the category name (not incuding Category:). You can see an example here.

Hah, that's odd. It looks like when I copied the page processing function from FileUsageAuto-update I omitted the multiple replacements part. I'll work on including that. As for the wrong word replacement, holy crap. It looks like I missed a part of the regex when I adapted it as well. I guess I can blame that on half-spirited coding in the beginning when I was porting it to work with categories. I'll fix that asap. Thanks for the reports to make the script better! — Foodbandlt (talk) 00:02, December 23, 2014 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.