Opened 13 years ago
Closed 13 years ago
#11707 closed enhancement (fixed)
Automatic repair of plugin-created tables
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Plugins | Keywords: | needs-patch |
Focuses: | Cc: |
Description
Hi,
I've just noticed that additional tables that are created by plugins are not included in the new automatic repair procedure because of the following code in /wp-admin/maint/repair.php.
// Loop over the WP tables, checking and repairing as needed. foreach ($wpdb->tables as $table)
What do you think about changing the loop to include all tables which adhere to the $wpdb->prefix syntax (see attached patch)? Imho, if an author follows all the instructions of the tutorial 'Creating Tables with Plugins' http://codex.wordpress.org/Creating_Tables_with_Plugins he/she should also benefit from this new functionality.
Greetz,
Berny
Attachments (2)
Change History (9)
#2
@
13 years ago
some kind of filter would also be a good idea, in the event that a plugin adds a few domain-wide tables that aren't prefixed.
#3
@
13 years ago
+1 for a filter.
Personally i'd just do a merge of the SQL Query + $wpdb->tables and filter duplicates.
#4
@
13 years ago
Thanks for the feedback. - I've updated the patch attachment:ticket:11707:11707.diff which now includes a filter called repair_tables and merged the tables retrieved from the SQL query with the default wp tables whereas old tables are excluded.
As repairing and optimizing the database would - in my opinion - mean no harm, we could also use the second variant of the patch attachment:ticket:11707:11707_include_all_tables.diff which simple queries for all tables in the current database.
Let me know what you think.
Remark: This patch also removes two typos.
#5
@
13 years ago
Typos patched for 2.9.2 - #11715.
I like the idea of also including CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE if they're defined.
#6
@
13 years ago
- Keywords needs-patch added; plugins repair db has-patch removed
- Owner changed from westi to nacin
- Status changed from new to reviewing
repair.php now uses wpdb::tables(), so custom user tables are now handled. It also has some MS support now. I suggest we array_merge() apply_filters( 'tables_to_repair', array() );
as a start.
+1 to the idea, but we also need the custom users table and the custom usermeta table, if either or both are defined.