-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathCache_File_Cleaner_Generic_HardDelete.php
More file actions
46 lines (43 loc) · 1.08 KB
/
Copy pathCache_File_Cleaner_Generic_HardDelete.php
File metadata and controls
46 lines (43 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* File: Cache_File_Cleaner_Generic_HardDelete.php
*
* @package W3TC
*/
namespace W3TC;
/**
* Class Cache_File_Cleaner_Generic_HardDelete
*
* phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found
* phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
* phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
* phpcs:disable WordPress.WP.AlternativeFunctions.unlink_unlink
*/
class Cache_File_Cleaner_Generic_HardDelete extends Cache_File_Cleaner_Generic {
/**
* Constructor
*
* @param Config $w3tc_config Config.
*
* @return void
*/
public function __construct( $w3tc_config = array() ) {
parent::__construct( $w3tc_config );
}
/**
* Clean file
*
* @param string $w3tc_entry Entry.
* @param string $full_path Full path.
*
* @return void
*/
public function _clean_file( $w3tc_entry, $full_path ) {
if ( substr( $w3tc_entry, -4 ) === '_old' && ! $this->is_old_file_valid( $full_path ) ) {
++$this->processed_count;
@unlink( $full_path );
} elseif ( ! $this->is_valid( $full_path ) ) {
@unlink( $full_path );
}
}
}