Skip to content

Commit

Permalink
Move this check up to avoid more expensive checks
Browse files Browse the repository at this point in the history
  • Loading branch information
donnchawp committed Feb 9, 2017
1 parent 14b6ab1 commit 7b474ad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wp-cache-phase2.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ function wpcache_do_rebuild( $dir ) {
global $do_rebuild_list, $cache_path;

$dir = trailingslashit( realpath( $dir ) );

if ( isset( $do_rebuild_list[ $dir ] ) )
return false;

$protected = array( $cache_path, $cache_path . "blogs/", get_supercache_dir() );
foreach( $protected as $id => $directory ) {
$protected[ $id ] = trailingslashit( realpath( $directory ) );
Expand All @@ -90,9 +94,6 @@ function wpcache_do_rebuild( $dir ) {
if ( in_array( $dir, $protected ) )
return false;

if ( isset( $do_rebuild_list[ $dir ] ) )
return false;

if ( is_dir( $dir ) && $dh = @opendir( $dir ) ) {
while ( ( $file = readdir( $dh ) ) !== false ) {
if ( $file != '.' && $file != '..' && is_file( $dir . $file ) ) {
Expand Down

0 comments on commit 7b474ad

Please sign in to comment.