Make WordPress Core

Changeset 25700


Ignore:
Timestamp:
10/06/2013 03:45:09 PM (13 years ago)
Author:
nacin
Message:

Be as sure as possible that WordPress is not under version control when deciding if we should do automatic updates.

see #22704.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-upgrader.php

    r25674 r25700  
    14891489         */
    14901490        static function is_vcs_checkout( $context ) {
    1491                 $stop_dirs = array(
    1492                         ABSPATH,
    1493                         untrailingslashit( $context ),
    1494                 );
    1495                 if ( ! file_exists( ABSPATH . '/wp-config.php' ) ) // wp-config.php up one folder in a deployment situation
    1496                         $stop_dirs[] = dirname( ABSPATH );
    1497 
    1498                 $checkout = false;
    1499                 foreach ( array_unique( $stop_dirs ) as $dir ) {
    1500                         if ( file_exists( $dir . '/.svn' ) || file_exists( $dir . '/.git' ) || file_exists( $dir . '/.hg' ) || file_exists( $dir . '/.bzr' ) ) {
    1501                                 $checkout = true;
    1502                                 break;
     1491                $context_dirs = array( untrailingslashit( $context ) );
     1492                if ( $context !== ABSPATH )
     1493                        $context_dirs[] = untrailingslashit( ABSPATH );
     1494
     1495                $vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' );
     1496                $check_dirs = array();
     1497
     1498                foreach ( $context_dirs as $context_dir ) {
     1499                        // Walk up from $context_dir to the root.
     1500                        do {
     1501                                $check_dirs[] = $context_dir;
     1502                        } while ( $context_dir != dirname( $context_dir ) && $context_dir = dirname( $context_dir ) );
     1503                }
     1504
     1505                $check_dirs = array_unique( $check_dirs );
     1506
     1507                // 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 ) {
     1510                                if ( $checkout = is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) )
     1511                                        break 2;
    15031512                        }
    15041513                }
Note: See TracChangeset for help on using the changeset viewer.