File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -672,12 +672,22 @@ function purge_on_check_ajax_referer( $action, $result )
672672 function true_purge_all ()
673673 {
674674 global $ rt_wp_nginx_helper ;
675- $ prefix = substr ($ rt_wp_nginx_helper ->options ['redis_prefix ' ],0 , -1 );
676- $ this ->log ( "* * * * * " );
677- $ this ->log ( "* Purged Everything! " );
678- $ this ->log ( "* * * * * " );
679- //delete_multi_keys("*");
680- delete_keys_by_wildcard ($ prefix ."* " );
675+ $ prefix = trim ( $ rt_wp_nginx_helper ->options ['redis_prefix ' ] );
676+
677+ $ this ->log ( '* * * * * ' );
678+
679+ // If Purge Cache link click from network admin then purge all
680+ if ( is_network_admin () ) {
681+ delete_keys_by_wildcard ( $ prefix . '* ' );
682+ $ this ->log ( '* Purged Everything! * ' );
683+ } else { // Else purge only site specific cache
684+ $ parse = wp_parse_url ( get_site_url () );
685+ $ parse ['path ' ] = empty ( $ parse ['path ' ] ) ? '/ ' : $ parse ['path ' ];
686+ delete_keys_by_wildcard ( $ prefix . $ parse ['scheme ' ] . 'GET ' . $ parse ['host ' ] . $ parse ['path ' ] . '* ' );
687+ $ this ->log ( '* ' . get_site_url () . ' Purged! * ' );
688+ }
689+
690+ $ this ->log ( '* * * * * ' );
681691 }
682692
683693 function purge_urls ()
@@ -717,7 +727,7 @@ function purge_urls()
717727 }
718728 }
719729 }
720- }
730+ }
721731 }
722732
723733 }
You can’t perform that action at this time.
0 commit comments