Skip to content

Commit 0b612b3

Browse files
committed
Fix cron-run.txt warning
1 parent 76e1580 commit 0b612b3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

php/cron/class-lock-file.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ class Lock_File {
3333
*/
3434
public function get_lock_file( $file = null ) {
3535
$lock_file = $this->get_lock_file_name( $file );
36-
$data = file_get_contents( $lock_file ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown
36+
37+
if ( ! file_exists( $lock_file ) ) {
38+
return '';
39+
}
40+
41+
$data = file_get_contents( $lock_file ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown
42+
3743
if ( false !== strpos( $data, '[' ) ) {
3844
$data = json_decode( $data, true );
3945
}
@@ -106,5 +112,4 @@ public function delete_lock_file( $file = null ) {
106112
$file = $this->get_lock_file_name( $file );
107113
wp_delete_file( $file );
108114
}
109-
110115
}

0 commit comments

Comments
 (0)