Ticket #7391: 7391.r8561.2.6.diff

File 7391.r8561.2.6.diff, 2.0 KB (added by santosj, 5 years ago)

Set include path in wp-settings for 2.6 r8561

Line 
1Index: wp-includes/pluggable.php
2===================================================================
3--- wp-includes/pluggable.php   (revision 8561)
4+++ wp-includes/pluggable.php   (working copy)
5@@ -1509,13 +1509,12 @@
6  * @return string Empty string if strings are equivalent or HTML with differences.
7  */
8 function wp_text_diff( $left_string, $right_string, $args = null ) {
9+       if ( defined( 'WP_INCLUDE_PATH_DISABLED' ) )
10+               return '';
11+
12        $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' );
13        $args = wp_parse_args( $args, $defaults );
14 
15-       // PEAR Text_Diff is lame; it includes things from include_path rather than it's own path.
16-       // Not sure of the ramifications of disttributing modified code.
17-       ini_set('include_path', '.' . PATH_SEPARATOR . ABSPATH . WPINC );
18-
19        if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) )
20                require( ABSPATH . WPINC . '/wp-diff.php' );
21 
22@@ -1534,8 +1533,6 @@
23        $renderer  = new WP_Text_Diff_Renderer_Table();
24        $diff = $renderer->render($text_diff);
25 
26-       ini_restore('include_path');
27-
28        if ( !$diff )
29                return '';
30 
31Index: wp-settings.php
32===================================================================
33--- wp-settings.php     (revision 8561)
34+++ wp-settings.php     (working copy)
35@@ -182,6 +182,20 @@
36  */
37 define('WPINC', 'wp-includes');
38 
39+if ( constant('WP_POST_REVISIONS') ) {
40+       /*
41+        * PEAR Text_Diff depends on the include path matching its directory
42+        * structure. This prevents modifying source code and maintaining the
43+        * modifications when the package is updated.
44+        */
45+       if ( function_exists( 'set_include_path' ) )
46+               set_include_path( get_include_path() . PATH_SEPARATOR . ABSPATH . WPINC );
47+       else if ( function_exists( 'ini_set' ) )
48+               ini_set( 'include_path',  ini_get('include_path') . PATH_SEPARATOR . ABSPATH . WPINC );
49+       else
50+               define('WP_INCLUDE_PATH_DISABLED', true);
51+}
52+
53 if ( !defined('WP_LANG_DIR') ) {
54        /**
55         * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR