HEX
Server:
System: Linux aac286ea486c 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 08:51:45 EDT 2026 x86_64
User: root (0)
PHP: 8.2.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,disk_free_space,diskfreespace
Upload Files
File: /dom877180/wp-content/plugins/wordpress-seo-premium/admin/class-meta-table-accessible.php
<?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the state of the table being accessible.
 */
class WPSEO_Meta_Table_Accessible {

	/**
	 * Indicates that the table is accessible.
	 *
	 * @var string
	 */
	const ACCESSIBLE = '0';

	/**
	 * Indicates that the table is inaccessible.
	 *
	 * @var string
	 */
	const INACCESSBILE = '1';

	/**
	 * Checks if the given table name exists.
	 *
	 * @return bool True when table is accessible.
	 */
	public static function is_accessible() {
		$value = get_transient( self::transient_name() );

		// If the value is not set, check the table.
		if ( false === $value ) {
			return self::check_table();
		}

		return $value === self::ACCESSIBLE;
	}

	/**
	 * Sets the transient value to 1, to indicate the table is not accessible.
	 *
	 * @return void
	 */
	public static function set_inaccessible() {
		set_transient( self::transient_name(), self::INACCESSBILE, HOUR_IN_SECONDS );
	}

	/**
	 * Removes the transient.
	 *
	 * @return void
	 */
	public static function cleanup() {
		delete_transient( self::transient_name() );
	}

	/**
	 * Sets the transient value to 0, to indicate the table is accessible.
	 *
	 * @return void
	 */
	protected static function set_accessible() {
		/*
		 * Prefer to set a 0 timeout, but if the timeout was set before WordPress will not delete the transient
		 * correctly when overridden with a zero value.
		 *
		 * Setting a YEAR_IN_SECONDS instead.
		 */
		set_transient( self::transient_name(), self::ACCESSIBLE, YEAR_IN_SECONDS );
	}

	/**
	 * Checks if the table exists if not, set the transient to indicate the inaccessible table.
	 *
	 * @return bool True if table is accessible.
	 */
	protected static function check_table() {
		global $wpdb;

		$storage = new WPSEO_Meta_Storage();
		$query   = $wpdb->prepare( 'SHOW TABLES LIKE %s', $storage->get_table_name() );
		if ( $wpdb->get_var( $query ) !== $storage->get_table_name() ) {
			self::set_inaccessible();
			return false;
		}

		self::set_accessible();
		return true;
	}

	/**
	 * Returns the name of the transient.
	 *
	 * @return string The name of the transient to use.
	 */
	protected static function transient_name() {
		return 'wpseo_meta_table_inaccessible';
	}
}