#37823 closed enhancement (fixed)
Use get_sites in Network upgrade
| Reported by: | spacedmonkey | Owned by: | jeremyfelt |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.7 |
| Component: | Networks and Sites | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | multisite |
Description
Instead of using raw sql query in upgrade.php, use the new get_sites function.
Attachments (5)
Change History (17)
#4
@
10 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
@
10 years ago
37823.5.diff has the number and offset argument correct.
#6
follow-up:
↓ 8
@
10 years ago
- Type defect (bug) → 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
@
10 years ago
- Keywords needs-unit-tests removed
- Owner set to
- Status new → 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.
#10
in reply to: ↑ 9
;
follow-up:
↓ 11
@
10 years ago
Replying to jeremyfelt:
In 38680:
Nitpicking: spam, deleted, and archived should be integer values. 0️⃣
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
+1 for this.
There's a small problem in line 63 of the patch though,
numberneeds to be 5, and we need to includeoffset => $nin the arguments.