Page MenuHomePhabricator

[Technical admins] Vector scripts/styles will no longer apply on Vector 2022 on some wikis
Closed, ResolvedPublic

Description

This was previously reported on T331679. There have been some changes to how user and site scripts load for Vector 2022 on certain wikis. Gadgets are not impacted. If you think you have been impacted or want to minimize impact to your project please see this ticket.

Wikis that have been impacted by this change

  • All projects where Vector legacy is the default skin
  • Wikivoyage
  • Wikibooks
  • Japanese Wikipedia

Please see "Reactive actions " for next steps.

What if my wiki is not impacted?

All other projects will be impacted over the next 3 months. It is strongly advised that you coordinate and take action proactively rather than retroactively :)
Please see "Proactive actions " for next steps.

Proactive actions required to avoid disruption

For admins

  • Copy essential code in [[MediaWiki:Vector.js]] to [[MediaWiki:Vector-2022.js]]. Note temporarily this will load both sets of code so make sure that your code is setup defensively e.g. for example to avoid two identical buttons being added to a page.
  • Copy essential code in [[MediaWiki:Vector.css]] to [[MediaWiki:Vector-2022.css]]
  • Request to be fast tracked by commenting on this ticket by telling me your project e.g. en.wikipedia.org
  • Consider notifying your community in some way to mitigate the number of technical village pump / help requests you get relating to user scripts not working.
  • If you are a site administrator and have concerns and wish to be migrated last please explicitly note so on this ticket, mentioning the URL of your community.

Considering installing a gadget for all logged in users to migrate their user JS.

NOTE: Code provided below is only intended as an example, please do not copy and paste it into your project if you don't know what it does.
function doMigrate() {
    if ( mw.storage.get( 'vector-migration' ) ) {
        return;
    }
    const api = new mw.Api();
    const username = mw.user.getName();
    const VECTOR_JS = `User:${username}/vector.js`;
    const VECTOR_22_JS = `User:${username}/vector-2022.js`;
    const VECTOR_CSS = `User:${username}/vector.css`;
    const VECTOR_22_CSS = `User:${username}/vector-2022.css`;

    api.get( {
        action: 'query',
        format: 'json',
        titles: [
            VECTOR_JS,
            VECTOR_22_JS,
            VECTOR_CSS,
            VECTOR_22_CSS
        ],
        prop: [ 'revisions', 'content' ],
        rvprop: 'content',
        formatversion: 2
    } ).then( ( r ) => {
        const content = {};
        const rpages = r.query.pages
        rpages.forEach( ( page ) => {
            if ( page.revisions ) {
                content[ page.title ] = page.revisions[0].content;
            }
        } );
        
        const pages = rpages.filter( ( page ) => !page.missing ).map( ( page ) => page.title );
        let migrateVJS = false;
        let migrateVCSS = false;
        if ( pages.indexOf( VECTOR_CSS ) > -1 && pages.indexOf( VECTOR_22_CSS ) === -1 && content[ VECTOR_CSS ] ) {
            migrateVCSS = true;
        }
        if ( pages.indexOf( VECTOR_JS ) > -1 && pages.indexOf( VECTOR_22_JS ) === -1 && content[ VECTOR_JS ] ) {
            migrateVJS = true;
        }
        mw.storage.set( 'vector-migration', 1 );
        if ( !migrateVCSS && !migrateVJS ) {
            return;
        }
        const ok = window.confirm( 'Do you want your user scripts for Vector to apply to Vector 2022?' );
        if ( ok ) {
            const promises = [];
            if ( migrateVCSS ) {
                promises.push(
                    api.postWithEditToken( {
                        action: 'edit',
                        title: VECTOR_22_CSS,
                        text: content[ VECTOR_CSS ]
                      } )
                )
            }
            if ( migrateVJS ) {
                promises.push(
                    api.postWithEditToken( {
                        action: 'edit',
                        title: VECTOR_22_JS,
                        text: content[ VECTOR_JS ]
                      } )
                )
            }
            return Promise.all( promises ).then( () => {
                location.reload();
            } );
        }
    } )
}

if ( mw.config.get( 'skin' ) === 'vector-2022' ) {
  doMigrate();
}

For users

  • Copy essential code in [[Special:MyPage/vector.js]] to [[Special:MyPage/vector-2022.js]]
  • Copy essential code in [[Special:MyPage/vector.css]] to [[Special:MyPage/vector-2022.css]]

Reactive actions required to restore old behaviour.

For admins

  • Copy essential code in [[MediaWiki:Vector.js]] to [[MediaWiki:Vector-2022.js]]
  • Copy essential code in [[MediaWiki:Vector.css]] to [[MediaWiki:Vector-2022.css]]

For users

  • Copy essential code in [[Special:MyPage/vector.js]] to [[Special:MyPage/vector-2022.js]]
  • Copy essential code in [[Special:MyPage/vector.css]] to [[Special:MyPage/vector-2022.css]]

Event Timeline

Jdlrobson renamed this task from Vector scripts/styles will no longer apply on Vector 2022 on some wikis to [Technical admins] Vector scripts/styles will no longer apply on Vector 2022 on some wikis.Feb 14 2024, 9:52 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)
Izno changed the subtype of this task from "Bug Report" to "Task".Feb 14 2024, 10:16 PM

Probably want to reframe the "what to do" section oriented toward two separate groups of users: tech admins and common users (with probably the common user first).

Jdlrobson updated the task description. (Show Details)

Good idea! Thanks for suggestion @Izno - any chance I can convince you to be proactive on this one to give me more confidence going into this ? :-)

I don't have the int admin perm right now, but I'll post an edit request Soon for it.

As regards users, I'd like to see the tech notice go out first so I can be lazy and not put anything onwiki myself. :)

Hello @Jdlrobson and @Izon,
For this ticket, I will capture it in the tech news with this wording:

There are changes to how user and site scripts load for Vector 2022 on specific wikis. The changes impacted the following Wikis: all projects with Vector legacy as the default skin, Wikivoyage, and Wikibooks.
Gadgets are not impacted, and the changes will last for the next three months. If you have been affected or want to minimize the impact on your project, see this ticket. Please coordinate and take action proactively.

Please let me know if this wording is fine. I got the information from the description of the ticket; I am not sure what "User" in the wording refers to. Thanks!

There are changes to how user and site scripts load for Vector 2022 on specific wikis. The changes impacted the following Wikis: all projects with Vector legacy as the default skin, Wikivoyage, and Wikibooks.
Gadgets are not impacted, and the changes will last for the next three months. If you have been affected or want to minimize the impact on your project, see this ticket. Please coordinate and take action proactively.

Shouldn't it be rather the following:

There are changes to how user and site scripts load for Vector 2022 on specific wikis. The changes impacted the following Wikis: all projects with Vector legacy as the default skin, Wikivoyage, and Wikibooks. Other wikis will be affected in the next three months.
Gadgets are not impacted. If you have been affected or want to minimize the impact on your project, see this ticket. Please coordinate and take action proactively.

When reading the original wording, I get an impression that if these projects do nothing, the original behavior will be automatically restored after three months, whereas by reading the task description I understand that the change is being rolled out gradually, and the three months timeframe relates to when the rollout will be complete (and not reverted).

If I'm wrong, please correct me :)

Thanks @Msz2001 yes to clarify it's "Other wikis will be affected over the course of the next three months."

Erm. Are you trying to say that this change has already happened for the wikis listed as "Wikis impacted", or that these will be impacted when the change is made at some as yet undetermined point in the future?

Yesterday's Tech News was the first I heard of it, and the entire announcement is cast as a warning about an upcoming change, but on the fourth or fifth reading the use of past tense in the first two sentences seems to suggest this has already happened.

Erm. Are you trying to say that this change has already happened for the wikis listed as "Wikis impacted", or that these will be impacted when the change is made at some as yet undetermined point in the future?

Sigh, yes, that is apparently exactly what you're trying to say. Or at the very least my testing indicates that Vector 2022 does not load ~/vector.js at the moment. Excuse me while I go replace village pump notifications and watchlist notices with the exact opposite instructions to what is currently there…

(you can take the use of sotto voce indelicate language as implied)

@Xover which project are you referring to? To be clear the change has only occurred so far on the following wikis where impact is expected to be minimal:

  • All projects where Vector legacy is the default skin
  • Wikivoyage
  • Wikibooks

Please also see the user notice from a year ago: T331679 - I am sorry if you missed that announcement.

@Xover which project are you referring to? To be clear the change has only occurred so far on the following wikis where impact is expected to be minimal:

  • All projects where Vector legacy is the default skin
  • Wikivoyage
  • Wikibooks

Please also see the user notice from a year ago: T331679 - I am sorry if you missed that announcement.

English Wikisource. And I'm not complaining about a lack of notice, I'm grousing about the confusing notice that did go out.

The only clue in that notice is that the word "impacted" is in the past tense, and it refers to the vague "projects with Vector legacy as the default". Otherwise the notice is forward-looking, talking about what should be done for a change coming in the future. It links to this task that has the same problem (and even worse, here it drowns in a huge hacky migration script and all the comments on the task, and the other task). It doesn't help that the future changes are not fixed to any specific timeframe (like a date, not "maybe by the end of last year, maybe sometime this year").

The only reason I figured out that this was a change already rolled out is that the notice and the task description were so annoyingly vague about the time frame for the presumed future change, which made it a pain to write good information for my project's community, that I went re-reading the task(s) and their comments again a couple of times. It took maybe three or four re-reads before the light dawned, and even then I had to make myself a dummy vector.js to test to be sure I'd got it right.

Jdlrobson updated the task description. (Show Details)

Makes sense. Perhaps there should have been two user notices here. Sorry for the confusion. @Xover feel free to edit description in any way that might help. I've had a go at trying to make this easier to read.

What would the WMF think about mass editing instead of using their "temporary" gadget based on individual actions? Currently, I see ~1 900 edits per minute, for all the projects. Adding 300 edits per minute to this average for 10 minutes in the middle of the night in Europe to process all the pages on frwiki would be an acceptable stress on the DBs? We have like ~ 1 000 pages, so *2.

Your script assumes that everyone will understand what it's all about, that they'll all log on within short time, and so on. This could drag on for months with editors coming in every week asking why X isn't working. Not speaking about the fact that the prompt is executed one time (oops, pressed cancel). Displaying it every time is not a solution. Adding a link to execute it on click too, since we are not sure that they will get the information.

@Lofhi thanks for reaching out! The code sample provided is just there for discussion as an option, I wouldn't recommend adding the code to a wiki without further modification (I've updated description to make that clearer). If there's interest the WMF can develop it further if people have concerns about disruption to their communities. We could also run a script to do this migration if needed.

FWIW I personally think that this should be a manual process. Many users copied code into Vector.js/css 9+ years ago so it's probably better that they use the opportunity to review it and copy across only the code they need. AS you point out many users are inactive so creating the pages for those users is unnecessary and possibly even dangerous as there is no guarantee that code is still compatible with Vector 2022.

Jdlrobson updated the task description. (Show Details)

@Jdlrobson, could you please share the percent usage by skin? The SQL results for my user_properties view is heavily redacted for obvious reasons.

@Jdlrobson, could you please share the percent usage by skin?

Hi @Lofhi I don't understand your question here. What specifically do you want to know and for which project?

The SQL results for my user_properties view is heavily redacted for obvious reasons.

Currently this has to be done by a data analyst as it requires certain permissions. See T316505 for example.

I wanted to know the proportion of the active editors not using Vector (both versions).

I'm inclined to think that active users of older skins would be more likely to be affected by these types of changes, because they're more likely to customize a lot their interface to keep their workflow safe from MediaWiki changes. I have nothing to back this up.

And so just notifying the editors actually concerned by this ticket (so not the old skins users) might be an acceptable solution if we can't find the human resources to review the hundreds of pages between now and the switchover because the disruption could be minimal in average.

I wanted to know the proportion of the active editors not using Vector (both versions).

I'm inclined to think that active users of older skins would be more likely to be affected by these types of changes, because they're more likely to customize a lot their interface to keep their workflow safe from MediaWiki changes. I have nothing to back this up.

Only users of Vector 2022 are impacted by this change. Users using Monobook,Timeless, CologneBlue, Vector, Modern or Minerva are not impacted by this change at all.

Any reason this task is still open?

Jdlrobson claimed this task.