Talk:FileUsageAuto-update

Suggestions
I know that there are definitely things that could be improved in this script, and if you see anything that is immediately obvious, please tell me! I enjoy learning better coding techniques as I fix things, and would appreciate any feedback. Thanks! --Foodbandlt 22:00, February 15, 2013 (UTC)

Example
A live example would be good. 09:40, June 18, 2013 (UTC)


 * I actually wanted to throw in a live example, but that would require adding the "movefile" right to the * usergroup on my test wiki to allow anyone to move files. I suppose I'll contact Staff to do that. --Foodbandlt 12:26, June 18, 2013 (UTC)


 * Or you can post a link to a wiki where it's used.  17:34, June 18, 2013 (UTC)
 * This script adds functionality to Special:MovePage when moving a file. You wouldn't be able to see or use it without the "move" and "movefile" rights. --Foodbandlt 18:36, June 18, 2013 (UTC)

Batch Renaming
I would love to see the ability to rename a bunch of images at once then have there file links updated.

Icecreamcaekbot talk•contrib 19:59, June 19, 2013 (UTC)
 * I'll look into reworking some of the code to accommodate this. I've been meaning to rework that part for a while now anyway, and that would allow for things like this. --Foodbandlt 18:18, June 21, 2013 (UTC)

Minified
Seeing as this script cannot be used without MediaWiki, is there any reason to have a minified version when ResourceLoader automatically minifies and strips comments from scripts?
 * There was something in one of the previous versions that broke the script when it was minified with importArticles, and importScript does not minify anything. For whatever reason, it wasn't broken when I minified it myself.  I'm rewriting the script right now and making sure all syntax is correct, so I'll test it with importArticles again once I'm done. --Foodbandlt 04:18, July 9, 2013 (UTC)

Templates
Is it possible to make this script work for templates? 12:11, September 9, 2013 (UTC)
 * Yes, although it would take a lot of editing and would be a little more dangerous because templates don't require additional user rights to move on most wikis. It's a little bit more efficient in the long run to just leave a redirect seeing as the Template namespace isn't usually as crowded as the File namespace. If I were to edit this to work with templates, I would be more inclined to make it an entirely separate script... but I don't have the time to do that right now. — Foodbandlt (talk) 12:53, September 9, 2013 (UTC)


 * Alright, thanks for the fast reply! 16:28, September 9, 2013 (UTC)

Work
How do I get it to work? I can't add stuff to the queue. -- WM 23:20, September 9, 2013 (UTC)
 * Well, what do you see? Do the buttons and the Queue dropdown option appear for you?  What browser are you using?  Have you cleared your cache?  — Foodbandlt (talk) 23:24, September 9, 2013 (UTC)
 * I am using Chrome on a Windows. I tried it on both the incognito and regular modes. The queue dropdown option appears. I have cleared my cache also. -- WM 23:20, September 9, 2013 (UTC)
 * This script adds buttons to Special:MovePage (which is the page that you use to rename files). You add things to the queue through Special:MovePage, then manage the queue through said dropdown option. — Foodbandlt (talk) 23:36, September 9, 2013 (UTC)
 * And I assume you need to be an admin on the Wiki to make it work, correct? -- WM 23:39, September 9, 2013 (UTC)
 * You only need to have the rights to move files, so you don't necessarily need to be an administrator. If the "Rename" option appears in the dropdown on any File page, then you have said rights.  — Foodbandlt (talk) 23:41, September 9, 2013 (UTC)
 * Okay. Thanks for the explanation. I would suggest adding this to the main article so others won't have the same confusion. -- WM 23:44, September 9, 2013 (UTC)
 * Will do, thanks for the suggestion! — Foodbandlt (talk) 23:45, September 9, 2013 (UTC)

"Invalid file extension"
Hi, even though the script is great and has saved me many hours, there seems to be a problem. When i try to rename a .PNG file and make it.png, it won't let me. It says "Invalid file extension". Is it possible to fix that? 07:28, September 10, 2013 (UTC)
 * Woops, sorry about that. Looks like I forgot to make it case-insensitive.  I'll throw an update out a little later today. — Foodbandlt (talk) 12:03, September 10, 2013 (UTC)
 * Ok, thanks! 14:16, September 10, 2013 (UTC)
 * Done. — Foodbandlt (talk) 21:41, September 10, 2013 (UTC)

Bot flag
Is possible to add a bot flag option? Given that the user has the power to flag bot himself, of course. 15:09, September 14, 2013 (UTC)
 * Yes, it's entirely possible. I've opted to let people decide that themselves because it would spam the user rights logs with every single rename performed.  If it's something you'd like to see in this script, let me know and I'll try to find the best way to include it.  On my home wiki I actually wrote this to make switching your bot flag a little easier because of the amount of entries something like this script makes on Special:RecentChanges.  — Foodbandlt (talk) 06:11, September 15, 2013 (UTC)


 * Actually, looking back at it I might've misunderstood your question. The above response goes as far as adding the bot flag to the account, but if you're talking about the edits being made by the script being submitted as bot edits then that already exists.  If the bot flag on an account is set, all edits made will appear as bot edits.  — Foodbandlt (talk) 18:05, September 15, 2013 (UTC)
 * Not true. Even if the user editing is a bot, the edits will only show up as a bot if you specify &bot=1 specifically in the api. -- Kangaroopowah  ( Talk ) 20:38, September 15, 2013 (UTC)
 * I said that because I did indeed specify that. — Foodbandlt (talk) 21:04, September 15, 2013 (UTC)

Bug
Every page that it updates a link on gets added to Category:Pages with broken file links. The pages disappear from that list as soon as the page is edited (even just changing nothing and hitting publish). So it's an easy fix, but it shouldn't need to be done in the first place. —RyaNayR (talk) 23:51, November 11, 2013 (UTC)
 * Using "Rename and replace", this is the case because the pages are edited before the file is moved. This is done out of simplicity and to still utilize Wikia's built-in move page, but I've already written the function that does its job for the queue function so I'll change that with the next update I do to this script.  I assume you are talking about "Rename and replace", right?  — Foodbandlt (talk) 02:09, November 12, 2013 (UTC)
 * Yes, it happens when I use "Rename and replace". So wait, you mean if I use the queue instead, that won't happen? —RyaNayR (talk) 04:36, November 12, 2013 (UTC)
 * I'm not saying it'll never happen when you use the queue, I'm saying it's far less likely for it to happen. Depending on the speed of Wikia's servers and number of files moved, there's always a chance that it will happen but it's far less than its guaranteed happening in Rename and replace.  I don't want to force you to use the queue over Rename and replace, so I'll be throwing an update out some time in the next week.  Thanks for the suggestion! — Foodbandlt (talk) 05:31, November 12, 2013 (UTC)
 * No prob. And thanks for the soon-to-come update! —RyaNayR (talk) 06:03, November 12, 2013 (UTC)
 * Long time past due, but I've just put out a major update that includes what we discussed here. Sorry for the inconvenience. — Foodbandlt (talk) 06:44, April 10, 2014 (UTC)

Badges
Would it be possible for the script to detect if a wiki has badges disabled and, if so, to suppress warnings/messages related to them? The one leading me to ask is the badge-boosting warning shown on File:FileUsageAuto-update Special MovePage.png; I've not used this script before, though, so I don't know if there are other such messages. 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 02:06, May 12, 2014 (UTC)


 * That's actually just the message that that wiki has specified. I left the option to append a message at the bottom of the wall of text in case a wiki wanted to, for instance, warn about badge boosting or whatever they feel is important.  By default it's blank.  — Foodbandlt (talk) 03:00, May 12, 2014 (UTC)


 * Aha, thanks for the clarification. =) 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 04:02, May 12, 2014 (UTC)

Queue Problems
The queue seems to be a bit buggy lately. I am renaming images en masse, and trying to use the queue to do so. However, it usually turns up about half the images therein with an error and kicks them out of the queue. I am having to re-queue images at least once, sometimes twice. Further, the failed images do no appear in the failure list. 17:23, July 28, 2014 (UTC)
 * Sorry, I've been a little busy over the past few months. This might be related to not having the necessary throttling that the Wikia API requires to use.  I'll look into this.  Would you mind including a couple links that you tried to rename (if you remember)?  I know it's been a while since you've posted this, sorry.  Thanks!  — Foodbandlt (talk) 04:40, September 29, 2014 (UTC)

hookaborted
Hi. I tried to move to. As a rollback user, I also have the ability to suppress redirects, so I checked that tickbox. However, when I tried to do "Rename and replace", it didn't change anything and told me the queue was cleared because the hook was aborted (it said "hookaborted" as a reason). Any ideas as to why this is? I've had no issues moving files to names with macrons in them in the past. --SuperSajuuk Talk Page 10:30, August 10, 2014 (UTC)
 * Sorry, I've been a little busy over the past few months. The error code that you see if returned from the Wikia API directly as it reads.  I'll look into the issue on my test wiki and see if I can replicate it.  Thank you for including so much detail! — Foodbandlt (talk) 04:39, September 29, 2014 (UTC)

Naruto Wiki Italia
Hello. As you may see, I updated this code to my wikia. However, I do not see the button whenever I try to rename an image. Maybe I missed something? Many thanks.--User talk:JOA20 22:33, December 1, 2014 (UTC)


 * This is because I have no included multilingual support for this script yet. It relies on the English spelling of things to work properly at the moment.  I'll try to include that in the next week or so if I have time. — Foodbandlt (talk) 05:22, December 21, 2014 (UTC)


 * I've just finished including multilingual support if you'd like to help by providing a translation so that it will work in Italian. — Foodbandlt (talk) 07:11, December 27, 2014 (UTC)


 * If you would like, I can set up the script so that you only need to import a single script regardless of language, and the script would autodetect the language of the wiki in question. Code Lyoko Wiki: User: Deadcoder 16:09, December 30, 2014 (UTC)


 * Well, it already auto-detects the language and imports the appropriate languages for user/wiki language. What did you have in mind, though? — Foodbandlt (talk) 16:28, December 30, 2014 (UTC)


 * I was going to suggest consolidating it into a single script file, but having seen how large the language packs are, never mind.Code Lyoko Wiki: User: Deadcoder 19:09, January 2, 2015 (UTC)

Loading more than once
It'd be nice if the script wouldn't load more than once (e.g. check if script element ids already exist), as the script is sometimes installed wiki-wide and causes duplicate elements.


 * Done, thanks! — Foodbandlt (talk) 18:58, December 21, 2014 (UTC)

Redirects
I understand modifying the pages with the old file names gets rid of most of the need for redirects, but why not respect the "Leave a redirect behind" checkbox? There are some things this tool can never be sure to take care of, like links from other sites or related wikis using the files by shared image repository. Robo Kiss (talk) 17:50, January 2, 2015 (UTC)


 * Good point. I'll look at including this today. Thanks! — Foodbandlt (talk) 18:17, January 2, 2015 (UTC)


 * Done. Let me know if you encounter any issues. — Foodbandlt (talk) 01:36, January 3, 2015 (UTC)

Invalid File Extension
Manually adding some replacements to the queue, if one tries to replace a PNG with a JPEG or vice-versa, it will say "Invalid file extension." I know Wikia doesn't let you replace files of one type with another or rename them with a different extension, but replacing uses of one file type with another shouldn't be a problem.JoshuaJSlone (talk) 08:35, January 5, 2015 (UTC)
 * You make a good point. I've removed the file extension checking for manual adds. — Foodbandlt (talk) 13:26, January 5, 2015 (UTC)

Ghost Move bug
First, thanks for implementing previous suggestions.

Second, I've just had an especially weird bug. I had a queue of 6 files to be moved and references to them updated. It gave failures on 4 of them, which seemed a bit crazy--so I went to try moving them each individually, but there was no longer anything there. I checked the move logs and delete logs, but there was no trace of them--just the move records from the two files that did get moved. However, I did find that those other 4 files did still exist, at their new names--they just didn't leave behind a redirect, any trace in logs, or get their page uses automatically changed.Robo Kiss (talk) 06:46, January 13, 2015 (UTC)


 * I've just had a smaller second case of this. It hasn't been unusual for 1 out of a queue of 5-8 files to fail to move for some reason, but this time the 1 really did get moved and again left no trace and an apparent broken image on a page. Since I didn't include it last time, here's the error message given when it claimed to not move it: The file "Shining-Butterfly-regular.jpg" was unable to be moved to "ShiningButterfly-r.jpg" for reason: "internal_api_error_DBQueryError" . "Shining-Butterfly-regular.jpg" has been removed from the queue.JoshuaJSlone (talk) 07:03, January 13, 2015 (UTC)
 * BTW, this is my main account and Robo Kiss is what I use for bot actions, so this is still just one person reporting this error.JoshuaJSlone (talk) 07:05, January 13, 2015 (UTC)


 * Okie doke. The error "internal_api_error_DEQueryError" isn't a standard API error.  It's usually related to something wrong with Wikia.  I've heard of this happening on page edit submissions, but never on file moves.  I'm going to update the error message to include more detail on the error so we can let Wikia know exactly what's happening and see if we can get this fixed.  Would you mind stopping by and pasting the entire error message here next time it happens? — Foodbandlt (talk) 14:13, January 13, 2015 (UTC)


 * Will do. If it's a Wikia problem, might've fixed itself for now. I just did about 50 moves and didn't have it happen again. Still the occasional error, but these times it was telling the truth when a file wouldn't move. The file "685px-ShiawaseKyouryuuOndo.jpg" was unable to be moved to "ShiawaseKyouryuuOndo-r.jpg" for reason: "unknownerror; Unknown error: "directorycreateerror"" . "685px-ShiawaseKyouryuuOndo.jpg" has been removed from the queue.JoshuaJSlone (talk) 12:36, January 14, 2015 (UTC)


 * Odd. I've sent a support ticket to Wikia about this latest error.  If you get anything similar concerning "unknownerror" or "internal_api_error", let me know so I can ask Wikia about it!  Thanks!  — Foodbandlt (talk) 19:12, January 14, 2015 (UTC)


 * I've added a delay timer to the submission of API requests in an effort to mitigate the "unkownerror"s and it appears to work pretty effectively. You'll notice a slight slowdown when using the script but it's hardly noticeable.  If you want to increase or decrease the delay you can look at the customization section on the main page. Thanks for reporting this issue! — Foodbandlt (talk) 21:40, January 15, 2015 (UTC)

File usage bug
Hello. It seems that the script is unable to find file usage on French wikias. —Hulothe 14:35, January 22, 2015 (UTC)


 * Would you mind linking an example image that it lists is not used on any pages? I just tested the query that it uses to get the usage and it appears to be working fine on French wikis. — Foodbandlt (talk) 14:59, January 22, 2015 (UTC)


 * Indeed, the API query via the url works fine. But the script won't get pages, with any file. For example here (you're an admin). —Hulothe 17:22, January 22, 2015 (UTC)


 * Ahh, I see. Something that I forgot to account for (File namespaces of other languages not being 4 characters long...), heh.  It should be fixed now.  Thanks for letting me know! — Foodbandlt (talk) 17:42, January 22, 2015 (UTC)