Core_Upgrader::check_files
Compares the disk file checksums against the expected checksums.
Method of the class: Core_Upgrader{}
No Hooks.
Returns
true|false. True if the checksums match, otherwise false.
Usage
$Core_Upgrader = new Core_Upgrader(); $Core_Upgrader->check_files();
Notes
- Global. String.
$wp_versionThe WordPress version string. - Global. String.
$wp_local_packageLocale code of the package.
Changelog
| Since 3.7.0 | Introduced. |
Core_Upgrader::check_files() Core Upgrader::check files code WP 6.9.1
public function check_files() {
global $wp_version, $wp_local_package;
$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
if ( ! is_array( $checksums ) ) {
return false;
}
foreach ( $checksums as $file => $checksum ) {
// Skip files which get updated.
if ( str_starts_with( $file, 'wp-content' ) ) {
continue;
}
if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) {
return false;
}
}
return true;
}