/** * Duplicates the tables of the given source site to the current site. * * @param int $source_site_id The ID of the source site. * @param string $table_prefix The table prefix that is to be replaced. * * @return void */ private function duplicate_tables($source_site_id, $table_prefix) { $tables = $this->table_list->site_tables($source_site_id); /** * Filters the tables to duplicate from the source site for the current site. * * @since 3.0.0 * * @param string[] $tables The names of the tables to duplicate. * @param int $source_site_id The ID of the source site. */ $tables = (array) apply_filters('multilingualpress.duplicate_site_tables', $tables, $source_site_id); array_walk($tables, function ($table) use($table_prefix) { $new_table = preg_replace("~^{$table_prefix}~", $this->db->prefix, $table); if ($this->table_duplicator->duplicate_table($table, $new_table)) { $this->table_replacer->replace_table($new_table, $table); } }); }