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

see #22704.

Built from https://develop.svn.wordpress.org/trunk@25700


git-svn-id: http://core.svn.wordpress.org/trunk@25615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-06 15:46:09 +00:00
parent 2aff6bb864
commit a8ea7828e9
1 changed files with 20 additions and 11 deletions

View File

@ -1488,18 +1488,27 @@ class WP_Automatic_Upgrader {
* Check for GIT/SVN checkouts. * Check for GIT/SVN checkouts.
*/ */
static function is_vcs_checkout( $context ) { static function is_vcs_checkout( $context ) {
$stop_dirs = array( $context_dirs = array( untrailingslashit( $context ) );
ABSPATH, if ( $context !== ABSPATH )
untrailingslashit( $context ), $context_dirs[] = untrailingslashit( ABSPATH );
);
if ( ! file_exists( ABSPATH . '/wp-config.php' ) ) // wp-config.php up one folder in a deployment situation
$stop_dirs[] = dirname( ABSPATH );
$checkout = false; $vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' );
foreach ( array_unique( $stop_dirs ) as $dir ) { $check_dirs = array();
if ( file_exists( $dir . '/.svn' ) || file_exists( $dir . '/.git' ) || file_exists( $dir . '/.hg' ) || file_exists( $dir . '/.bzr' ) ) {
$checkout = true; foreach ( $context_dirs as $context_dir ) {
break; // Walk up from $context_dir to the root.
do {
$check_dirs[] = $context_dir;
} while ( $context_dir != dirname( $context_dir ) && $context_dir = dirname( $context_dir ) );
}
$check_dirs = array_unique( $check_dirs );
// Search all directories we've found for evidence of version control.
foreach ( $vcs_dirs as $vcs_dir ) {
foreach ( $check_dirs as $check_dir ) {
if ( $checkout = is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) )
break 2;
} }
} }
return apply_filters( 'auto_upgrade_is_vcs_checkout', $checkout, $context ); return apply_filters( 'auto_upgrade_is_vcs_checkout', $checkout, $context );