Viewing 6 replies - 1 through 6 (of 6 total)
  • Where can I find more information about this VCS-detection? We have some files in git, but not the WordPress files and the fact that some files are in git should not stop updates. I’d like to know the design rationale behind this and challenge it.

    Thread Starter Nicola Peluchetti

    (@nicolapeluchetti)

    I read this article which said:

    If WordPress detects a version control system, it recognizes you know what you are doing and avoids automatic updates of any kind. It looks for Subversion, Git, Mercurial, and Bazaar, and it looks everywhere.

    It works by searching two directories (ABSPATH and whatever you are updating, like WP_PLUGINS_DIR, or WP_LANG_DIR) for VCS directories (.svn, .git, .hg, .bz). And it looks a level up, too — and keeps looking until it reaches the root of the drive. So if you are running a single Subversion checkout at / or /var/www/ or /var/www/mysite.com/, the WordPress install at /var/www/mysite.com/public_html/wordpress/ will be blocked from receiving updates. Clearly, it errs on the site of caution.

    There is a filter, automatic_updates_is_vcs_checkout. If you’d like to use automatic updates anyway, you can just return true through that filter. The filter is also passed the directory it is searching in addition to ABSPATH, so if you wanted to update languages even though you were running a Subversion checkout, this would work:

    Try return false; instead of return true;.

    function ai1ec_vcs( $checkout, $context ) {
            return false;
    }
    add_filter( 'automatic_updates_is_vcs_checkout', 'ai1ec_vcs', 10, 2 );

    The plugin says “vcs detected, but the automatic_updates_is_vcs_checkout filter is allowing updates”.

    Thread Starter Nicola Peluchetti

    (@nicolapeluchetti)

    Yes looking at the code it’s

    public function is_vcs_checkout( $context ) {
    
    		/**
    		 * Filter whether the automatic updater should consider a filesystem location to be potentially
    		 * managed by a version control system.
    		 *
    		 * @since 3.7.0
    		 *
    		 * @param bool $checkout  Whether a VCS checkout was discovered at $context or ABSPATH, or anywhere higher.
    		 * @param string $context The filesystem context (a path) against which filesystem status should be checked.
    		 */
    		return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context );
    	}

    This may be a stupid question, but which file should I put that function in to enable automatic updates?

    functions.php

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Enable automatic updates with vcs’ is closed to new replies.