WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 8 months ago

#45645 closed defect (bug) (fixed)

Retire wp-tinymce.php

Reported by: azaozz Owned by: azaozz
Milestone: 5.1 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords: has-patch
Focuses: Cc:

Description (last modified by azaozz)

The method of loading TinyMCE was added many years ago. All TinyMCE scripts are concatenated and pre-compressed, then we point the script tag src to wp-tinymce.php where we determine if the browser supports compression, add the appropriate headers and output the actual wp-tinymce.js.gz.

This, indeed, is the fastest way to load a lot of JS without relying on the server to compress it. However lately been seeing more and more reports of that file being blocked by some security measures. Also, nearly all servers compress .js and .css files now.

Attachments (2)

45645.diff (19.8 KB) - added by azaozz 8 months ago.
45645.2.diff (793 bytes) - added by garrett-eclipse 8 months ago.
Updated $_old_files to remove wp-tinymce.js and add wp-tinymce.js.gz

Download all attachments as: .zip

Change History (11)

#1 @azaozz
9 months ago

Thinking we can still concatenate all of TinyMCE's scripts when building, but not compress them so we don't depend on specific headers that need to be set in PHP. Will also need to keep wp-tinymce.php for a while in case something is accessing it directly (can try adding some form of "doing-it-wrong" there too). It will output the non-compressed wp-tinymce.js too.

Last edited 9 months ago by azaozz (previous) (diff)

#2 @azaozz
9 months ago

  • Description modified (diff)

@azaozz
8 months ago

#3 @azaozz
8 months ago

In 45645.diff:

  • Remove compression of wp-tinymce.js at build time from Gruntfile.js.
  • Remove the grunt-contrib-compress dependency.
  • Edit and keep wp-tinymce.php for back-compat in case "something" is accessing it directly.

Note that package-lock.json was generated on Windows and seems to have a lot of red.

#4 follow-up: @pento
8 months ago

Should add a _deprecated_file() call in wp-tinymce.php, too.

Otherwise, I'm fine with this going in if you can shepherd it, @azaozz.

#5 in reply to: ↑ 4 @azaozz
8 months ago

Replying to pento:

Should add a _deprecated_file() call in wp-tinymce.php, too.

Yeah, was thinking about adding something like it but wp-tinymce.php outputs (previously compressed) js, shouldn't have any other output or it will break it.

Thinking package-lock.json may need another look/redoing on non-Windows to keep it compatible. Will try to review and commit today.

Last edited 8 months ago by azaozz (previous) (diff)

#6 @azaozz
8 months ago

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

In 44651:

TinyMCE: retire wp-tinymce.php and remove pre-compression of wp-tinymce.js.

Fixes #45645.

#7 @ocean90
8 months ago

  • Keywords needs-patch added
  • Resolution fixed deleted
  • Status changed from closed to reopened

wp-tinymce.js needs to be removed from $_old_files. At the same time wp-tinymce.js.gz should be added.

@garrett-eclipse
8 months ago

Updated $_old_files to remove wp-tinymce.js and add wp-tinymce.js.gz

#8 @garrett-eclipse
8 months ago

  • Keywords has-patch added; needs-patch removed

@azaozz the build issue appears to be caused by this line which lists the new build location for wp-tinymce.js in the $_old_files array found in update-core.php as @ocean90 mentioned.

I've uploaded a patch with the changes mentioned and reference this ticket in the inline comment.

#9 @azaozz
8 months ago

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

In 44654:

TinyMCE: fix $_old_files after [44651], remove wp-tinymce.js and add wp-tinymce.js.gz.

Props ocean90, garrett-eclipse.
Fixes #45645.

Note: See TracTickets for help on using tickets.