
/wp-includes/functions.phpwp_unique_filename functionfunctions.php file, find the body of the function wp_unique_filename , there is the line $filename = sanitize_file_name($filename); and joyfully rule her!$filename = crc32(md5(microtime()).sanitize_file_name($filename))."_".sanitize_file_name($filename);$filename = md5(microtime().sanitize_file_name($filename))."_".sanitize_file_name($filename);$filename = crc32("blablabla".microtime().sanitize_file_name($filename))."_".sanitize_file_name($filename);$filename = any soul suitable php hashes and something random .sanitize_file_name($filename);microtime() - performs the role of PRNG, giving the current server time.wp_unique_filename , only adding our garbage to the beginning of the file.CRC32( elf magic )."_".sanitize_file_name($filename); option for myself )."_".sanitize_file_name($filename); , because the CRC32 does not disfigure the file (name) externally, adding a little tsyferek / bukovok, making the β random_file_names.png β into the digestible β 255298064_random_file_names.png β, which is more ae812e87bbbf3a068807fe763721c38a_random_file_names.png eye than β ae812e87bbbf3a068807fe763721c38a_random_file_names.png , which is more ae812e87bbbf3a068807fe763721c38a_random_file_names.png eye than theβ ae812e87bbbf3a068807fe763721c38a_random_file_names.png , which is more ae812e87bbbf3a068807fe763721c38a_random_file_names.png eye than the β ae812e87bbbf3a068807fe763721c38a_random_file_names.png , which is more ae812e87bbbf3a068807fe763721c38a_random_file_names.png eye than the

$filename = sanitize_file_name($filename); and replace it with the one you $filename = crc32(md5(microtime()).sanitize_file_name($filename))."_".sanitize_file_name($filename); (in the example, this is $filename = crc32(md5(microtime()).sanitize_file_name($filename))."_".sanitize_file_name($filename); ).functions.php.diff following content in the /wp-includes folder--- functions.php.orig 2015-04-20 06: 39: 25.000000000 +0000 +++ functions.php.new 2015-05-04 17: 45: 27.000000000 +0000 @@ -1 +1 @@ - $ filename = sanitize_file_name ($ filename); + $ filename = crc32 (md5 (mt_rand (). microtime ()). sanitize_file_name ($ filename)). "_". sanitize_file_name ($ filename);
--- old.php 2015-05-06 10: 39: 17.847753325 +0000 +++ new.php 2015-05-06 10: 39: 31.459794157 +0000 @@ -1 +1,2 @@ - $ filename = sanitize_file_name ($ filename); + $ filename = sanitize_file_name ($ filename); + $ filename = pathinfo ($ filename, PATHINFO_FILENAME) .'_ '. crc32 (md5 (mt_rand (). microtime ()). sanitize_file_name ($ filename)). (pathinfo ($ filename, PATHINFO_EXTENSION)?'. '. pathinfo ($ filename, PATHINFO_EXTENSION): '');
patch --dry-run functions.php -i functions.php.diffchecking file functions.php Hunk # 1 succeeded at 1862 (offset 1861 lines).
patch functions.php -i functions.php.diffpatching file functions.php Hunk # 1 succeeded at 1862 (offset 1861 lines).
functions.php.orig ".crc32 you can use a hash function, the values ββof which can be truncated due to bulkiness. Due to personal preference, numbers from crc32 were left.mt_rand() and a shorter suffix version proposed by maximw .Source: https://habr.com/ru/post/257239/
All Articles