Skip to content

Commit

Permalink
FIX #19: changing post status flush
Browse files Browse the repository at this point in the history
  • Loading branch information
boyska committed Mar 12, 2012
1 parent 88d7a43 commit 54db2a7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wp-varnish.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function WPVarnish() {
// When posts/pages are published, edited or deleted
add_action('edit_post', array(&$this, 'WPVarnishPurgePost'), 99);
add_action('edit_post', array(&$this, 'WPVarnishPurgeCommonObjects'), 99);
add_action('transition_post_status', array(&$this, 'WPVarnishPurgePostStatus'), 99);
add_action('transition_post_status', array(&$this, 'WPVarnishPurgeCommonObjectsStatus'), 99);

// When comments are made, edited or deleted
add_action('comment_post', array(&$this, 'WPVarnishPurgePostComments'),99);
Expand All @@ -107,6 +109,10 @@ function WPVarnishLocalization() {
load_plugin_textdomain('wp-varnish', false, dirname(plugin_basename( __FILE__ ) ) . '/lang/');
}

//wrapper on WPVarnishPurgeCommonObjects for transition_post_status
function WPVarnishPurgeCommonObjectsStatus($old, $new, $p) {
$this->WPVarnishPurgeCommonObjects($p->ID);
}
function WPVarnishPurgeCommonObjects() {
$this->WPVarnishPurgeObject("/");
$this->WPVarnishPurgeObject("/feed/");
Expand All @@ -130,6 +136,10 @@ function WPVarnishPurgeURL($wpv_purl) {
$this->WPVarnishPurgeObject($wpv_purl);
}

//wrapper on WPVarnishPurgePost for transition_post_status
function WPVarnishPurgePostStatus($old, $new, $p) {
$this->WPVarnishPurgePost($p->ID);
}
// WPVarnishPurgePost - Takes a post id (number) as an argument and generates
// the location path to the object that will be purged based on the permalink.
function WPVarnishPurgePost($wpv_postid) {
Expand Down

0 comments on commit 54db2a7

Please sign in to comment.