Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/0.5.1' into release/0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mogmarsh committed Aug 20, 2024
2 parents 4b08a0e + 1735496 commit be42d9a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
18 changes: 13 additions & 5 deletions bin/wp-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ private function contain_memory_leaks() {
return;
}

$wp_object_cache->group_ops = array();
$wp_object_cache->stats = array();
$wp_object_cache->memcache_debug = array();
$wp_object_cache->cache = array();
if ( isset( $wp_object_cache->group_ops ) ) {
$wp_object_cache->group_ops = [];
}

if ( isset( $wp_object_cache->memcache_debug ) ) {
$wp_object_cache->memcache_debug = [];
}

if ( isset( $wp_object_cache->cache ) ) {
$wp_object_cache->cache = [];
}

if ( method_exists( $wp_object_cache, '__remoteset' ) ) {
$wp_object_cache->__remoteset();
}
Expand Down Expand Up @@ -287,7 +295,7 @@ public function index( $args, $assoc_args ) {

WP_CLI::log(
sprintf(
'Indexing %1$s, %2$d at a time, starting on page %3$d',
'Indexing %1$s, %2$s at a time, starting on page %3$d',
$limit_text,
number_format( $assoc_args['bulk'] ),
absint( $assoc_args['page'] )
Expand Down
7 changes: 7 additions & 0 deletions lib/class-sp-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ public function request( $url = '', $method = 'GET', $body = '', $request_params
'body' => $body,
)
);
/**
* Filters the API URL directly before the request is made.
*
* @param string $url The URL of the request.
* @param array $request_params The request params.
*/
$url = apply_filters( 'sp_api_request_url', $url, $request_params );

$result = sp_remote_request( $url, $request_params );

Expand Down
3 changes: 2 additions & 1 deletion lib/class-sp-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ public static function split() {
*/
public static function debug_sp_post_pre_index( $data ) {
do_action( 'sp_debug', '[SP_Post] Post JSON', wp_json_encode( $data ) );
return $data;
}
}
add_action( 'sp_debug', array( 'SP_Debug', 'debug' ), 10, 2 );
add_action( 'sp_post_pre_index', array( 'SP_Debug', 'debug_sp_post_pre_index' ), 999 );
add_filter( 'sp_post_pre_index', array( 'SP_Debug', 'debug_sp_post_pre_index' ), 999 );

SP_Debug::init();
2 changes: 1 addition & 1 deletion lib/class-sp-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function force_search_template( &$wp_query ) {
$this->sp = get_query_var( 'sp' );

// If this is a search, but not a keyword search, we have to fake it.
if ( ! $wp_query->is_search() && ! empty( $this->sp ) && 1 === intval( $this->sp['force'] ) ) {
if ( ! $wp_query->is_search() && isset( $this->sp['force'] ) && 1 === intval( $this->sp['force'] ) ) {
// First, we'll set the search string to something phony.
$wp_query->set( 's', '1441f19754335ca4638bfdf1aea00c6d' );
$wp_query->is_search = true;
Expand Down

0 comments on commit be42d9a

Please sign in to comment.