[wp-trac] [WordPress Trac] #38856: Backward compat consideration for wp_blogs.archived

WordPress Trac noreply at wordpress.org
Fri Nov 18 22:15:11 UTC 2016


#38856: Backward compat consideration for wp_blogs.archived
--------------------------------+------------------------------
 Reporter:  stephdau            |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Networks and Sites  |     Version:  trunk
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  multisite
--------------------------------+------------------------------
Description changed by stephdau:

Old description:

> The `archived` column in `wp_blogs` used to be of the `enum` data type,
> but was witched to `tinyint` 3 years ago, in r25448.
>
> Some older instances might not have migrated to the newer data type
> (`ALTER`s on large tables isn't fun).
>
> In `class-wp-site-query.php`, we use `$wpdb->prepare( "archived = %d ",
> $archived );`, which translates to `archived = 0|1`. Tis works great with
> `tinyint`, but fails with the older `enum` type, as it expects the value
> to be single quoted.
>
> Since `archived = '0|1'` works with both data types, @jeremyfelt
> suggested we move the `prepare()` statement to using `%s` and `absint()`
> instead: https://wordpress.slack.com/archives/core-
> multisite/p1479504691000517

New description:

 The `archived` column in `wp_blogs` used to be of the `enum` data type,
 but was switched to `tinyint` 3 years ago, in r25448.

 Some older instances might not have migrated to the newer data type
 (`ALTER`s on large tables isn't fun).

 In `class-wp-site-query.php`, we use `$wpdb->prepare( "archived = %d ",
 $archived );`, which translates to `archived = 0|1`. Tis works great with
 `tinyint`, but fails with the older `enum` type, as it expects the value
 to be single quoted.

 Since `archived = '0|1'` works with both data types, @jeremyfelt suggested
 we move the `prepare()` statement to using `%s` and `absint()` instead:
 https://wordpress.slack.com/archives/core-multisite/p1479504691000517

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38856#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list