Make WordPress Core

Opened 13 years ago

Closed 9 years ago

Last modified 9 years ago

#21156 closed enhancement (maybelater)

Move utility functions out of wp-admin/network.php

Reported by: scribu's profile scribu Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: needs-patch
Focuses: multisite Cc:

Description

There are several functions in wp-admin/network.php that would come in handy outside the WP Admin -> Network Setup screen:

  • network_domain_check()
  • allow_subdirectory_install()
  • get_clean_basedomain()

etc.

They could be moved to wp-admin/includes/ms.php

Attachments (1)

21156.diff (4.2 KB) - added by jeremyfelt 11 years ago.
Moves utility functions to ms.php

Download all attachments as: .zip

Change History (10)

@jeremyfelt
11 years ago

Moves utility functions to ms.php

#1 @jeremyfelt
11 years ago

  • Keywords has-patch added; dev-feedback removed
  • Version set to 3.0

21156.diff moves network_domain_check(), allow_subdomain_install(), allow_subdirectory_install(), and get_clean_basedomain() from the display page of wp-admin/network.php to wp-admin/includes/ms.php. In the process, added inline docs for the global $wpdb objects.

#2 @jeremyfelt
11 years ago

  • Milestone changed from Awaiting Review to 3.7

#3 follow-up: @nacin
11 years ago

admin/includes/ms.php only gets included when multisite is enabled. As network.php is for converting to a network, ms.php cannot be relied upon. Including ms.php and allowing code from it to be executed before multisite is loaded could have nasty side effects.

I imagine scribu wants these functions specifically for WP-CLI, which is totally understandable. Beyond that, though, I'd really hesitate to make too much of network creation truly public, because most of these functions are either based on our rudimentary UI and upgrade process, or on our current subdirectory/subdomain restrictions. Long term, both get dropped. populate_network() already exists, which is sufficient for most use cases.

To satisfy WP-CLI's needs, I'd suggest pushing these functions to be usable with a few changes:

  • Renaming network_domain_check() and having it return *. Maybe ms_is_network_installed()
  • Probably finding a better name for get_clean_basedomain().

Definitely fine with allow_subdirectory_install() and allow_subdomain_install() to be public. Note they'll likely just return; or return true; at some later point when subdomain versus subdirectory goes away.

No need for the @var's, we don't really do those on reference, just initial defines. It'd also be @global anyway.

#4 in reply to: ↑ 3 @jeremyfelt
11 years ago

Replying to nacin:

No need for the @var's, we don't really do those on reference, just initial defines. It'd also be @global anyway.

Oops, global is good. We should do them on reference though, they come in extremely handy when reading core in an IDE.

I'll let scribu chime in on the rest.

#5 @DrewAPicture
11 years ago

  • Cc xoodrew@… added

#6 @jeremyfelt
11 years ago

  • Keywords has-patch removed
  • Milestone changed from 3.7 to Future Release

Punting to a future release. Looks like we can do a few things here, but more feedback and a patch is needed.

#7 @jeremyfelt
11 years ago

  • Component changed from Multisite to Networks and Sites
  • Focuses multisite added

#8 @chriscct7
9 years ago

  • Keywords needs-patch added
  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Closing as maybelater. Complete lack of interest on the feature on the ticket over the last 2 years. Feel free to reopen when more interest re-emerges (particularly if there's a patch)

#9 @jeremyfelt
9 years ago

Noting for others coming across this ticket - the intention is good. Rather than move the functions over, we should concentrate on what those functions do currently and then replace them with public functions that do it better and with more long term thought in mind.

Note: See TracTickets for help on using tickets.