Making WordPress.org


Ignore:
Timestamp:
11/23/2016 10:44:15 AM (9 years ago)
Author:
tellyworth
Message:

Plugin directory: append translated postmeta during Jetpack sync if it runs from cron.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r4383 r4406  
    323323
    324324        // When Jetpack syncs, we want to add filters to inject additional metadata for Jetpack, so it syncs for ElasticSearch indexing.
    325         add_action( 'shutdown', array( $this, 'append_meta_for_jetpack' ), 8 );
     325        if ( defined( 'DOING_CRON' ) )
     326            $this->append_meta_for_jetpack();
     327        else
     328            add_action( 'shutdown', array( $this, 'append_meta_for_jetpack' ), 8 );
     329
    326330    }
    327331
     
    684688         * so we can get in first.Fetching the extra meta to inject is expensive, so we only want to do this if a sync
    685689         * is likely.
     690         * As of Jetpack 4.4, sync can also run in a cron job, so filter the meta there too.
    686691         */
    687         if ( class_exists( 'Jetpack' ) && ! empty( \Jetpack::$instance->sync->sync ) ) {
     692        if ( class_exists( 'Jetpack' ) && ( defined( 'DOING_CRON' ) || ! empty( \Jetpack::$instance->sync->sync ) ) ) {
    688693            // Attempt to work around the problem with options cache poisoning from subdomains
    689694            refresh_blog_details();
Note: See TracChangeset for help on using the changeset viewer.