← All changes
|
src/actions/importing/deactivate-conflicting-plugins-action.php
+22
-18
18.2
→
trunk
View file →
| @@ -1,24 +1,22 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Yoast\WP\SEO\Actions\Importing; |
| 4 | 4 | |
| 5 | -use wpdb; | |
| 6 | -use Yoast\WP\SEO\Conditionals\AIOSEO_V4_Importer_Conditional; | |
| 5 | +use Yoast\WP\SEO\Conditionals\Updated_Importer_Framework_Conditional; | |
| 7 | 6 | use Yoast\WP\SEO\Config\Conflicting_Plugins; |
| 7 | +use Yoast\WP\SEO\Helpers\Import_Cursor_Helper; | |
| 8 | 8 | use Yoast\WP\SEO\Helpers\Options_Helper; |
| 9 | 9 | use Yoast\WP\SEO\Helpers\Sanitization_Helper; |
| 10 | -use Yoast\WP\SEO\Services\Importing\Aioseo_Replacevar_Handler; | |
| 11 | -use Yoast\WP\SEO\Services\Importing\Aioseo_Robots_Provider_Service; | |
| 12 | -use Yoast\WP\SEO\Services\Importing\Aioseo_Robots_Transformer_Service; | |
| 10 | +use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Replacevar_Service; | |
| 11 | +use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Robots_Provider_Service; | |
| 12 | +use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Robots_Transformer_Service; | |
| 13 | 13 | use Yoast\WP\SEO\Services\Importing\Conflicting_Plugins_Service; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Deactivates plug-ins that cause conflicts with Yoast SEO. |
| 17 | - * | |
| 18 | - * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded | |
| 19 | 17 | */ |
| 20 | -class Deactivate_Conflicting_Plugins_Action extends Abstract_Importing_Action { | |
| 18 | +class Deactivate_Conflicting_Plugins_Action extends Abstract_Aioseo_Importing_Action { | |
| 21 | 19 | |
| 22 | 20 | /** |
| 23 | 21 | * The plugin the class deals with. |
| 24 | 22 | * |
| @@ -23,9 +21,9 @@ | ||
| 23 | 21 | * The plugin the class deals with. |
| 24 | 22 | * |
| 25 | 23 | * @var string |
| 26 | 24 | */ |
| 27 | - const PLUGIN = 'conflicting-plugins'; | |
| 25 | + public const PLUGIN = 'conflicting-plugins'; | |
| 28 | 26 | |
| 29 | 27 | /** |
| 30 | 28 | * The type the class deals with. |
| 31 | 29 | * |
| @@ -30,14 +28,14 @@ | ||
| 30 | 28 | * The type the class deals with. |
| 31 | 29 | * |
| 32 | 30 | * @var string |
| 33 | 31 | */ |
| 34 | - const TYPE = 'deactivation'; | |
| 32 | + public const TYPE = 'deactivation'; | |
| 35 | 33 | |
| 36 | 34 | /** |
| 37 | 35 | * The replacevar handler. |
| 38 | 36 | * |
| 39 | - * @var Aioseo_Replacevar_Handler | |
| 37 | + * @var Aioseo_Replacevar_Service | |
| 40 | 38 | */ |
| 41 | 39 | protected $replacevar_handler; |
| 42 | 40 | |
| 43 | 41 | /** |
| @@ -56,24 +54,26 @@ | ||
| 56 | 54 | |
| 57 | 55 | /** |
| 58 | 56 | * Class constructor. |
| 59 | 57 | * |
| 58 | + * @param Import_Cursor_Helper $import_cursor The import cursor helper. | |
| 60 | 59 | * @param Options_Helper $options The options helper. |
| 61 | 60 | * @param Sanitization_Helper $sanitization The sanitization helper. |
| 62 | - * @param Aioseo_Replacevar_Handler $replacevar_handler The replacevar handler. | |
| 61 | + * @param Aioseo_Replacevar_Service $replacevar_handler The replacevar handler. | |
| 63 | 62 | * @param Aioseo_Robots_Provider_Service $robots_provider The robots provider service. |
| 64 | 63 | * @param Aioseo_Robots_Transformer_Service $robots_transformer The robots transfomer service. |
| 65 | 64 | * @param Conflicting_Plugins_Service $conflicting_plugins_service The Conflicting plugins Service. |
| 66 | 65 | */ |
| 67 | 66 | public function __construct( |
| 67 | + Import_Cursor_Helper $import_cursor, | |
| 68 | 68 | Options_Helper $options, |
| 69 | 69 | Sanitization_Helper $sanitization, |
| 70 | - Aioseo_Replacevar_Handler $replacevar_handler, | |
| 70 | + Aioseo_Replacevar_Service $replacevar_handler, | |
| 71 | 71 | Aioseo_Robots_Provider_Service $robots_provider, |
| 72 | 72 | Aioseo_Robots_Transformer_Service $robots_transformer, |
| 73 | 73 | Conflicting_Plugins_Service $conflicting_plugins_service |
| 74 | 74 | ) { |
| 75 | - parent::__construct( $options, $sanitization, $replacevar_handler, $robots_provider, $robots_transformer ); | |
| 75 | + parent::__construct( $import_cursor, $options, $sanitization, $replacevar_handler, $robots_provider, $robots_transformer ); | |
| 76 | 76 | |
| 77 | 77 | $this->conflicting_plugins = $conflicting_plugins_service; |
| 78 | 78 | $this->detected_plugins = []; |
| 79 | 79 | } |
| @@ -79,8 +79,10 @@ | ||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Get the total number of conflicting plugins. |
| 83 | + * | |
| 84 | + * @return int | |
| 83 | 85 | */ |
| 84 | 86 | public function get_total_unindexed() { |
| 85 | 87 | return \count( $this->get_detected_plugins() ); |
| 86 | 88 | } |
| @@ -85,20 +87,22 @@ | ||
| 85 | 87 | return \count( $this->get_detected_plugins() ); |
| 86 | 88 | } |
| 87 | 89 | |
| 88 | 90 | /** |
| 89 | - * Returns whether the AISOEO post importing action is enabled. | |
| 91 | + * Returns whether the updated importer framework is enabled. | |
| 90 | 92 | * |
| 91 | - * @return bool True if the AISOEO post importing action is enabled. | |
| 93 | + * @return bool True if the updated importer framework is enabled. | |
| 92 | 94 | */ |
| 93 | 95 | public function is_enabled() { |
| 94 | - $aioseo_importer_conditional = \YoastSEO()->classes->get( AIOSEO_V4_Importer_Conditional::class ); | |
| 96 | + $updated_importer_framework_conditional = \YoastSEO()->classes->get( Updated_Importer_Framework_Conditional::class ); | |
| 95 | 97 | |
| 96 | - return $aioseo_importer_conditional->is_met(); | |
| 98 | + return $updated_importer_framework_conditional->is_met(); | |
| 97 | 99 | } |
| 98 | 100 | |
| 99 | 101 | /** |
| 100 | 102 | * Deactivate conflicting plugins. |
| 103 | + * | |
| 104 | + * @return array | |
| 101 | 105 | */ |
| 102 | 106 | public function index() { |
| 103 | 107 | $detected_plugins = $this->get_detected_plugins(); |
| 104 | 108 | $this->conflicting_plugins->deactivate_conflicting_plugins( $detected_plugins ); |