Add site generator command by i-am-chitti · Pull Request #498 · wp-cli/entity-command (original) (raw)
I don't see that test failing on CI, I only see this error:
PHP Fatal error: Call to undefined function get_subdirectory_reserved_names() in src/Site_Command.php on line 555
That's because of my suggestion to use get_subdirectory_reserved_names()
. Turns out this was only added in WP 4.4, but we still run tests against 3.7+.
To address this, we can add a new private method to the class like this:
/**
Retrieves a list of reserved site on a sub-directory Multisite installation.
Works on older WordPress versions where get_subdirectory_reserved_names() does not exist.
@return string[] Array of reserved names. */ private function get_subdirectory_reserved_names() { if ( function_exists( 'get_subdirectory_reserved_names' ) ) { return get_subdirectory_reserved_names(); }
$names = array( 'page', 'comments', 'blog', 'files', 'feed', 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', 'embed', );
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Calling WordPress native hook. return apply_filters( 'subdirectory_reserved_names', $names );
}