Ticket #25572: 25572.diff
| File 25572.diff, 1.7 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/includes/class-wp-upgrader.php
1468 1468 class WP_Automatic_Upgrader { 1469 1469 1470 1470 static $upgrade_results = array(); 1471 static $open_basedir_triggered = false; 1471 1472 1472 1473 static function upgrader_disabled() { 1473 1474 // That's a no if you don't want files changes … … 1505 1506 $check_dirs = array_unique( $check_dirs ); 1506 1507 1507 1508 // Search all directories we've found for evidence of version control. 1508 foreach ( $vcs_dirs as $vcs_dir ) { 1509 foreach ( $check_dirs as $check_dir ) { 1509 // If we run into a safe_mode or open_basedir restriction, bail. 1510 ini_set('open_basedir', '/Users/nacin/Sites/develop/build/'); 1511 set_error_handler( array( __CLASS__, 'error_handler' ), E_WARNING ); 1512 foreach ( $check_dirs as $check_dir ) { 1513 foreach ( $vcs_dirs as $vcs_dir ) { 1510 1514 if ( $checkout = is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) 1511 1515 break 2; 1516 if ( self::open_basedir_triggered() ) 1517 break; 1518 1512 1519 } 1513 1520 } 1521 restore_error_handler(); 1514 1522 return apply_filters( 'auto_upgrade_is_vcs_checkout', $checkout, $context ); 1515 1523 } 1516 1524 1525 static function error_handler( $errno, $errstr, $errfile, $errline, $errcontext ) { 1526 if ( 0 === strpos( $errstr, 'is_dir(): open_basedir' ) ) { 1527 self::$open_basedir_triggered = true; 1528 return; 1529 } 1530 return false; 1531 } 1532 1533 static function open_basedir_triggered() { 1534 return self::$open_basedir_triggered; 1535 } 1536 1517 1537 /** 1518 1538 * Tests to see if we should upgrade a specific item, does not test to see if we CAN update the item. 1519 1539 */