Skip to content

Commit

Permalink
Code to create static gzip file
Browse files Browse the repository at this point in the history
Added code to create a static gzip file alongside the regularly cached file (behind a filter, not enabled by default). Useful for people that use gzip_static in Nginx.
  • Loading branch information
Draikin committed Aug 1, 2016
1 parent 249804f commit 81e9e8d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions classes/autoptimizeCache.php
Expand Up @@ -57,6 +57,10 @@ public function cache($code,$mime) {
} else {
// Write code to cache without doing anything else
file_put_contents($this->cachedir.$this->filename,$code, LOCK_EX);
if (apply_filters('autoptimize_filter_cache_create_static_gzip', false)) {
// Create an additional cached gzip file
file_put_contents($this->cachedir.$this->filename.'.gzip',gzencode($code,9,FORCE_GZIP), LOCK_EX);
}
}
}

Expand Down

0 comments on commit 81e9e8d

Please sign in to comment.