Full sync configuration for this sync module. * @param int $max_items_to_enqueue Maximum number of items to enqueue. * @param boolean $state True if full sync has finished enqueueing this module, false otherwise. * @return array Number of actions enqueued, and next module state. */ public function enqueue_full_sync_actions( $config, $max_items_to_enqueue, $state ) { global $wpdb; return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_terms', $wpdb->term_taxonomy, 'term_taxonomy_id', $this->get_where_sql( $config ), $max_items_to_enqueue, $state ); } /** * Retrieve the WHERE SQL clause based on the module config. * * @access public * * @param array $config Full sync configuration for this sync module. * @return string WHERE SQL clause, or `null` if no comments are specified in the module config. */ public function get_where_sql( $config ) { $where_sql = Settings::get_blacklisted_taxonomies_sql(); if ( is_array( $config ) ) { $where_sql .= ' AND term_taxonomy_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')'; } return $where_sql; } /** * Retrieve an estimated number of actions that will be enqueued. * * @access public * * @param array $config Full sync configuration for this sync module. * @return int Number of items yet to be enqueued. */ public function estimate_full_sync_actions( $config ) { global $wpdb; $query = "SELECT count(*) FROM $wpdb->term_taxonomy"; $where_sql = $this->get_where_sql( $config ); if ( $where_sql ) { $query .= ' WHERE ' . $where_sql; } // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching $count = (int) $wpdb->get_var( $query ); return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); } /** * Retrieve the actions that will be sent for this module during a full sync. * * @access public * * @return array Full sync actions of this module. */ public function get_full_sync_actions() { return array( 'jetpack_full_sync_terms' ); } /** * Handler for creating and updating terms. * * @access public * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. */ public function save_term_handler( $term_id, $tt_id, $taxonomy ) { if ( class_exists( '\\WP_Term' ) ) { $term_object = \WP_Term::get_instance( $term_id, $taxonomy ); } else { $term_object = get_term_by( 'id', $term_id, $taxonomy ); } $current_filter = current_filter(); if ( 'created_term' === $current_filter ) { /** * Fires when the client needs to add a new term * * @since 1.6.3 * @since-jetpack 5.0.0 * * @param object the Term object */ do_action( 'jetpack_sync_add_term', $term_object ); return; } /** * Fires when the client needs to update a term * * @since 1.6.3 * @since-jetpack 4.2.0 * * @param object the Term object */ do_action( 'jetpack_sync_save_term', $term_object ); } /** * Filter blacklisted taxonomies. * * @access public * * @param array $args Hook args. * @return array|boolean False if not whitelisted, the original hook args otherwise. */ public function filter_blacklisted_taxonomies( $args ) { $term = $args[0]; if ( in_array( $term->taxonomy, Settings::get_setting( 'taxonomies_blacklist' ), true ) ) { return false; } return $args; } /** * Filter out set_object_terms actions where the terms have not changed. * * @param array $args Hook args. * @return array|boolean False if no change in terms, the original hook args otherwise. */ public function filter_set_object_terms_no_update( $args ) { // There is potential for other plugins to modify args, therefore lets validate # of and types. // $args[2] is $tt_ids, $args[5] is $old_tt_ids see wp-includes/taxonomy.php L2740. if ( 6 === count( $args ) && is_array( $args[2] ) && is_array( $args[5] ) ) { if ( empty( array_diff( $args[2], $args[5] ) ) && empty( array_diff( $args[5], $args[2] ) ) ) { return false; } } return $args; } /** * Expand the term taxonomy IDs to terms within a hook before they are serialized and sent to the server. * * @access public * * @param array $args The hook parameters. * @return array $args The expanded hook parameters. */ public function expand_term_taxonomy_id( $args ) { list( $term_taxonomy_ids, $previous_end ) = $args; return array( 'terms' => get_terms( array( 'hide_empty' => false, 'term_taxonomy_id' => $term_taxonomy_ids, 'orderby' => 'term_taxonomy_id', 'order' => 'DESC', ) ), 'previous_end' => $previous_end, ); } /** * Gets a term object based on a given row from the term_relationships database table. * * @access public * * @param object $relationship A row object from the term_relationships table. * @return object|bool A term object, or false if term taxonomy doesn't exist. */ public function expand_terms_for_relationship( $relationship ) { return get_term_by( 'term_taxonomy_id', $relationship->term_taxonomy_id ); } }
Fatal error: Uncaught Error: Class "Automattic\Jetpack\Sync\Modules\Terms" not found in /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php:142 Stack trace: #0 [internal function]: Automattic\Jetpack\Sync\Modules::load_module('Automattic\\Jetp...') #1 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php(126): array_map(Array, Array) #2 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php(67): Automattic\Jetpack\Sync\Modules::initialize_modules() #3 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-listener.php(86): Automattic\Jetpack\Sync\Modules::get_modules() #4 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-listener.php(76): Automattic\Jetpack\Sync\Listener->init() #5 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-listener.php(63): Automattic\Jetpack\Sync\Listener->__construct() #6 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(759): Automattic\Jetpack\Sync\Listener::get_instance() #7 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(146): Automattic\Jetpack\Sync\Actions::initialize_listener() #8 /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-main.php(111): Automattic\Jetpack\Sync\Actions::init() #9 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Main::on_plugins_loaded_late('') #10 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #11 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #12 /htdocs/wp-settings.php(559): do_action('plugins_loaded') #13 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #14 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #15 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #16 /htdocs/index.php(17): require('/htdocs/wp-blog...') #17 {main} thrown in /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php on line 142