PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 4.9.2
WP STAGING – WordPress Backup, Restore, Migration & Clone v4.9.2
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 2 weeks ago QueryBuilder 2 years ago CustomTable.php 3 months ago DbInfo.php 7 months ago ExcludedTables.php 5 months ago OptionPreservationHandler.php 2 years ago SearchReplace.php 2 months ago SelectedTables.php 2 weeks ago TableDto.php 1 year ago TableService.php 9 months ago TablesRenamer.php 3 months ago WpDbInfo.php 9 months ago WpOptionsInfo.php 1 year ago iDbInfo.php 2 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 * Provide list of table excluded from Database Copy and SearchReplace Job
10 */
11 class ExcludedTables
12 {
13 /**
14 * @var string
15 */
16 const CLONE_DATABASE_TABLES_EXCLUDE_FILTER = 'wpstg_clone_database_tables_exclude';
17
18 /**
19 * @var string
20 */
21 const CLONE_SEARCH_REPLACE_TABLES_EXCLUDE_FILTER = 'wpstg_clone_searchreplace_tables_exclude';
22
23 /**
24 * @var string
25 */
26 const SEARCH_REPLACE_TABLES_EXCLUDE_FILTER = 'wpstg_searchreplace_excl_tables';
27
28 /**
29 * @var array
30 */
31 private $excludedTables;
32
33 /**
34 * @var array
35 */
36 private $networkExcludedTables;
37
38 /**
39 * @var array
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', // Cerber Security Plugin
56 '_cerber_sets', // Cerber Security Plugin
57 ];
58 }
59
60 /**
61 * Get List of excluded tables for database copy
62 *
63 * @return array
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 * Get List of excluded tables for search replace cloning process job
78 * This also includes list of tables excluded through filters for cloning database copy process
79 *
80 * @return array
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 * Get List of excluded tables for search replace push process job
92 *
93 * @return array
94 */
95 public function getExcludedTablesForSearchReplacePushOnly()
96 {
97 return Hooks::applyFilters(self::SEARCH_REPLACE_TABLES_EXCLUDE_FILTER, $this->excludedTablesSearchReplaceOnly);
98 }
99 }
100