← All changes
|
jetpack_vendor/automattic/jetpack-protect-models/src/class-status-model.php
+74
-41
13.7.2
→
16.3-beta
View file →
| @@ -25,104 +25,136 @@ | ||
| 25 | 25 | */ |
| 26 | 26 | public $last_checked; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * The number of threats. | |
| 29 | + * The current report status. | |
| 30 | 30 | * |
| 31 | - * @var int | |
| 31 | + * @var string in_progress|scheduled|idle|scanning|provisioning|unavailable | |
| 32 | 32 | */ |
| 33 | - public $num_threats; | |
| 33 | + public $status; | |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * The number of plugin threats. | |
| 36 | + * The current reported security threats. | |
| 37 | 37 | * |
| 38 | - * @var int | |
| 38 | + * @since 0.4.0 | |
| 39 | + * | |
| 40 | + * @var array<Threat_Model> | |
| 39 | 41 | */ |
| 40 | - public $num_plugins_threats; | |
| 42 | + public $threats = array(); | |
| 41 | 43 | |
| 42 | 44 | /** |
| 43 | - * The number of theme threats. | |
| 45 | + * List of fixable threat IDs. | |
| 44 | 46 | * |
| 47 | + * @var string[] | |
| 48 | + */ | |
| 49 | + public $fixable_threat_ids = array(); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * Whether the site includes items that have not been checked. | |
| 53 | + * | |
| 54 | + * @var boolean | |
| 55 | + */ | |
| 56 | + public $has_unchecked_items; | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * The estimated percentage of the current scan. | |
| 60 | + * | |
| 45 | 61 | * @var int |
| 46 | 62 | */ |
| 47 | - public $num_themes_threats; | |
| 63 | + public $current_progress; | |
| 48 | 64 | |
| 49 | 65 | /** |
| 50 | - * The current report status. | |
| 66 | + * Whether there was an error loading the status. | |
| 51 | 67 | * |
| 52 | - * @var string in_progress|scheduled|idle|scanning|provisioning|unavailable | |
| 68 | + * @var bool | |
| 53 | 69 | */ |
| 54 | - public $status; | |
| 70 | + public $error = false; | |
| 55 | 71 | |
| 56 | 72 | /** |
| 57 | - * WordPress core status. | |
| 73 | + * The error code thrown when loading the status. | |
| 58 | 74 | * |
| 59 | - * @var object | |
| 75 | + * @var string | |
| 60 | 76 | */ |
| 61 | - public $core; | |
| 77 | + public $error_code; | |
| 62 | 78 | |
| 63 | 79 | /** |
| 64 | - * Status themes. | |
| 80 | + * The error message thrown when loading the status. | |
| 65 | 81 | * |
| 66 | - * @var array<Extension_Model> | |
| 82 | + * @var string | |
| 67 | 83 | */ |
| 68 | - public $themes = array(); | |
| 84 | + public $error_message; | |
| 69 | 85 | |
| 70 | 86 | /** |
| 71 | - * Status plugins. | |
| 87 | + * The number of threats. | |
| 72 | 88 | * |
| 73 | - * @var array<Extension_Model> | |
| 89 | + * @deprecated 0.4.0 This property is deprecated. Count Status_Model::$threats instead. | |
| 90 | + * | |
| 91 | + * @var int | |
| 74 | 92 | */ |
| 75 | - public $plugins = array(); | |
| 93 | + public $num_threats; | |
| 76 | 94 | |
| 77 | 95 | /** |
| 78 | - * File threats. | |
| 96 | + * The number of plugin threats. | |
| 79 | 97 | * |
| 80 | - * @var array<Extension_Model> | |
| 98 | + * @deprecated 0.4.0 This property is deprecated. Filter and count Status_Model::$threats instead. | |
| 99 | + * | |
| 100 | + * @var int | |
| 81 | 101 | */ |
| 82 | - public $files = array(); | |
| 102 | + public $num_plugins_threats; | |
| 83 | 103 | |
| 84 | 104 | /** |
| 85 | - * Database threats. | |
| 105 | + * The number of theme threats. | |
| 86 | 106 | * |
| 87 | - * @var array<Extension_Model> | |
| 107 | + * @deprecated 0.4.0 This property is deprecated. Filter and count Status_Model::$threats instead. | |
| 108 | + * | |
| 109 | + * @var int | |
| 88 | 110 | */ |
| 89 | - public $database = array(); | |
| 111 | + public $num_themes_threats; | |
| 90 | 112 | |
| 91 | 113 | /** |
| 92 | - * Whether the site includes items that have not been checked. | |
| 114 | + * WordPress core status. | |
| 93 | 115 | * |
| 94 | - * @var boolean | |
| 116 | + * @deprecated 0.4.0 This property is deprecated. Filter and use Status_Model::$threats instead. | |
| 117 | + * | |
| 118 | + * @var object | |
| 95 | 119 | */ |
| 96 | - public $has_unchecked_items; | |
| 120 | + public $core; | |
| 97 | 121 | |
| 98 | 122 | /** |
| 99 | - * The estimated percentage of the current scan. | |
| 123 | + * Status themes. | |
| 100 | 124 | * |
| 101 | - * @var int | |
| 125 | + * @deprecated 0.4.0 This property is deprecated. Filter and use Status_Model::$threats instead. | |
| 126 | + * | |
| 127 | + * @var array<Extension_Model> | |
| 102 | 128 | */ |
| 103 | - public $current_progress; | |
| 129 | + public $themes = array(); | |
| 104 | 130 | |
| 105 | 131 | /** |
| 106 | - * Whether there was an error loading the status. | |
| 132 | + * Status plugins. | |
| 107 | 133 | * |
| 108 | - * @var bool | |
| 134 | + * @deprecated 0.4.0 This property is deprecated. Filter and use Status_Model::$threats instead. | |
| 135 | + * | |
| 136 | + * @var array<Extension_Model> | |
| 109 | 137 | */ |
| 110 | - public $error = false; | |
| 138 | + public $plugins = array(); | |
| 111 | 139 | |
| 112 | 140 | /** |
| 113 | - * The error code thrown when loading the status. | |
| 141 | + * File threats. | |
| 114 | 142 | * |
| 115 | - * @var string | |
| 143 | + * @deprecated 0.4.0 This property is deprecated. Filter and use Status_Model::$threats instead. | |
| 144 | + * | |
| 145 | + * @var array<Extension_Model> | |
| 116 | 146 | */ |
| 117 | - public $error_code; | |
| 147 | + public $files = array(); | |
| 118 | 148 | |
| 119 | 149 | /** |
| 120 | - * The error message thrown when loading the status. | |
| 150 | + * Database threats. | |
| 121 | 151 | * |
| 122 | - * @var string | |
| 152 | + * @deprecated 0.4.0 This property is deprecated. Filter and use Status_Model::$threats instead. | |
| 153 | + * | |
| 154 | + * @var array<Extension_Model> | |
| 123 | 155 | */ |
| 124 | - public $error_message; | |
| 156 | + public $database = array(); | |
| 125 | 157 | |
| 126 | 158 | /** |
| 127 | 159 | * Status constructor. |
| 128 | 160 | * |
| @@ -129,8 +161,9 @@ | ||
| 129 | 161 | * @param array $status The status data to load into the class instance. |
| 130 | 162 | */ |
| 131 | 163 | public function __construct( $status = array() ) { |
| 132 | 164 | // set status defaults |
| 165 | + // @phan-suppress-next-line PhanDeprecatedProperty -- Maintaining backwards compatibility. | |
| 133 | 166 | $this->core = new \stdClass(); |
| 134 | 167 | |
| 135 | 168 | foreach ( $status as $property => $value ) { |
| 136 | 169 | if ( property_exists( $this, $property ) ) { |