compress-wordpress

compress-wordpress is available online at: https://github.com/zachbornheimer/compress-wordpress

compress-wordpress is a program written by Z. Bornheimer to allow for the automatic optimization of a wordpress installation. It makes use of the wp-config.php file to find the "wp-content" directory if it isn't wp-content. The program runs css compression, javascript compression, and image compression; any/each of these can be disabled through a commandline switch. Additionally, image optimization has two types: aggressive (nearly lossless) and simple (lossless); in 99% of cases, there will be no visual distinction between the two.

Recommended Procedure

cd into the wordpress base directory. Then run:

compress-wordpress --aggressive --no-image-optimization

After that, use the /scripts/optimize-images.pl script to optimize the images.

Switches and their priority


If there are two command line switches on the line, the one closer to left has higher priority. The switches with highest priority are first in this list.

  • --only-core : excludes the WP_CONTENT directory (as defined in wp-config.php or it defaults to /wp-content/) from optimization
  • --no-wp-update : does not update plugins, themes, and the core
  • --no-wp-redownload : does not redownload the WordPress Core
  • --simple-image-optimzation : does nothing...relic to be removed.
  • --no-image-optimization : no image optimization
  • --ignore-uploaded-images : if image optimization is enabled, it actively ignores files with paths matching /uploads/ and /blogs.dir/
  • --aggressive : triggers wp-update, wp-core-redownload, and wp-db-upgrade
  • --no-css : no css optimization
  • --no-js || --no-javascript : no javascript optimization

Requirements

Below, you will find Unix and Perl Requirements.

Unix Requirements

This software assumes CentOS with the YUM software utility. It can be easily modified to another system by adjusting the $packageManagerInstall

If the below software isn't installed, it will auto-install the software.

The software compress-wordpress tests/auto-installs are:

  • which
  • find
  • sed
  • which
  • nice
  • closure-compiler
  • yui-compressor
  • java
  • optipng
  • pngquant
  • advdef
  • jpegoptim
  • curl
  • sudo
  • unzip
  • mv
  • wp

Perl Modules

  • strict
  • warnings
  • feature qw/ say switch /
  • Getopt::Long
  • Test::Simple

Code Design

The idea behind the testing was to easily check for the programs in a perl-specific manner, hence the testing module...testing. Additionally, I used a comment-first style (which allows effective programming from a predefined flow).

Suggested Parameters

For all sites without the ZysysHosting Optimizations Plugin:

compress-wordpress --aggressive --only-core

For all sites WITH the ZysysHosting Optimizations Plugin:

compress-wordpress --aggressive --no-image-optimization

For some some sites:

compress-wordpress --aggressive

Bug Reporting

Find a bug? Report it: http://bugs.zysys.org/buglist.cgi?product=compress-wordpress

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2018-03-21 - ZachBornheimer
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback