Ticket #12144: 12144.diff

File 12144.diff, 2.0 KB (added by nacin, 3 years ago)
Line 
1Index: wp-includes/functions.php
2===================================================================
3--- wp-includes/functions.php   (revision 12982)
4+++ wp-includes/functions.php   (working copy)
5@@ -673,17 +673,17 @@
6        if ( $_wp_using_ext_object_cache ) {
7                $value = wp_cache_get($transient, 'transient');
8        } else {
9-               if ( ! defined( 'WP_INSTALLING' ) ) {
10-                       $transient_option = '_transient_' . esc_sql($transient);
11-                       // If option is not in alloptions, it is not autoloaded and thus has a timeout
12-                       $alloptions = wp_load_alloptions();
13-                       if ( !isset( $alloptions[$transient_option] ) ) {
14-                               $transient_timeout = '_transient_timeout_' . esc_sql($transient);
15-                               if ( get_option($transient_timeout) < time() ) {
16-                                       delete_option($transient_option);
17-                                       delete_option($transient_timeout);
18-                                       return false;
19-                               }
20+               if ( defined( 'WP_INSTALLING' ) )
21+                       return false;
22+               $transient_option = '_transient_' . esc_sql($transient);
23+               // If option is not in alloptions, it is not autoloaded and thus has a timeout
24+               $alloptions = wp_load_alloptions();
25+               if ( !isset( $alloptions[$transient_option] ) ) {
26+                       $transient_timeout = '_transient_timeout_' . esc_sql($transient);
27+                       if ( get_option($transient_timeout) < time() ) {
28+                               delete_option($transient_option);
29+                               delete_option($transient_timeout);
30+                               return false;
31                        }
32                }
33 
34Index: wp-includes/pluggable.php
35===================================================================
36--- wp-includes/pluggable.php   (revision 12982)
37+++ wp-includes/pluggable.php   (working copy)
38@@ -1492,11 +1492,10 @@
39 function wp_rand( $min = 0, $max = 0 ) {
40        global $rnd_value;
41 
42-       $seed = get_transient('random_seed');
43-
44        // Reset $rnd_value after 14 uses
45        // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
46        if ( strlen($rnd_value) < 8 ) {
47+               $seed = get_transient('random_seed');
48                $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
49                $rnd_value .= sha1($rnd_value);
50                $rnd_value .= sha1($rnd_value . $seed);