#37823 closed enhancement (fixed)
Use get_sites in Network upgrade
Reported by: | spacedmonkey | Owned by: | jeremyfelt |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | has-patch |
Focuses: | multisite | Cc: |
Description
Instead of using raw sql query in upgrade.php, use the new get_sites function.
Attachments (5)
Change History (17)
#4
@
8 years ago
+1 from me also, once @flixos90's recommendations.
I'd also prefer to not use $args
as a one-time variable, and do this instead:
$blogs = get_sites( array( 'spam' => '0', 'deleted' => '0', 'archived' => '0', 'network_id' => get_current_network_id(), 'fields' => 'ids', 'number' => 5, 'offset' => $n, 'order' => 'DESC', 'orderby' => 'id', ) );
#5
@
8 years ago
37823.5.diff has the number
and offset
argument correct.
#6
follow-up:
↓ 8
@
8 years ago
- Type changed from defect (bug) to enhancement
Maybe we should move the relevant parts here into an actual function, something like upgrade_network_sites()
. This would allow us to better add unit tests for it.
#8
in reply to:
↑ 6
@
8 years ago
- Keywords needs-unit-tests removed
- Owner set to jeremyfelt
- Status changed from new to reviewing
Replying to flixos90:
Maybe we should move the relevant parts here into an actual function, something like
upgrade_network_sites()
. This would allow us to better add unit tests for it.
37823.5.diff looks good. Let's hold off on creating an upgrade_network_sites()
or similar until we explore #11869, #37799, and others a bit more. We may end up refactoring this page in other ways.
#9
follow-up:
↓ 10
@
8 years ago
- Resolution set to fixed
- Status changed from reviewing to closed
In 38680:
#10
in reply to:
↑ 9
;
follow-up:
↓ 11
@
8 years ago
Replying to jeremyfelt:
In 38680:
Nitpicking: spam
, deleted
, and archived
should be integer values. 0️⃣
+1 for this.
There's a small problem in line 63 of the patch though,
number
needs to be 5, and we need to includeoffset => $n
in the arguments.