MediaWiki talk:Gadget-libGlobalReplace.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

To-Do[edit]

  • Use (already existing) i18n strings in the local project language (e.g. Criterion 3 (obvious error)).

Page blacklist[edit]

@Rillke: would it be possible to add a blacklist of pages which this tool ignores by project? In particular, I'm thinking anything that is a subpage of User:OgreBot/Uploads by new users, although in theory this could exempt other subpages like en:User:Multichill/Free uploads or en:User:Multichill/top self uploaders. Please ping me if it takes you more than 48 hours to respond. Thanks. Magog the Ogre (talk) (contribs) 11:37, 20 September 2014 (UTC)[reply]

Eight years later, I've come across another place where this would be useful. Usage Bot generates galleries of files that are used on external projects like Commons:Files used on OpenStreetMap. Since these reflect the filenames as used by the external projects, it's not correct to update them when the file is renamed. It's not much of a problem, because the bot reverts the change on its next run, but it would be better if there were a way to mark pages as not to be updated when files are renamed. --bjh21 (talk) 14:47, 17 August 2022 (UTC)[reply]

This edit updated a file link but also broke a link to a deletion discussion. This seems to have been caused by a bug in this script. --Stefan4 (talk) 14:55, 25 May 2015 (UTC)[reply]

Confirmed:
var getFileRegEx = function (title) {
		return new RegExp('([\\n\\[\\:\\=\\>\\|]\\s*)[' + $.escapeRE(title.charAt(0).toUpperCase()) + $.escapeRE(title.charAt(0).toLowerCase()) + ']' + $.escapeRE(
			title.slice(1)).replace(/ /g, '[ _]'), 'g');
	};

'== de minimis ... the extended way ==\n\n[[File:Museu Valencia de la Il·lustració i la Modernitat, interior.JPG|thumb|maybe a series of photographs exhibited in a museum → de minimis according to the DR close]]\n\nIf someone wants to have an example which seems [[Commons:Deletion requests/File:Museu Valencia de la Il·lustració i la Modernitat, interior.JPG|undeleteable by a DR]] on Commons because it is [[COM:PRP|surely / "to the best of our knowledge" free]] → look right. Does someone know the photographer? I want to illustrate his article with it to show his works which create such a nice atmosphere in the museum. --[[User:Saibo|Saibo]]&nbsp;([[User talk:Saibo|<small>Δ</small>]]) 15:05, 10 January 2011 (UTC)'.match(getFileRegEx('Museu Valencia de la Il·lustració i la Modernitat, interior.JPG'));
-- Rillke(q?) 20:01, 25 May 2015 (UTC)[reply]
@Stefan4: Please let me know if you encounter any other issue. -- Rillke(q?) 20:21, 25 May 2015 (UTC)[reply]
On a second thought, we might want to move deletion requests with files being moved? -- Rillke(q?) 20:22, 25 May 2015 (UTC)[reply]
Is there a need for moving deletion requests? As long as the deletion request is mentioned on the talk page in the template {{Kept}} and as long as there is a redirect from the link in the deletion discussion, it should be fine to leave the request where it is. --Stefan4 (talk) 11:22, 26 May 2015 (UTC)[reply]
It could be more handy for tools so they don't have to parse the talk page first to find old deletion requests about a page. Otherwise, there is no need, at least not yet. On the other hand, considering how many deletion requests we have, we might have an own namespace for them hand have a reserved page for each corresponding page. -- Rillke(q?) 16:24, 26 May 2015 (UTC)[reply]
The tools already have to search for mass deletion requests, which are not named after any of the nominated files. --Stefan4 (talk) 14:26, 27 May 2015 (UTC)[reply]

Wikidata[edit]

I renamed File:Denhaag kunstwerk ghandi.jpg because the 'h' in the name Gandhi was at the wrong location. Special:GlobalUsage/Denhaag kunstwerk ghandi.jpg reveals that the old file name is in use on Wikidata, but this script didn't attempt to update the file name on Wikidata and didn't ask CommonsDelinker to do this either. All other usage (on Commons and two Wikipedias) was correctly updated, though. --Stefan4 (talk) 11:28, 28 May 2015 (UTC)[reply]

+1 this a strong (known) problem, there are thousands of dead or wrong links on Wikidata.User: Perhelion (Commons: = crap?)  12:15, 28 May 2015 (UTC)[reply]
This is a problem with Wikidata being different than all other replacements are carried out. Please report it to Wikidata developers. -- Rillke(q?) 15:19, 28 May 2015 (UTC)[reply]
When moving a category the link will be automatically fixed on wikidata, see https://gerrit.wikimedia.org/r/#/q/Iad9bd7065bb0874ebf52e65a,n,z . But it does not work for files. This should be reported to wikidata dev's. See also https://phabricator.wikimedia.org/T66794. --Steinsplitter (talk) 15:29, 28 May 2015 (UTC)[reply]
Looking at d:Special:Contributions/CommonsDelinker, it seems that CommonsDelinker is able to handle Wikidata pages. If this script can't handle Wikidata correctly, can't it at least send a request to CommonsDelinker if a file is in use on Wikidata? The script already sends requests to CommonsDelinker in several other situations. --Stefan4 (talk) 16:26, 28 May 2015 (UTC)[reply]
I'll have a look at CommonsDelinker's source. It's quite new since Magnus rewrote it. -- Rillke(q?) 20:13, 28 May 2015 (UTC)[reply]
d:Q4115189 appears to be some kind of sandbox. -- Rillke(q?) 23:12, 5 June 2015 (UTC)[reply]
GET wbgetentities

http://www.wikidata.org/w/api.php?action=wbgetentities&format=jsonfm&ids=Q4115189

// ...
                "P18": [
                    {
                        "id": "Q4115189$66001212-4f38-5752-744f-17ea89417127",
                        "mainsnak": {
                            "snaktype": "value",
                            "property": "P18",
                            "datatype": "commonsMedia",
                            "datavalue": {
                                "value": "\" onmouseover=\"alert('There is a security vulnerable. Please contact the next admin.')\" target=\".png",
                                "type": "string"
                            }
                        },
                        "type": "statement",
                        "rank": "normal"
                    }
                ]
            },
            "sitelinks": {
POST wbsetclaim
action	wbsetclaim
baserevid	221430505
bot	1
claim	{
    "type": "statement",
    "mainsnak": {
        "snaktype": "value",
        "property": "P18",
        "datavalue": {
            "type": "string",
            "value": "\" onmouseover=\"alert('There is a security vulnerable. Please contact the next admin.')\" target=\".png"
        }
    },
    "id": "Q4115189$66001212-4f38-5752-744f-17ea89417127",
    "rank": "normal"
}
format	json
token	+\
{
    "pageinfo": {
        "lastrevid": 221430772
    },
    "success": 1,
    "claim": {
        "id": "Q4115189$66001212-4f38-5752-744f-17ea89417127",
        "mainsnak": {
            "snaktype": "value",
            "property": "P18",
            "datatype": "commonsMedia",
            "datavalue": {
                "value": "\" onmouseover = \"alert('There is a security vulnerable. Please contact the next admin.')\" target=\".png",
                "type": "string"
            }
        },
        "type": "statement",
        "rank": "normal"
    }
}

-- Rillke(q?) 21:00, 6 June 2015 (UTC)[reply]

Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. Rillke(q?) 07:56, 8 June 2015 (UTC)

The edit summary contains two links, one to COM:FR and one to File talk:Flume Schlüssel K3 von 1972.jpg. It seems that the script only added an interwiki prefix to the first link but not to the second one. I think that all links should be assumed to be relative to Commons. --Stefan4 (talk) 14:59, 12 June 2015 (UTC)[reply]

Fixed - thanks for reporting -- Rillke(q?) 22:16, 12 June 2015 (UTC)[reply]
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. Rillke(q?) 22:16, 12 June 2015 (UTC)

Renaming reason and language[edit]

When renaming a file, the gadget takes a renaming reason from Template:File renaming reasons/i18n. This reason is always written in the language the file mover has selected at Special:Preferences. Would it be possible for the gadget to instead present the renaming reason in the language of the local wiki? I think that it looks strange to see renaming reasons in Swedish on Chinese Wikipedia and think that renaming reasons in Chinese would look better. --Stefan2 (talk) 11:33, 29 October 2015 (UTC)[reply]

@Stefan2: it is now English by default. Of course, it would be nice if the wiki's content language would be chosen, though. -- Rillke(q?) 17:35, 8 March 2016 (UTC)[reply]

Bug: no fail on not existing file[edit]

Please give simply a .fail back, if the given filename not exists on Commons. I really wondering this not happen (if you do 200 replacements with the wrong file). User: Perhelion 09:12, 9 May 2016 (UTC)[reply]

You want to say: The library should check whether there is a file under the new file name and if not, it should .reject() the promise? Technically the check won't be too hard to implement (patches welcome), on the other hand I am not sure whether it is in scope of the library, whether there are use cases of replacing with files that do not (yet) exist. -- Rillke(q?) 20:16, 9 May 2016 (UTC)[reply]
Yes, that is what I mean. I'm not fully aware from whom the lib is mainly used, so your uncertainty makes me uncertain too. But as I use the lib (over the tool from User:Sreejithk2000) the target file can be entered manually, thus, there is always a possible (more or less) error-proneness of human failure. On the other hand, such pre-exist-check can also be done by the (downstream) user-tool (by Sreejithk2000). So for me the question is, in which script the exist-check is to prefer? (I really thought here, so that's why I'm here.) User: Perhelion 21:03, 9 May 2016 (UTC)[reply]
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. -- User: Perhelion 14:40, 17 October 2017 (UTC))

Grammar[edit]

In the following text:

Replacing usage immediately using your user account. Do not close this window until the process completed.

Change the last word to “completes”. Brianjd (talk) 13:56, 19 June 2020 (UTC)[reply]

Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. King of ♥ 14:38, 19 June 2020 (UTC)

MyLanguage[edit]

{{Ep}} Suggesting to replace the "GR" link in editsummary to a "MyLanguage" version, like ([[c:Special:MyLanguage/GR|GR]]). Stang 22:19, 24 December 2021 (UTC)[reply]

I think it contains a cross-namespace redirect (GR instead of COM:GR) in order to keep the edit summary as short as possible, so that it’s less likely that it gets cut off. Switching to another language is not that difficult, so I think saving an extra click is not worth making more file links not work at all. —Tacsipacsi (talk) 23:31, 24 December 2021 (UTC)[reply]
It make sense, and I Withdrawn my request. Stang 19:14, 7 January 2022 (UTC)[reply]

Page blanking seemingly done by script[edit]

Hello – it looks to me like this script may have been responsible for this page blanking at enwiki. I'm not familiar with this tool in the slightest so I can't really provide more information than that but I figured this would be the correct venue to let someone know. Tollens (talk) 07:13, 7 October 2023 (UTC)[reply]