Skip to content

Commit

Permalink
Invalidate: Make sure CACHE_DIR exists before writing flags
Browse files Browse the repository at this point in the history
  • Loading branch information
kovshenin committed Apr 19, 2022
1 parent 9f09c29 commit 4549a92
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/invalidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@

$flags = null;
$path = CACHE_DIR . '/flags.json.php';
$mode = file_exists( $path ) ? 'r+' : 'w+';
$exists = file_exists( $path );
$mode = $exists ? 'r+' : 'w+';

// Make sure cache dir exists.
if ( ! $exists && ! wp_mkdir_p( CACHE_DIR ) ) {
return;
}

$f = fopen( $path, $mode );
$length = filesize( $path );

Expand Down

0 comments on commit 4549a92

Please sign in to comment.