Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Apache Optimization panel and features, edited Pro Features label #260

Closed
wants to merge 29 commits into from

Conversation

renzms
Copy link
Contributor

@renzms renzms commented Jun 21, 2016

@renzms
Copy link
Contributor Author

renzms commented Jun 21, 2016

Removed GZIP Compression panel and added under new Apache Optimizations panel.

Work also done on to simplify Pro Preview Headers (see: wpsharks/comet-cache#788)

Lite

screen shot 2016-06-18 at 1 45 53 am

GZIP Compression feature now under Apache Optimization panel:

screen shot 2016-06-21 at 9 04 28 am


Lite + Pro Preview

screen shot 2016-06-18 at 1 45 53 am

GZIP Compression feature now under Apache Optimization panel:

screen shot 2016-06-18 at 1 46 14 am

screen shot 2016-06-21 at 9 06 00 am


Pro

screen shot 2016-06-21 at 9 08 35 am

New Pro Features:

  • Leverage Browser Caching
  • Automatic GZIP Compression
  • Permalink structure via .htaccess

screen shot 2016-06-21 at 9 07 50 am

@renzms
Copy link
Contributor Author

renzms commented Jun 21, 2016

Noting an additional change by Jason here: wpsharks/comet-cache#764 (comment)

to remove:

<IfModule headers_module>
      <FilesMatch \.(?:js|css|xml|svg|xhtml|html|txt|ttf|otf|gz)$>
        Header append vary: accept-encoding
      </FilesMatch>
    </IfModule>

from gzip-enable.txt

@renzms
Copy link
Contributor Author

renzms commented Jun 21, 2016

@raamdev

Tested and Ready for review, see above comments for screenshots, updates and additional notes.

Thanks!

@raamdev
Copy link
Contributor

raamdev commented Jun 21, 2016

Woooohoooo! This looks awesome! I'll review and test this soon and leave another update. Just wanted to share my excitement. 😁

@jaswrks
Copy link
Contributor

jaswrks commented Jun 21, 2016

Noting an additional change by Jason here: wpsharks/comet-cache#764 (comment)

Awesome! About a 9.5 on the attention scale there. I just posted this! haha.. Fantastic 💯

@renzms
Copy link
Contributor Author

renzms commented Jun 24, 2016

@raamdev

Tested for changes to .htaccess

screen shot 2016-06-25 at 1 09 26 am

@raamdev
Copy link
Contributor

raamdev commented Jun 25, 2016

I pushed a bunch of changes to the Apache Optimizations panel in 603ca8c. Here's what it looks like now:

2016-06-25_00-12-28
2016-06-25_00-12-42


Things to do:

  • Test that .htaccess rules are being added when these options are enabled (my most recent test revealed they were not being added, not even the rules that get added when Static CDN Filters is enabled).
  • Refactor htaccess_client_side_cache_enable option to htaccess_browser_caching_enable instead to avoid confusion with existing Client-Side Cache feature (Jason agreed). This will also require renaming methods and files associated with this optimization.
  • Refactor htaccess_permalink_structure_enable option to htaccess_enforce_canonical_urls. This will also require renaming methods and files associated with this optimization.
  • Only show the Enforce Canonical URLs panel when !empty($GLOBALS['wp_rewrite']->permalink_structure) (i.e., when fancy Permalinks are being used).
  • Test the Lite version to verify that Pro Preview works as expected and that auto-insertion of GZIP Compression rules works as expected (I decided to make this available in the Lite version to simplify things and also give Lite users a feel for how easy it is).

It's getting really late here, so I need to call it a day. I may come back to this over the weekend, otherwise I'll resume on Monday.

@renzms If you'd like to jump in and tackle any of those checklist items above, that would be great. 😄 Be sure to get the latest from this branch.

@raamdev
Copy link
Contributor

raamdev commented Jun 25, 2016

@jaswsinc I could use another set of eyes on f8a3f19 just to double-check my work there. (EDIT: I forgot to rename BrowserUtils.php in this commit; fixed in 734609c .)

@raamdev
Copy link
Contributor

raamdev commented Jun 25, 2016

  • Need to fix issue with refactoring done in f8a3f19:

    Notice: Undefined index: COMET_CACHE_ALLOW_BROWSER_CACHE in /srv/www/wordpress-default/wp-content/plugins/comet-cache-pro/src/includes/classes/AdvCacheBackCompat.php on line 84
    

{
$_global_ns = mb_strtoupper(GLOBAL_NS);

if (!($constants = get_defined_constants(true)) || empty($constants['user'])) {
Copy link
Contributor

@jaswrks jaswrks Jun 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me. However, you can optimize this further by ditching the section that collects user-defined constants; i.e., get rid of get_defined_constants() and instead of the in_array() check, just use if (defined('COMET_CACHE_ALLOW_BROWSER_CACHE')) {

The reason is because this back compat. routine is only looking for one specific constant and not any that have a special prefix like the other method does. So it's easier, and simpler will be equal to faster.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaswsinc Done. 656098f Thanks! :-)

@renzms
Copy link
Contributor Author

renzms commented Jun 27, 2016

If you'd like to jump in and tackle any of those checklist items above, that would be great. 😄 Be sure to get the latest from this branch.

@raamdev

Things to do:

  • Test that .htaccess rules are being added when these options are enabled - (Tested, no rules are being added)
  • Test the Lite version to verify that Pro Preview works as expected and that auto-insertion of GZIP Compression rules works as expected - (Tested, GZIP rules not being added. Pro Preview is working)

Hi, pulled from the latest work from this branch, and tested.

I can confirm this current build does not add any new rules to the .htaccess file.

Expected output:

# BEGIN Comet Cache WmVuQ2FjaGU (the WmVuQ2FjaGU marker is required for Comet Cache; do not remove)
# GZIP compression.

<IfModule deflate_module>
  <IfModule filter_module>
    AddOutputFilterByType DEFLATE text/plain text/html
    AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
    AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
    AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
    AddOutputFilterByType DEFLATE font/opentype application/font-otf application/x-font-otf
    AddOutputFilterByType DEFLATE font/truetype application/font-ttf application/x-font-ttf
  </IfModule>
</IfModule>

# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
    RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
    RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Actual output:

# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
    RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
    RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

 Always enabled automatically when Static CDN Filters are enabled,
 however this can be overridden afterwards if the site owner prefers.

See wpsharks/comet-cache#789
@raamdev raamdev closed this Jun 29, 2016
@raamdev raamdev deleted the feature/554-764-765-788 branch June 29, 2016 02:51
@raamdev
Copy link
Contributor

raamdev commented Jun 29, 2016

@renzms Merged! :-) Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants