WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Site_Health_Auto_Updates::test_vcs_abspath() public WP 5.2.0

Check if WordPress is controlled by a VCS (Git, Subversion etc).

Это метод класса: WP_Site_Health_Auto_Updates{}

Хуки из метода
Возвращает

Массив. The test results.

Использование

$WP_Site_Health_Auto_Updates = new WP_Site_Health_Auto_Updates();
$WP_Site_Health_Auto_Updates->test_vcs_abspath();

Список изменений

С версии 5.2.0 Введена.

Код WP_Site_Health_Auto_Updates::test_vcs_abspath() WP 5.5.1

wp-admin/includes/class-wp-site-health-auto-updates.php
<?php
public function test_vcs_abspath() {
	$context_dirs = array( ABSPATH );
	$vcs_dirs     = array( '.svn', '.git', '.hg', '.bzr' );
	$check_dirs   = array();

	foreach ( $context_dirs as $context_dir ) {
		// Walk up from $context_dir to the root.
		do {
			$check_dirs[] = $context_dir;

			// Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
			if ( dirname( $context_dir ) === $context_dir ) {
				break;
			}

			// Continue one level at a time.
		} while ( $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 ) {
			// phpcs:ignore
			if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) {
				break 2;
			}
		}
	}

	/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
	if ( $checkout && ! apply_filters( 'automatic_updates_is_vcs_checkout', true, ABSPATH ) ) {
		return array(
			'description' => sprintf(
				/* translators: 1: Folder name. 2: Version control directory. 3: Filter name. */
				__( 'The folder %1$s was detected as being under version control (%2$s), but the %3$s filter is allowing updates.' ),
				'<code>' . $check_dir . '</code>',
				"<code>$vcs_dir</code>",
				'<code>automatic_updates_is_vcs_checkout</code>'
			),
			'severity'    => 'info',
		);
	}

	if ( $checkout ) {
		return array(
			'description' => sprintf(
				/* translators: 1: Folder name. 2: Version control directory. */
				__( 'The folder %1$s was detected as being under version control (%2$s).' ),
				'<code>' . $check_dir . '</code>',
				"<code>$vcs_dir</code>"
			),
			'severity'    => 'warning',
		);
	}

	return array(
		'description' => __( 'No version control systems were detected.' ),
		'severity'    => 'pass',
	);
}