Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#13562 closed task (blessed) (fixed)

Version the image files used in our CSS files

Reported by: markjaquith's profile markjaquith Owned by:
Milestone: 3.0 Priority: normal
Severity: major Version: 3.0
Component: Administration Keywords:
Focuses: Cc:

Description

We've changed quite a few image files for 3.0 — Nacin recommended that we pseudo-version the image files we're pointing to in our CSS files so we're sure upgraders see the new ones.

Attachments (1)

bump-image-versions (2.9 KB) - added by markjaquith 14 years ago.
Updated script to bump files. This version updates wp-includes/script-loader.php too.

Download all attachments as: .zip

Change History (13)

#1 @markjaquith
14 years ago

Untested patch. Looked for .gif and .png in wp-admin CSS files and appended ?ver={date}. Fixed one that got double-dated.

Patch too big to upload!

http://txfx.net/files/wordpress/13562.001.diff

#2 follow-up: @azaozz
14 years ago

An alternative would be to rename/add version to the actual image file name menu-bits.gif -> menu-bits-30.gif -> menu-bits-31.gif, etc. I seem to remember something having problems with query strings in CSS URLs, but can't find what it was now :)

#3 in reply to: ↑ 2 ; follow-up: @nacin
14 years ago

Replying to azaozz:

I seem to remember something having problems with query strings in CSS URLs, but can't find what it was now :)

Follow-up conversation between Mark and I:

  • nacin: Mark, I wonder if versioning might mess with Gears?
  • MarkJaquith: in what way?
  • MarkJaquith: oh, like it won't match?
  • nacin: I was just brainstorming what Andrew may have been thinking of. The only thing I could think of was Gears having files without query strings in the manifest but with them in the CSS files.
  • MarkJaquith: I think you're right. Because it's done over HTTP, and the spec calls them URLs, either absolute or relative to manifest file. It could be /get-image.php?id=123 for all Gears knows.
  • MarkJaquith: Oz may be right — only foolproof way is to bump the filename itself. Could do it based on which ones have changed since last release.
  • nacin: I wonder if the manifest could take version numbers.
  • MarkJaquith: yeah, some of them are versioned via TinyMCE
  • nacin: Or we say begone to Gears all together. I believe the idea was to only continue to support the manifest if it didn't cause more work. The UI is entirely gone.
  • MarkJaquith: Oh, duh.
  • MarkJaquith: http://code.google.com/apis/gears/api_localserver.html Search for ignoreQuery
  • MarkJaquith: We can just turn that flag on for all the other images in the manifest.
  • nacin: Sounds sane.
  • MarkJaquith: Pass it in the $wp_version

#4 @nacin
14 years ago

  • Severity changed from normal to major

Severity bump. 3 out of 4 screenshots I've seen, even from core contributors, have outdated/cached images in the admin menu, the nav menu, what have you (all major UI elements). If we can't agree to head in the direction of the patch at hand, we should start renaming files. I prefer getting the patch at hand to work, as renaming files hurts from a plugin perspective and a version control perspective.

#5 in reply to: ↑ 3 @azaozz
14 years ago

Replying to nacin:

Yes, the Gears manifest would need updating and I believe the other place where this would have caused difficulties was the HTML 5 offline storage, but we cannot use that anyway (see #7262).

#6 @markjaquith
14 years ago

I'm working on a more targeted patch. Here's what I used to get the list of modified (including added) gif or png images between 2.9 release and current HEAD. I'm going to try to do this as a script so it can just be a quick thing we do as part of releases.

mark@mac pro~$ svn di --summarize http://svn.automattic.com/wordpress/tags/2.9 http://svn.automattic.com/wordpress/trunk | awk '{ print $2 }' | sed -e 's#http://svn.automattic.com/wordpress/tags/2.9/##' | grep -E '.(gif|png)$'

wp-includes/images/upload.png
wp-content/themes/twentyten/screenshot.png
wp-content/themes/twentyten/images/wordpress.png
wp-admin/images/fav-top.png
wp-admin/images/wp-logo.gif
wp-admin/images/screen-options-left.gif
wp-admin/images/browse-happy.gif
wp-admin/images/screen-options-right.gif
wp-admin/images/menu.png
wp-admin/images/fav-arrow-vs-rtl.gif
wp-admin/images/widgets-arrow.gif
wp-admin/images/menu-bits.gif
wp-admin/images/fav-arrow-rtl.gif
wp-admin/images/wp-logo.png
wp-admin/images/media-button-music.gif
wp-admin/images/fav-arrow.gif
wp-admin/images/media-button-image.gif
wp-admin/images/login-header.png
wp-admin/images/media-button-video.gif
wp-admin/images/icons32-vs.png
wp-admin/images/icons32.png
wp-admin/images/menu-bits-rtl.gif
wp-admin/images/screen-options-right-up.gif
wp-admin/images/media-button-other.gif
wp-admin/images/menu-vs.png

#7 @markjaquith
14 years ago

(In [15068]) Default Google Gears ignoreQuery to true in manifest. see #13562

#8 @markjaquith
14 years ago

I uploaded a script that updates these strings.

It prompts you for two versions... an old and a new. It looks for changed .gif and .png files between them. It strips existing ?ver= strings for those files in your working copy, and then adds the new ones using the current date. It then gathers a list of changed CSS/JS files so you can manually bump their versions in wp-includes/script-loader.php

Here's the result for a run against 2.9 to trunk.

http://txfx.net/files/wordpress/13562.automated-bump.diff

That doesn't include the bumps to the versions in wp-includes/script-loader.php. I'm working on figuring out a way to bump those automatically too.

@markjaquith
14 years ago

Updated script to bump files. This version updates wp-includes/script-loader.php too.

#9 @markjaquith
14 years ago

Updated version of the script updates the wp-includes/script-loader.php version numbers for any CSS/JS files that changed because they contained URLs of images that changed since the last release.

So this should be an automated solution.

I updated this diff:

http://txfx.net/files/wordpress/13562.automated-bump.diff

See any issues after applying the diff?

#10 @nacin
14 years ago

Tested. Appears to work properly with Gears; could use a second test.

I cleared my DB, svn up'd to r13980 (r13981 removed gears from the UI), manually applied [14356], bumped the manifest version, then turned Gears on. svn up'd to head, then applied patch (including a new manifest version bump). Gears appeared to work properly and all images were refreshed.

#11 @nacin
14 years ago

By the way, awesome script. :-)

#12 @markjaquith
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [15072]) Add ?ver=DATE query strings to all images that changed since 2.9, to expire browser cache. Bump versions on all CSS/JS files modified in that process. fixes #13562.

Note: See TracTickets for help on using tickets.