PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 3.3.1
WP STAGING – WordPress Backup, Restore, Migration & Clone v3.3.1
4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Framework / Database / ExcludedTables.php
wp-staging / Framework / Database Last commit date
QueryBuilder 2 years ago DbInfo.php 2 years ago ExcludedTables.php 4 years ago OptionPreservationHandler.php 2 years ago SearchReplace.php 2 years ago SelectedTables.php 2 years ago TableDto.php 5 years ago TableService.php 2 years ago TablesRenamer.php 2 years ago WpDbInfo.php 2 years ago iDbInfo.php 2 years ago
ExcludedTables.php
99 lines
1 <?php
2
3 namespace WPStaging\Framework\Database;
4
5 use WPStaging\Framework\BackgroundProcessing\Queue;
6
7 /**
8 * Provide list of table excluded from Database Copy and SearchReplace Job
9 */
10 class ExcludedTables
11 {
12 /**
13 * @var string
14 */
15 const CLONE_DATABASE_TABLES_EXCLUDE_FILTER = 'wpstg_clone_database_tables_exclude';
16
17 /**
18 * @var string
19 */
20 const CLONE_SEARCH_REPLACE_TABLES_EXCLUDE_FILTER = 'wpstg_clone_searchreplace_tables_exclude';
21
22 /**
23 * @var string
24 */
25 const SEARCH_REPLACE_TABLES_EXCLUDE_FILTER = 'wpstg_searchreplace_excl_tables';
26
27 /**
28 * @var array
29 */
30 private $excludedTables;
31
32 /**
33 * @var array
34 */
35 private $networkExcludedTables;
36
37 /**
38 * @var array
39 */
40 private $excludedTablesSearchReplaceOnly;
41
42 public function __construct()
43 {
44 $this->excludedTables = [
45 Queue::getTableName(),
46 ];
47
48 $this->networkExcludedTables = [
49 'blogs',
50 'blog_version',
51 ];
52
53 $this->excludedTablesSearchReplaceOnly = [
54 '_cerber_files', // Cerber Security Plugin
55 '_cerber_sets', // Cerber Security Plugin
56 ];
57 }
58
59 /**
60 * Get List of excluded tables for database copy
61 *
62 * @return array
63 */
64 public function getExcludedTables($networkClone = false)
65 {
66 $excludedCustomTables = apply_filters(self::CLONE_DATABASE_TABLES_EXCLUDE_FILTER, []);
67
68 if ($networkClone) {
69 return array_merge($this->excludedTables, $excludedCustomTables);
70 }
71
72 return array_merge($this->excludedTables, $this->networkExcludedTables, $excludedCustomTables);
73 }
74
75 /**
76 * Get List of excluded tables for search replace cloning process job
77 * This also includes list of tables excluded through filters for cloning database copy process
78 *
79 * @return array
80 */
81 public function getExcludedTablesForSearchReplace($networkClone = false)
82 {
83 $excludedCustomCloneTables = apply_filters(self::CLONE_SEARCH_REPLACE_TABLES_EXCLUDE_FILTER, []);
84 $excludedCustomClonePushTables = apply_filters(self::SEARCH_REPLACE_TABLES_EXCLUDE_FILTER, $this->excludedTablesSearchReplaceOnly);
85 $searchReplaceExcludedTables = array_merge($excludedCustomCloneTables, $excludedCustomClonePushTables);
86 return array_merge($this->getExcludedTables($networkClone), $searchReplaceExcludedTables);
87 }
88
89 /**
90 * Get List of excluded tables for search replace push process job
91 *
92 * @return array
93 */
94 public function getExcludedTablesForSearchReplacePushOnly()
95 {
96 return apply_filters(self::SEARCH_REPLACE_TABLES_EXCLUDE_FILTER, $this->excludedTablesSearchReplaceOnly);
97 }
98 }
99