Inventory_Presser_Photo_Numberer::save_meta_hash( int $post_id )

save_meta_hash


Description

Saves an MD5 hash checksum of the attachment file bytes in the attachment post meta. This 32 character string can be used for file comparisons while not taxing the server as much as other methods.


Parameters

$post_id

(int) (Required)


Return

(void)


Source

File: includes/class-photo-numberer.php

	 * @return void
	 */
	protected static function save_meta_hash( $post_id ) {
		// Save a md5 hash checksum of the attachment in meta
		$file_path = get_attached_file( $post_id );
		if ( false === $file_path ) {
			return;
		}
		update_post_meta(
			$post_id,
			apply_filters( 'invp_prefix_meta_key', 'hash' ),
			hash_file( 'md5', $file_path )