| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/wordpress-seo/src/actions/indexing/ |
Upload File : |
<?php
namespace Yoast\WP\SEO\Actions\Indexing;
use wpdb;
use Yoast\WP\SEO\Builders\Indexable_Link_Builder;
use Yoast\WP\SEO\Helpers\Indexable_Helper;
use Yoast\WP\SEO\Models\SEO_Links;
use Yoast\WP\SEO\Repositories\Indexable_Repository;
/**
* Reindexing action for link indexables.
*/
abstract class Abstract_Link_Indexing_Action extends Abstract_Indexing_Action {
/**
* The link builder.
*
* @var Indexable_Link_Builder
*/
protected $link_builder;
/**
* The indexable helper.
*
* @var Indexable_Helper
*/
protected $indexable_helper;
/**
* The indexable repository.
*
* @var Indexable_Repository
*/
protected $repository;
/**
* The WordPress database instance.
*
* @var wpdb
*/
protected $wpdb;
/**
* Indexable_Post_Indexing_Action constructor
*
* @param Indexable_Link_Builder $link_builder The indexable link builder.
* @param Indexable_Helper $indexable_helper The indexable repository.
* @param Indexable_Repository $repository The indexable repository.
* @param wpdb $wpdb The WordPress database instance.
*/
public function __construct(
Indexable_Link_Builder $link_builder,
Indexable_Helper $indexable_helper,
Indexable_Repository $repository,
wpdb $wpdb
) {
$this->link_builder = $link_builder;
$this->indexable_helper = $indexable_helper;
$this->repository = $repository;
$this->wpdb = $wpdb;
}
/**
* Builds links for indexables which haven't had their links indexed yet.
*
* @return SEO_Links[] The created SEO links.
*/
public function index() {
$objects = $this->get_objects();
$indexables = [];
foreach ( $objects as $object ) {
$indexable = $this->repository->find_by_id_and_type( $object->id, $object->type );
if ( $indexable ) {
$this->link_builder->build( $indexable, $object->content );
$this->indexable_helper->save_indexable( $indexable );
$indexables[] = $indexable;
}
}
if ( \count( $indexables ) > 0 ) {
\delete_transient( static::UNINDEXED_COUNT_TRANSIENT );
\delete_transient( static::UNINDEXED_LIMITED_COUNT_TRANSIENT );
}
return $indexables;
}
/**
* In the case of term-links and post-links we want to use the total unindexed count, because using
* the limited unindexed count actually leads to worse performance.
*
* @param int|bool $limit Unused.
*
* @return int The total number of unindexed links.
*/
public function get_limited_unindexed_count( $limit = false ) {
return $this->get_total_unindexed();
}
/**
* Returns the number of texts that will be indexed in a single link indexing pass.
*
* @return int The limit.
*/
public function get_limit() {
/**
* Filter 'wpseo_link_indexing_limit' - Allow filtering the number of texts indexed during each link indexing pass.
*
* @param int $limit The maximum number of texts indexed.
*/
return \apply_filters( 'wpseo_link_indexing_limit', 5 );
}
/**
* Returns objects to be indexed.
*
* @return array Objects to be indexed, should be an array of objects with object_id, object_type and content.
*/
abstract protected function get_objects();
}