• Resolved Compute

    (@compute)


    First: Do you accept merge requests anywhere?

    Second: Would it be possible for you to let plugins purge urls on shutdown, event if varnish-http-purge is not purging anything. In code this would mean:

    public function executePurge() {
    		$purgeUrls = array_unique($this->purgeUrls);
    		...

    To:

    public function executePurge() {
    		$purgeUrls = array_unique(apply_filters('vhp_execute_purge_urls', $this->purgeUrls));
    		...

    It would be a nice method for us plugin authors to purge our urls from this plugin ??

    https://www.ads-software.com/plugins/varnish-http-purge/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Thread Starter Compute

    (@compute)

    True, but only on getRegisterEvents actions ??

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Would it be possible for you to let plugins purge urls on shutdown, event if varnish-http-purge is not purging anything.

    I think I’m not sure why you’re asking this… It SOUNDS like you’re saying that if the plugin’s not running, you want to force it to run?

    Or are you saying you want to add new events to cause a purge?

    Thread Starter Compute

    (@compute)

    New events that would cause the plugin to purge. For instance, when I update something (mayeb a setting), I would like to purge some URL.
    This could be done if execute purge had a filter for the execute purge urls, as it is run on every shutdown.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    What kind of events are we talking? What is the actual, right now, real world reason you want this?

    Purging the whole cache can be expensive, which is why the plugin doesn’t do that unless you trigger VERY specific things.

    Also I don’t know what you mean by ‘every shutdown’ — there’s no shutdown on WordPress.

    Thread Starter Compute

    (@compute)

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Thank you for the links, now I know you’re talking about PHP Shutdown. Language is tricky sometimes and I’ve had people say that and mean other things :/

    But back to the other end of the question: What kind of events are we talking? What is the actual, right now, real world reason you want this?

    Thread Starter Compute

    (@compute)

    Well. For instance on my site. When a new post is updated, a special page with a custom template should get purged, as its using data from all newest posts.

    There are no way for this plugin to know that my setup works like that, but if I had a filter for the $purgeUrls I could purge my special page, whenever a post is updated.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    But that IS what I added.

    // Filter to add or remove urls to the array of purged urls
    	        // @param array $purgeUrls the urls (paths) to be purged
    	        // @param int $postId the id of the new/edited post
    	        $this->purgeUrls = apply_filters( 'vhp_purge_urls', $this->purgeUrls, $postId );

    Seriously. You have a special page with a special template? Okay, add the post ID of that page to the purge URLs you use and it’ll be included in the purge when pages are updated.

    You’re telling me “I need to trigger on an action” but the example is “When I update a page, I need this OTHER page to purge.” So just add the page to the page URLs and have it purge ‘normally’ ??

    Thread Starter Compute

    (@compute)

    Oh yeah there is already events for that.

    But so lets say I have an option that will change the behavior on a certain page. Or the widgets on the frontpage have been updated. Then I’m left with purging manual whenever any of these settings are updated.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I should preface this by noting that I’ve read Pippin’s article on filters https://code.tutsplus.com/tutorials/writing-extensible-plugins-with-actions-and-filters–wp-26759 but I’m not as well versed in them as I could be.

    Or the widgets on the frontpage have been updated.

    And that is what I mean when I asked you for what kind of events are you talking about ??

    I really feel it’s important to understand the thought process down the line for the code changes people want. If I can’t understand intent, then the odds of me getting it all correct for what and why you want it are pretty slim.

    We’re talking about purging a specific page on a specific event.

    I’m a little confused how this works

    $purgeUrls = array_unique(apply_filters('vhp_execute_purge_urls', $this->purgeUrls));

    Isn’t that just filtering the values of $this->purgeUrls ? Which is the same thing as adding in a post ID with the extant filter?

    Thread Starter Compute

    (@compute)

    Sorry I haven’t had the time to answer this. I think I’ll do a merge request with a better explanation instead of this “quickfix” question I started with.

    Thanks ??

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Thank you for being patient ?? I appreciate it! I can’t know everything, but I love learning new things ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Filter purgeurls’ is closed to new replies.