Server IP : 172.67.157.199 / Your IP : 52.15.48.189 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/wordpress-seo/src/analytics/user-interface/ |
Upload File : |
<?php namespace Yoast\WP\SEO\Analytics\User_Interface; use Yoast\WP\SEO\Conditionals\No_Conditionals; use Yoast\WP\SEO\Helpers\Options_Helper; use Yoast\WP\SEO\Integrations\Integration_Interface; /** * Handles setting a timestamp when the indexation of a specific indexation action is completed. */ class Last_Completed_Indexation_Integration implements Integration_Interface { use No_Conditionals; /** * The options helper. * * @var Options_Helper The options helper. */ private $options_helper; /** * The constructor. * * @param Options_Helper $options_helper The options helper. */ public function __construct( Options_Helper $options_helper ) { $this->options_helper = $options_helper; } /** * Registers action hook to maybe save an option. * * @return void */ public function register_hooks(): void { \add_action( 'wpseo_indexables_unindexed_calculated', [ $this, 'maybe_set_indexables_unindexed_calculated', ], 10, 2 ); } /** * Saves a timestamp option when there are no unindexed indexables. * * @param string $indexable_name The name of the indexable that is being checked. * @param int $count The amount of missing indexables. * * @return void */ public function maybe_set_indexables_unindexed_calculated( string $indexable_name, int $count ): void { if ( $count === 0 ) { $no_index = $this->options_helper->get( 'last_known_no_unindexed', [] ); $no_index[ $indexable_name ] = \time(); $this->options_helper->set( 'last_known_no_unindexed', $no_index ); } } }