Changeset 1975 for trunk/wp-admin/upgrade-functions.php
- Timestamp:
- 12/18/2004 09:21:50 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upgrade-functions.php
r1971 r1975 198 198 $wpdb->query("UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'"); 199 199 200 // Some versions have multiple duplicate option_name rows with the same values 201 $options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name"); 202 foreach ( $options as $option ) { 203 if ( 1 != $option->dupes ) { // Could this be done in the query? 204 $limit = $option->dupes - 1; 205 $dupe_ids = $wpdb->get_col("SELECT option_id FROM $wpdb->options WHERE option_name = '$option->option_name' LIMIT $limit"); 206 $dupe_ids = join($dupe_ids, ','); 207 $wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)"); 208 } 209 } 200 210 } 201 211
Note: See TracChangeset
for help on using the changeset viewer.