Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions php/WP_CLI/RequestsLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public static function register_autoloader() {
if ( self::is_core() ) {
require_once ABSPATH . $includes_path . '/Requests/Autoload.php';
} else {
self::maybe_define_wp_cli_root();
if ( file_exists( WP_CLI_ROOT . '/bundle/rmccue/requests/src/Autoload.php' ) ) {
require_once WP_CLI_ROOT . '/bundle/rmccue/requests/src/Autoload.php';
} else {
Expand All @@ -278,10 +279,20 @@ public static function get_bundled_certificate_path() {
} elseif ( self::is_v1() ) {
return WP_CLI_VENDOR_DIR . '/rmccue/requests/library/Requests/Transport/cacert.pem';
} else {
self::maybe_define_wp_cli_root();
if ( file_exists( WP_CLI_ROOT . '/bundle/rmccue/requests/certificates/cacert.pem' ) ) {
return WP_CLI_ROOT . '/bundle/rmccue/requests/certificates/cacert.pem';
}
return WP_CLI_VENDOR_DIR . '/rmccue/requests/certificates/cacert.pem';
}
}

/**
* Define WP_CLI_ROOT if it is not already defined.
*/
private static function maybe_define_wp_cli_root() {
if ( ! defined( 'WP_CLI_ROOT' ) ) {
define( 'WP_CLI_ROOT', dirname( dirname( __DIR__ ) ) );
}
}
}