✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ webm004.cluster127.gra.hosting.ovh.net ​🇻​♯➤ 6.18.42-ovh-vps-grsec-zfs+ #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 54.36.91.62 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.42
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ _dyuweyrj4,_dyuweyrj4r,dl

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/docteuh/www/plugins/wordpress-seo/src/integrations/admin//background-indexing-integration.php
<?php

namespace Yoast\WP\SEO\Integrations\Admin;

use Yoast\WP\SEO\Actions\Indexing\Indexable_Indexing_Complete_Action;
use Yoast\WP\SEO\Actions\Indexing\Indexation_Action_Interface;
use Yoast\WP\SEO\Conditionals\Get_Request_Conditional;
use Yoast\WP\SEO\Conditionals\Migrations_Conditional;
use Yoast\WP\SEO\Conditionals\WP_CRON_Enabled_Conditional;
use Yoast\WP\SEO\Conditionals\Yoast_Admin_And_Dashboard_Conditional;
use Yoast\WP\SEO\Helpers\Indexable_Helper;
use Yoast\WP\SEO\Helpers\Indexing_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;

/**
 * Class Background_Indexing_Integration.
 *
 * @package Yoast\WP\SEO\Integrations\Admin
 */
class Background_Indexing_Integration implements Integration_Interface {

	/**
	 * Represents the indexing completed action.
	 *
	 * @var Indexable_Indexing_Complete_Action
	 */
	protected $complete_indexation_action;

	/**
	 * Represents the indexing helper.
	 *
	 * @var Indexing_Helper
	 */
	protected $indexing_helper;

	/**
	 * An object that checks if we are on the Yoast admin or on the dashboard page.
	 *
	 * @var Yoast_Admin_And_Dashboard_Conditional
	 */
	protected $yoast_admin_and_dashboard_conditional;

	/**
	 * All available indexing actions.
	 *
	 * @var Indexation_Action_Interface[]
	 */
	protected $indexing_actions;

	/**
	 * An object that checks if we are handling a GET request.
	 *
	 * @var Get_Request_Conditional
	 */
	private $get_request_conditional;

	/**
	 * An object that checks if WP_CRON is enabled.
	 *
	 * @var WP_CRON_Enabled_Conditional
	 */
	private $wp_cron_enabled_conditional;

	/**
	 * The indexable helper
	 *
	 * @var Indexable_Helper
	 */
	private $indexable_helper;

	/**
	 * Shutdown_Indexing_Integration constructor.
	 *
	 * @param Indexable_Indexing_Complete_Action    $complete_indexation_action            The complete indexing action.
	 * @param Indexing_Helper                       $indexing_helper                       The indexing helper.
	 * @param Indexable_Helper                      $indexable_helper                      The indexable helper.
	 * @param Yoast_Admin_And_Dashboard_Conditional $yoast_admin_and_dashboard_conditional An object that checks if we are on the Yoast admin or on the dashboard page.
	 * @param Get_Request_Conditional               $get_request_conditional               An object that checks if we are handling a GET request.
	 * @param WP_CRON_Enabled_Conditional           $wp_cron_enabled_conditional           An object that checks if WP_CRON is enabled.
	 * @param Indexation_Action_Interface           ...$indexing_actions                   A list of all available indexing actions.
	 */
	public function __construct(
		Indexable_Indexing_Complete_Action $complete_indexation_action,
		Indexing_Helper $indexing_helper,
		Indexable_Helper $indexable_helper,
		Yoast_Admin_And_Dashboard_Conditional $yoast_admin_and_dashboard_conditional,
		Get_Request_Conditional $get_request_conditional,
		WP_CRON_Enabled_Conditional $wp_cron_enabled_conditional,
		Indexation_Action_Interface ...$indexing_actions
	) {
		$this->indexing_actions                      = $indexing_actions;
		$this->complete_indexation_action            = $complete_indexation_action;
		$this->indexing_helper                       = $indexing_helper;
		$this->indexable_helper                      = $indexable_helper;
		$this->yoast_admin_and_dashboard_conditional = $yoast_admin_and_dashboard_conditional;
		$this->get_request_conditional               = $get_request_conditional;
		$this->wp_cron_enabled_conditional           = $wp_cron_enabled_conditional;
	}

	/**
	 * Returns the conditionals based on which this integration should be active.
	 *
	 * @return array The array of conditionals.
	 */
	public static function get_conditionals() {
		return [
			Migrations_Conditional::class,
		];
	}

	/**
	 * Register hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		\add_action( 'admin_init', [ $this, 'register_shutdown_indexing' ] );
		\add_action( 'wpseo_indexable_index_batch', [ $this, 'index' ] );
		// phpcs:ignore WordPress.WP.CronInterval -- The sniff doesn't understand values with parentheses. https://github.com/WordPress/WordPress-Coding-Standards/issues/2025
		\add_filter( 'cron_schedules', [ $this, 'add_cron_schedule' ] );
		\add_action( 'admin_init', [ $this, 'schedule_cron_indexing' ], 11 );

		$this->add_limit_filters();
	}

	/**
	 * Adds the filters that change the indexing limits.
	 *
	 * @return void
	 */
	public function add_limit_filters() {
		\add_filter( 'wpseo_post_indexation_limit', [ $this, 'throttle_cron_indexing' ] );
		\add_filter( 'wpseo_post_type_archive_indexation_limit', [ $this, 'throttle_cron_indexing' ] );
		\add_filter( 'wpseo_term_indexation_limit', [ $this, 'throttle_cron_indexing' ] );
		\add_filter( 'wpseo_prominent_words_indexation_limit', [ $this, 'throttle_cron_indexing' ] );
		\add_filter( 'wpseo_link_indexing_limit', [ $this, 'throttle_cron_link_indexing' ] );
	}

	/**
	 * Enqueues the required scripts.
	 *
	 * @return void
	 */
	public function register_shutdown_indexing() {
		if ( $this->should_index_on_shutdown( $this->get_shutdown_limit() ) ) {
			$this->register_shutdown_function( 'index' );
		}
	}

	/**
	 * Run a single indexing pass of each indexing action. Intended for use as a shutdown function.
	 *
	 * @return void
	 */
	public function index() {
		if ( \wp_doing_cron() && ! $this->should_index_on_cron() ) {
			$this->unschedule_cron_indexing();

			return;
		}

		foreach ( $this->indexing_actions as $indexation_action ) {
			$indexation_action->index();
		}

		if ( $this->indexing_helper->get_limited_filtered_unindexed_count_background( 1 ) === 0 ) {
			// We set this as complete, even though prominent words might not be complete. But that's the way we always treated that.
			$this->complete_indexation_action->complete();
		}
	}

	/**
	 * Adds the 'Every fifteen minutes' cron schedule to WP-Cron.
	 *
	 * @param array $schedules The existing schedules.
	 *
	 * @return array The schedules containing the fifteen_minutes schedule.
	 */
	public function add_cron_schedule( $schedules ) {
		if ( ! \is_array( $schedules ) ) {
			return $schedules;
		}

		$schedules['fifteen_minutes'] = [
			'interval' => ( 15 * \MINUTE_IN_SECONDS ),
			'display'  => \esc_html__( 'Every fifteen minutes', 'wordpress-seo' ),
		];

		return $schedules;
	}

	/**
	 * Schedule background indexing every 15 minutes if the index isn't already up to date.
	 *
	 * @return void
	 */
	public function schedule_cron_indexing() {
		/**
		 * Filter: 'wpseo_unindexed_count_queries_ran' - Informs whether the expensive unindexed count queries have been ran already.
		 *
		 * @internal
		 *
		 * @param bool $have_queries_ran
		 */
		$have_queries_ran = \apply_filters( 'wpseo_unindexed_count_queries_ran', false );

		if ( ( ! $this->yoast_admin_and_dashboard_conditional->is_met() || ! $this->get_request_conditional->is_met() ) && ! $have_queries_ran ) {
			return;
		}

		if ( ! \wp_next_scheduled( 'wpseo_indexable_index_batch' ) && $this->should_index_on_cron() ) {
			\wp_schedule_event( ( \time() + \HOUR_IN_SECONDS ), 'fifteen_minutes', 'wpseo_indexable_index_batch' );
		}
	}

	/**
	 * Limit cron indexing to 15 indexables per batch instead of 25.
	 *
	 * @param int $indexation_limit The current limit (filter input).
	 *
	 * @return int The new batch limit.
	 */
	public function throttle_cron_indexing( $indexation_limit ) {
		if ( \wp_doing_cron() ) {
			/**
			 * Filter: 'wpseo_cron_indexing_limit_size' - Adds the possibility to limit the number of items that are indexed when in cron action.
			 *
			 * @param int $limit Maximum number of indexables to be indexed per indexing action.
			 */
			return \apply_filters( 'wpseo_cron_indexing_limit_size', 15 );
		}

		return $indexation_limit;
	}

	/**
	 * Limit cron indexing to 3 links per batch instead of 5.
	 *
	 * @param int $link_indexation_limit The current limit (filter input).
	 *
	 * @return int The new batch limit.
	 */
	public function throttle_cron_link_indexing( $link_indexation_limit ) {
		if ( \wp_doing_cron() ) {
			/**
			 * Filter: 'wpseo_cron_link_indexing_limit_size' - Adds the possibility to limit the number of links that are indexed when in cron action.
			 *
			 * @param int $limit Maximum number of link indexables to be indexed per link indexing action.
			 */
			return \apply_filters( 'wpseo_cron_link_indexing_limit_size', 3 );
		}

		return $link_indexation_limit;
	}

	/**
	 * Determine whether cron indexation should be performed.
	 *
	 * @return bool Should cron indexation be performed.
	 */
	protected function should_index_on_cron() {
		if ( ! $this->indexable_helper->should_index_indexables() ) {
			return false;
		}

		// The filter supersedes everything when preventing cron indexation.
		if ( \apply_filters( 'Yoast\WP\SEO\enable_cron_indexing', true ) !== true ) {
			return false;
		}

		return $this->indexing_helper->get_limited_filtered_unindexed_count_background( 1 ) > 0;
	}

	/**
	 * Determine whether background indexation should be performed.
	 *
	 * @param int $shutdown_limit The shutdown limit used to determine whether indexation should be run.
	 *
	 * @return bool Should background indexation be performed.
	 */
	protected function should_index_on_shutdown( $shutdown_limit ) {
		if ( ! $this->yoast_admin_and_dashboard_conditional->is_met() || ! $this->get_request_conditional->is_met() ) {
			return false;
		}

		if ( ! $this->indexable_helper->should_index_indexables() ) {
			return false;
		}

		if ( $this->wp_cron_enabled_conditional->is_met() ) {
			return false;
		}

		$total_unindexed = $this->indexing_helper->get_limited_filtered_unindexed_count_background( $shutdown_limit );
		if ( $total_unindexed === 0 || $total_unindexed > $shutdown_limit ) {
			return false;
		}

		return true;
	}

	/**
	 * Retrieves the shutdown limit. This limit is the amount of indexables that is generated in the background.
	 *
	 * @return int The shutdown limit.
	 */
	protected function get_shutdown_limit() {
		/**
		 * Filter 'wpseo_shutdown_indexation_limit' - Allow filtering the number of objects that can be indexed during shutdown.
		 *
		 * @param int $limit The maximum number of objects indexed.
		 */
		return \apply_filters( 'wpseo_shutdown_indexation_limit', 25 );
	}

	/**
	 * Removes the cron indexing job from the scheduled event queue.
	 *
	 * @return void
	 */
	protected function unschedule_cron_indexing() {
		$scheduled = \wp_next_scheduled( 'wpseo_indexable_index_batch' );
		if ( $scheduled ) {
			\wp_unschedule_event( $scheduled, 'wpseo_indexable_index_batch' );
		}
	}

	/**
	 * Registers a method to be executed on shutdown.
	 * This wrapper mostly exists for making this class more unittestable.
	 *
	 * @param string $method_name The name of the method on the current instance to register.
	 *
	 * @return void
	 */
	protected function register_shutdown_function( $method_name ) {
		\register_shutdown_function( [ $this, $method_name ] );
	}
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
4 Sep 2026 1.58 AM
docteuh / users
0755
addon-installation
--
4 Sep 2026 12.47 AM
docteuh / users
0755
abstract-presenter.php
0.368 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
activation-cleanup-integration.php
1.849 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
admin-columns-cache-integration.php
7.596 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
authentication-failed-exception.php
0.719 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
background-indexing-integration-20260827190703.php
10.753 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
background-indexing-integration.php
10.753 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
brand-insights-page.php
2.132 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
check-required-version.php
4.881 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
class-admin.php
12.73 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
classes-surface.php
0.795 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
cleanup-integration.php
9.717 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
code-generator.php
0.64 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
crawl-settings-integration-20260828025150.php
10.895 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
crawl-settings-integration.php
10.895 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
cron-integration.php
0.979 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
deactivated-premium-integration-20260828003556.php
4.216 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
deactivated-premium-integration.php
4.216 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
diffDOM.js
63.113 KB
20 Nov 2023 7.12 PM
docteuh / users
0644
feature-flag-conditional.php
0.89 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
feature-flag-integration-20260828103046.php
2.932 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
feature-flag-integration.php
2.932 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
first-time-configuration-integration.php
15.179 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
first-time-configuration-notice-integration.php
4.997 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
fix-news-dependencies-integration.php
1.552 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
front-end-integration.php
18.876 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
health-check-integration.php
2.745 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
helpscout-beacon-20260828084447.php
14.32 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
helpscout-beacon.php
14.32 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
howto.php
5.86 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager-20260827125202.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
import-integration-20260828123309.php
8.631 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
import-integration.php
8.631 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
index-command.php
9.929 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
indexables-exclude-taxonomy-integration.php
1.386 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
indexing-notification-integration-20260828131529.php
6.929 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
indexing-notification-integration.php
6.929 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
indexing-tool-integration.php
7.286 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
installation-success-integration.php
4.842 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
integrations-page.php
9.754 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
link-count-columns-integration.php
7.528 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
loadable-interface.php
0.279 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
main.php
1.824 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
menu-badge-integration.php
0.905 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
migration-error-integration-20260828122506.php
1.347 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
migration-error-integration.php
1.347 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
old-configuration-integration.php
1.659 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
redirect-integration.php
2.971 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
redirections-tools-page.php
1.555 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
redirects-page-integration.php
4.461 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
schema-helpers-surface-20260903224450.php
2.85 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
schema-helpers-surface.php
2.85 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
uninstall-integration.php
0.982 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
workouts-integration.php
11.058 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
wp-seo-main.php
17.215 KB
23 Jun 2026 6.20 PM
docteuh / users
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF