| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Services\Health_Check; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Config\Migration_Status; |
| 6 |
use Yoast\WP\SEO\Helpers\Options_Helper; |
| 7 |
|
| 8 |
/** |
| 9 |
* Runs the Links_Table health check. |
| 10 |
*/ |
| 11 |
class Links_Table_Runner implements Runner_Interface { |
| 12 |
|
| 13 |
/** |
| 14 |
* Is set to true when the links table is accessible. |
| 15 |
* |
| 16 |
* @var bool |
| 17 |
*/ |
| 18 |
private $links_table_accessible = false; |
| 19 |
|
| 20 |
/** |
| 21 |
* The Migration_Status object used to determine whether the links table is accessible. |
| 22 |
* |
| 23 |
* @var Migration_Status |
| 24 |
*/ |
| 25 |
private $migration_status; |
| 26 |
|
| 27 |
/** |
| 28 |
* The Options_Helper object used to determine whether the health check should run or not. |
| 29 |
* |
| 30 |
* @var Options_Helper |
| 31 |
*/ |
| 32 |
private $options_helper; |
| 33 |
|
| 34 |
/** |
| 35 |
* Constructor. |
| 36 |
* |
| 37 |
* @param Migration_Status $migration_status Object used to determine whether the links table is accessible. |
| 38 |
* @param Options_Helper $options_helper Object used to determine whether the health check should run. |
| 39 |
*/ |
| 40 |
public function __construct( Migration_Status $migration_status, Options_Helper $options_helper ) { |
| 41 |
$this->migration_status = $migration_status; |
| 42 |
$this->options_helper = $options_helper; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Runs the health check. Checks if the tagline is set to WordPress' default tagline, or to its set translation. |
| 47 |
* |
| 48 |
* @return void |
| 49 |
*/ |
| 50 |
public function run() { |
| 51 |
$this->links_table_accessible = $this->migration_status->is_version( 'free', \WPSEO_VERSION ); |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Returns true if the links table is accessible |
| 56 |
* |
| 57 |
* @return bool The boolean indicating if the health check was successful. |
| 58 |
*/ |
| 59 |
public function is_successful() { |
| 60 |
return $this->links_table_accessible; |
| 61 |
} |
| 62 |
} |
| 63 |
|