Skip to content

Commit

Permalink
cache-flush check: Return early if a match is found
Browse files Browse the repository at this point in the history
We currently scan all the PHP files in the target WP content dir looking
for `wp_cache_flush()` uses, however we are not currently using the
results in a meaninful way so we can just probably return early if the
current check found a match.

If there are plans to list the matched files, we can probably attempt to
use some more performan alternatives (grep if available for example)
which should be likely faster than a PHP based implementation.

See #178
  • Loading branch information
xknown committed Nov 16, 2023
1 parent ad8446b commit d507a3e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inc/checks/class-cache-flush.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public function run() {

foreach ( $iterator as $file ) {
$this->check_file( $file );
if ( ! empty( $this->_matches ) ) {
// we are currently interested whether there's a use of wp_cache_flush() or not.
break;
}
}

if ( empty( $this->_matches ) ) {
Expand Down

0 comments on commit d507a3e

Please sign in to comment.