Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/packages update #4039

Merged
merged 10 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix PHP Lint errors
  • Loading branch information
felipeelia committed Dec 11, 2024
commit aabe217589b2e8617fdd0913ea70d1849ca3cc43
6 changes: 3 additions & 3 deletions elasticpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function () {
* @since 2.6
*/
spl_autoload_register(
function ( $class ) {
function ( $class_name ) {
// project-specific namespace prefix.
$prefix = 'ElasticPress\\';

Expand All @@ -82,11 +82,11 @@ function ( $class ) {
// does the class use the namespace prefix?
$len = strlen( $prefix );

if ( strncmp( $prefix, $class, $len ) !== 0 ) {
if ( strncmp( $prefix, $class_name, $len ) !== 0 ) {
return;
}

$relative_class = substr( $class, $len );
$relative_class = substr( $class_name, $len );

$file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';

Expand Down
28 changes: 13 additions & 15 deletions includes/classes/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,23 +295,21 @@ public function handle_feature_activation() {

$this->activate_feature( $slug, $activate_feature_target );
}
} else {
} elseif ( $old_requirement_statuses[ $slug ] !== $code && ( 0 === $code || 2 === $code ) ) {
// This feature has a 0 "ok" code when it did not before
if ( $old_requirement_statuses[ $slug ] !== $code && ( 0 === $code || 2 === $code ) ) {
$active = ( 0 === $code );

if ( ! $feature->is_active() && $active ) {
// Need to activate and maybe set a sync notice
if ( $feature->requires_install_reindex ) {
$activate_feature_target = 'draft';
Utils\update_option( 'ep_feature_auto_activated_sync', sanitize_text_field( $slug ) );
}

$this->activate_feature( $slug, $activate_feature_target );
} elseif ( $feature->is_active() && ! $active ) {
// Just deactivate, don't force
$this->deactivate_feature( $slug, false );
$active = ( 0 === $code );

if ( ! $feature->is_active() && $active ) {
// Need to activate and maybe set a sync notice
if ( $feature->requires_install_reindex ) {
$activate_feature_target = 'draft';
Utils\update_option( 'ep_feature_auto_activated_sync', sanitize_text_field( $slug ) );
}

$this->activate_feature( $slug, $activate_feature_target );
} elseif ( $feature->is_active() && ! $active ) {
// Just deactivate, don't force
$this->deactivate_feature( $slug, false );
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions includes/classes/IndexHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1277,14 +1277,12 @@ protected function stop_the_insanity() {
*/
if ( function_exists( 'wp_cache_flush_runtime' ) ) {
wp_cache_flush_runtime();
} else {
} elseif ( ! wp_using_ext_object_cache() ) {
/*
* In the case where we're not using an external object cache, we need to call flush on the default
* WordPress object cache class to clear the values from the cache property
*/
if ( ! wp_using_ext_object_cache() ) {
wp_cache_flush();
}
wp_cache_flush();
}

if ( is_object( $wp_object_cache ) ) {
Expand Down
2 changes: 2 additions & 0 deletions includes/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*
* @since 3.0
* @package elasticpress
*
* phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed
*/

/**
Expand Down
3 changes: 0 additions & 3 deletions tests/php/TestUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,6 @@ public function testGetElasticsearchErrorReason() {
],
'items' => [
[
'index' => [
'status' => 201,
],
'index' => [
'error' => [
'reason' => 'Error reason',
Expand Down
1 change: 1 addition & 0 deletions tests/php/includes/classes/mock/class-wp-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* WP_CLI Mock
*
* phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
* phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
*
* @package elasticpress
*/
Expand Down
Loading