Core_Upgrader::check_files()

最后更新于:2021-11-25 19:24:35

Core_Upgrader::check_files()

Compare the disk file checksums against the expected checksums.

响应

(bool) True if the checksums match, otherwise false.

源文件

文件: gc-admin/includes/class-core-upgrader.php

	public function check_files() {
		global $gc_version, $gc_local_package;

		$checksums = get_core_checksums( $gc_version, isset( $gc_local_package ) ? $gc_local_package : 'en_US' );

		if ( ! is_array( $checksums ) ) {
			return false;
		}

		foreach ( $checksums as $file => $checksum ) {
			// Skip files which get updated.
			if ( 'gc-content' === substr( $file, 0, 10 ) ) {
				continue;
			}
			if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) {
				return false;
			}
		}

		return true;
	}