Page MenuHomePhabricator

Help users clean up manual importing of global.js/global.css pages across Wikimedia wikis
Closed, ResolvedPublic

Description

See bug 57891 comment 52, 53, 54.


Version: unspecified
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=57891

Details

Reference
bz68933

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:40 AM
bzimport set Reference to bz68933.
Legoktm created this task.Jul 31 2014, 5:31 PM

MariaDB [metawiki_p]> select count(*) from page where page_namespace=2 and page_title like "%/global.js" limit 2;

270

$ mwgrep --user --max-results 2 "global.js"
(total: 116472, shown: 2)

MariaDB [metawiki_p]> select count(*) from page where page_namespace=2 and page_title like "%/global.css" limit 2;

70

$ mwgrep --user --max-results 2 "global.css"
(total: 29083, shown: 2)

Obviously the mwgrep is just an estimate, but I think it's pretty close to what we're dealing with.

My idea: have a simple script that a steward can run at the request of a user. The script goes through every wiki, checks the users' common/vector/monobook/etc.js/css, see if there is only one line, matches something similar to (mw\.loader\.load|importScriptURI).*meta\.wikimedia\.org.*User:$username/global\.js.*

and if it only has one author in the history, delete it. We could also just comment it out like Nemo suggested, but that is less useful for users due to bug 68488.

From 57891 comment 56:

(In reply to Nemo from comment #54)

(In reply to MZMcBride from comment #53)

But, broadly, we want to be incredibly hesitant of using bots to make
automated edits to or deletions of pages of this kind, due to their very
sensitive nature.

There's nothing sensitive in disabling them.

I mean(t) that the pages are generally associated with stewards and other power-users and we need to be very mindful of mucking with users' personal CSS and JS without explicit permission/consent.

Lines importing from the user's global.js or global.css on other wikis can
simply be commented by a bot, with an edit summary linking the announcement of
the new feature.

Commenting out is a good point. We'd discussed blanking or deleting, but not that. If we're doing bot edits, you're probably right that commenting out is best. Though I'm still not sure we should be doing bot edits and there were general concerns about leaving behind clutter (e.g., leaving user subpages around indefinitely that contain only commented-out code).

(In reply to MZMcBride from comment #2)

From 57891 comment 56:

This should be "From bug 57891 comment 56:". Bugzilla is hard. :-(

From bug 57891 comment 57:

(In reply to MZMcBride from bug 57891 comment #56)

Lines importing from the user's global.js or global.css on other wikis can
simply be commented by a bot, with an edit summary linking the announcement of
the new feature.

Commenting out is a good point. We'd discussed blanking or deleting, but not
that. If we're doing bot edits, you're probably right that commenting out is
best. Though I'm still not sure we should be doing bot edits and there were
general concerns about leaving behind clutter (e.g., leaving user subpages
around indefinitely that contain only commented-out code).

What if it was commented out, a note left on the user's primary wiki talk page, and then if nothing happens, delete the commented out code after some arbitrary number of months like six?

(In reply to comment #3)

What if it was commented out, a note left on the user's primary wiki talk
page, and then if nothing happens, delete the commented out code after some
arbitrary number of months like six?

If the user is active and attentive, we can probably skip the commenting out and just delete the pages immediately (no need to wait six months). I guess we're discussing cases where the user is inactive or inattentive?

(In reply to MZMcBride from comment #4)

(In reply to comment #3)

What if it was commented out, a note left on the user's primary wiki talk
page, and then if nothing happens, delete the commented out code after some
arbitrary number of months like six?

If the user is active and attentive, we can probably skip the commenting out
and just delete the pages immediately (no need to wait six months). I guess
we're discussing cases where the user is inactive or inattentive?

It's a very likely scenario. The alternative is to just delete them and leave a detailed note of why they were deleted and explain how to get them back if there was some specific reason they wanted them.

Doesn't matter much to me, just trying to avoid any knee-jerk drama that might be caused by it catching people off-guard.

To help in the brainstorm: what about replacing the existing global.js pages by something like this?

mw.loader.using( 'mediawiki.notify' )
.done( function(){

mw.notify(
  $( '<p>' ).append(
    $( '<a>' ).attr( 'href', '//www.mediawiki.org/wiki/Extension:GlobalCssJs' )
      .text( 'GlobalCssJs' ),
    ' will be deployed to WMF wikis in a few days, and your ',
    $( '<a>' ).attr( 'href', '//meta.wikimedia.org/wiki/Special:MyPage/global.js' )
      .text( 'global.js' ),
    ' and ',
    $( '<a>' ).attr( 'href', '//meta.wikimedia.org/wiki/Special:MyPage/global.css' )
      .text( 'global.css' ),
    ' pages will be loaded automatically from Meta-Wiki.'
  ),
  { autoHide: false, title: 'Update your scripts!' }
);

} );

// Prevent scripts from being executed twice
if( ! window.loadedGlobalScript ){

window.loadedGlobalScript = true;
/* Existing user code */

}

Change 154441 had a related patch set uploaded by Legoktm:
[WIP] Script to clean up manual user global.js/css pages

https://gerrit.wikimedia.org/r/154441

Change 154441 merged by jenkins-bot:
Add a script to delete manual user global.js/css pages

https://gerrit.wikimedia.org/r/154441

Currently running this for users who signed up on [[m:GlobalCssJs]]...

Change 156533 had a related patch set uploaded by Krinkle:
Add a script to delete manual user global.js/css pages

https://gerrit.wikimedia.org/r/156533

Change 156533 merged by jenkins-bot:
Add a script to delete manual user global.js/css pages

https://gerrit.wikimedia.org/r/156533