Skip to content

Redis purge all is not working when WP is installed in separate folder #129

Closed
@pySilver

Description

@pySilver

Hi!

It turns out that redis "purge all" feature won't work for installations where wordpress is installed in a separate folder:

/domain.com
-- /wp # it's where WP lives
-- wp-config.php
-- index.php

The reason is here:
https://github.com/rtCamp/nginx-helper/blob/master/redis-purger.php#L684

if( is_network_admin() ) {
				delete_keys_by_wildcard( $prefix . '*' );
				$this->log( '* Purged Everything! * ' );
			} else { // Else purge only site specific cache
				$parse = wp_parse_url( get_site_url() );
				$parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
				delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
				$this->log( '* ' . get_site_url() . ' Purged! * ' );
			}

Quickfix would be to use:
get_home_url instead of get_site_url

I believe we should change that, since cache urls are constructed against WP_HOME, not WP_SITEURL

or you can just change the query, so it would not contain parsed path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions