PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.1
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.1
4.11.2 4.11.1 4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 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
Exporter 1 week ago QueryBuilder 1 week ago CustomTable.php 1 week ago DbInfo.php 1 week ago ExcludedTables.php 1 week ago ExternalDatabaseConfiguration.php 1 week ago OptionPreservationHandler.php 1 week ago SearchReplace.php 1 week ago SelectedTables.php 1 week ago TableDto.php 1 week ago TableService.php 1 week ago TablesRenamer.php 1 week ago WpDbInfo.php 1 week ago WpOptionsInfo.php 1 week ago iDbInfo.php 3 years ago
ExcludedTables.php
100 lines
1 <?php
2
3 namespace WPStaging\Framework\Database;
4
5 use WPStaging\Framework\BackgroundProcessing\Queue;
6 use WPStaging\Framework\Facades\Hooks;
7
8
9
10
11 class ExcludedTables
12 {
13
14
15
16 const CLONE_DATABASE_TABLES_EXCLUDE_FILTER = 'wpstg_clone_database_tables_exclude';
17
18
19
20
21 const CLONE_SEARCH_REPLACE_TABLES_EXCLUDE_FILTER = 'wpstg_clone_searchreplace_tables_exclude';
22
23
24
25
26 const SEARCH_REPLACE_TABLES_EXCLUDE_FILTER = 'wpstg_searchreplace_excl_tables';
27
28
29
30
31 private $excludedTables;
32
33
34
35
36 private $networkExcludedTables;
37
38
39
40
41 private $excludedTablesSearchReplaceOnly;
42
43 public function __construct()
44 {
45 $this->excludedTables = [
46 Queue::getTableName(),
47 ];
48
49 $this->networkExcludedTables = [
50 'blogs',
51 'blog_version',
52 ];
53
54 $this->excludedTablesSearchReplaceOnly = [
55 '_cerber_files',
56 '_cerber_sets',
57 ];
58 }
59
60
61
62
63
64
65 public function getExcludedTables($networkClone = false)
66 {
67 $excludedCustomTables = Hooks::applyFilters(self::CLONE_DATABASE_TABLES_EXCLUDE_FILTER, []);
68
69 if ($networkClone) {
70 return array_merge($this->excludedTables, $excludedCustomTables);
71 }
72
73 return array_merge($this->excludedTables, $this->networkExcludedTables, $excludedCustomTables);
74 }
75
76
77
78
79
80
81
82 public function getExcludedTablesForSearchReplace($networkClone = false)
83 {
84 $excludedCustomCloneTables = Hooks::applyFilters(self::CLONE_SEARCH_REPLACE_TABLES_EXCLUDE_FILTER, []);
85 $excludedCustomClonePushTables = Hooks::applyFilters(self::SEARCH_REPLACE_TABLES_EXCLUDE_FILTER, $this->excludedTablesSearchReplaceOnly);
86 $searchReplaceExcludedTables = array_merge($excludedCustomCloneTables, $excludedCustomClonePushTables);
87 return array_merge($this->getExcludedTables($networkClone), $searchReplaceExcludedTables);
88 }
89
90
91
92
93
94
95 public function getExcludedTablesForSearchReplacePushOnly()
96 {
97 return Hooks::applyFilters(self::SEARCH_REPLACE_TABLES_EXCLUDE_FILTER, $this->excludedTablesSearchReplaceOnly);
98 }
99 }
100