Plugin Directory

Changeset 753056


Ignore:
Timestamp:
08/07/2013 04:10:07 PM (13 years ago)
Author:
rahul286
Message:

Fixes purge-all bug

Location:
nginx-helper/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nginx-helper/trunk/nginx-helper.php

    r709330 r753056  
    22/*
    33  Plugin Name: Nginx Helper
    4   Plugin URI: http://rtcamp.com/
     4  Plugin URI: http://rtcamp.com/nginx-helper/
    55  Description: An nginx helper that serves various functions.
    6   Version: 1.7.2
     6  Version: 1.7.3
    77  Author: rtCamp
    88  Author URI: http://rtcamp.com
    99  Requires at least: 3.0
    10   Tested up to: 3.5
     10  Tested up to: 3.6
    1111 */
    1212namespace rtCamp\WP\Nginx {
  • nginx-helper/trunk/purger.php

    r702960 r753056  
    675675
    676676        function true_purge_all(){
    677             $this->unlinkRecursive(RT_WP_NGINX_HELPER_CACHE_PATH);
     677            $this->unlinkRecursive(RT_WP_NGINX_HELPER_CACHE_PATH, false);
    678678            $this->log( "* * * * *" );
    679679            $this->log( "* Purged Everything!" );
     
    681681        }
    682682
    683         function unlinkRecursive( $dir ) {
     683        /** Source - http://stackoverflow.com/a/1360437/156336 **/     
     684       
     685        function unlinkRecursive( $dir, $deleteRootToo ) {
    684686            if ( ! $dh = opendir( $dir ) ) {
    685687                return;
     
    690692                }
    691693
    692                 if ( ! unlink( $dir . '/' . $obj ) ) {
     694                if ( ! @unlink( $dir . '/' . $obj ) ) {
    693695                    $this->unlinkRecursive( $dir . '/' . $obj, true );
    694696                }
     697            }
     698           
     699            if ($deleteRootToo){
     700                rmdir($dir);
    695701            }
    696702
  • nginx-helper/trunk/readme.txt

    r709330 r753056  
    33Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
    44Requires at least: 3.0
    5 Tested up to: 3.5
    6 Stable tag: 1.7.2
     5Tested up to: 3.6
     6Stable tag: 1.7.3
    77License: GPLv2 or later (of-course)
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4545== Frequently Asked Questions ==
    4646
     47**Important** - Please refer to [http://rtcamp.com/nginx-helper/faq](http://rtcamp.com/nginx-helper/faq) for uptodate FAQ's.
     48
    4749= FAQ - Installation/Comptability =
    4850
    4951**Q. Will this work out of the box?**
    5052
    51 No. You need to make some changes at the Nginx end. Please check **tutorial list** of [Description tab](http://wordpress.org/extend/plugins/nginx-helper/)
    52 
    53 = FAQ - Nginx Map =
    54 
    55 **Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?**
    56 
    57 Definitely. `WPMU_ACCEL_REDIRECT` reduces the load on PHP, but it still ask WordPress i.e. PHP/MySQL to do some work for static files e.g. images in your post. Nginx map lets nginx handle files on its own bypassing wordpress which gives you much better performance without using a CDN.
     53No. You need to make some changes at the Nginx end. Please check [tutorial list](http://rtcamp.com/wordpress-nginx/tutorials)
    5854
    5955= FAQ - Nginx Fastcgi Cache Purge =
    6056
     57**Q. There's a 'purge all' button? Does it purge the whole site?**
     58
     59Yes, it does. It physically empties the cache directory. It is set by default to `/var/run/nginx-cache/`.
     60
     61If your cache directory is different, you can override this in your wp-config.php by adding
     62`define('RT_WP_NGINX_HELPER_CACHE_PATH','/var/run/nginx-cache/');`
     63
     64Replace the path with your own.
     65
    6166**Q. Does it work for custom posts and taxonomies?**
     67
    6268Yes. It handles all post-types same way.
    6369
     
    8793Needless to say, this won't work, if you have a page or taxonomy called 'purge'.
    8894
    89 **Q. There's a 'purge all' button? Does it purge the whole site?**
    90 
    91 Yes, it does. It physically empties the cache directory. It is set by default to `/var/run/nginx-cache/`.
    92 
    93 If your cache directory is different, you can override this in your wp-config.php by adding
    94 `define('RT_WP_NGINX_HELPER_CACHE_PATH','/var/run/nginx-cache/');`
    95 Replace the path with your own.
    9695
    9796= FAQ - Nginx Map =
     97
     98**Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?**
     99
     100Definitely. `WPMU_ACCEL_REDIRECT` reduces the load on PHP, but it still ask WordPress i.e. PHP/MySQL to do some work for static files e.g. images in your post. Nginx map lets nginx handle files on its own bypassing wordpress which gives you much better performance without using a CDN.
    98101
    99102**Q. I am using X plugin. Will it work on Nginx?**
     
    113116
    114117== Changelog ==
     118
     119= 1.7.3 =
     120* Suppressed `unlink` related error-messages which can be safely ignored.
     121* Fixed a bug in purge-all option.
    115122
    116123= 1.7.2 =
     
    201208
    202209* Fixed duplicate entries generated for maps (Harmless, but doesn't look good!)
    203 * Added timestamp html comments for cache verification, as described here: http://rtcamp.com/tutorials/checklist-verify-wordpress-nginx-setup/
     210* Added timestamp html comments for cache verification, as described here: http://rtcamp.com/wordpress-nginx/tutorials/checklist/
    204211
    205212= 1.3.3 =
     
    218225
    219226* Improved Readme.
    220 
    221227
    222228= 1.2 =
     
    238244== Upgrade Notice ==
    239245
    240 = 1.7.1 =
    241 Added true purge all. Updated log and map file locations.
     246= 1.7.3 =
     247Fixed true purge all.
Note: See TracChangeset for help on using the changeset viewer.