Skip to content

Commit

Permalink
Merge pull request #6125 from Automattic/staging
Browse files Browse the repository at this point in the history
Production release: v20250204.0
  • Loading branch information
rinatkhaziev authored Feb 4, 2025
2 parents d03b503 + 1b1d609 commit 2477bfa
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
uses: actions/[email protected]

- name: Initialize CodeQL
uses: github/codeql-action/[email protected].0
uses: github/codeql-action/[email protected].1
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml

- name: Perform CodeQL Analysis
uses: github/codeql-action/[email protected].0
uses: github/codeql-action/[email protected].1
6 changes: 3 additions & 3 deletions __tests__/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"require-dev": {
"phpunit/phpunit": "9.6.19",
"automattic/vipwpcs": "3.0.1",
"phpcompatibility/phpcompatibility-wp": "2.1.5",
"phpcompatibility/phpcompatibility-wp": "2.1.6",
"erusev/parsedown": "1.7.4",
"dms/phpunit-arraysubset-asserts": "0.5.0",
"yoast/phpunit-polyfills": "3.0.0",
Expand Down
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion http-concat
43 changes: 26 additions & 17 deletions integrations/integration-vip-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,34 @@ protected function get_vip_config_from_file( string $slug ) {
? constant( 'WPVIP_INTEGRATIONS_CONFIG_DIR' )
: ABSPATH . 'config/integrations-config';
$config_file_name = $slug . '-config.php';
$config_file_path = $config_file_directory . '/' . $config_file_name;

/**
* Clear cache to always read data from latest config file.
*
* Kubernetes ConfigMap updates the file via symlink instead of actually replacing the file and
* PHP cache can hold a reference to the old symlink that can cause fatal if we use require
* on it.
*/
clearstatcache( true, $config_file_directory . '/' . $config_file_name );
// Clears cache for files created by k8s ConfigMap.
clearstatcache( true, $config_file_directory . '/..data' );
clearstatcache( true, $config_file_directory . '/..data/' . $config_file_name );

if ( ! is_readable( $config_file_path ) ) {
return null;
$config_file_path_orig = $config_file_directory . '/' . $config_file_name;

$config_file_path = apply_filters( 'vip_integrations_config_file_path', $config_file_path_orig, $slug );
$config_data = apply_filters( 'vip_integrations_pre_load_config', null, $config_file_path, $slug );

if ( is_null( $config_data ) ) {
if ( $config_file_path_orig === $config_file_path ) {
/**
* Clear cache to always read data from latest config file.
*
* Kubernetes ConfigMap updates the file via symlink instead of actually replacing the file and
* PHP cache can hold a reference to the old symlink that can cause fatal if we use require
* on it.
*/
clearstatcache( true, $config_file_directory . '/' . $config_file_name );
// Clears cache for files created by k8s ConfigMap.
clearstatcache( true, $config_file_directory . '/..data' );
clearstatcache( true, $config_file_directory . '/..data/' . $config_file_name );
}

if ( ! is_readable( $config_file_path ) ) {
return null;
}

$config_data = require $config_file_path;
}

return require $config_file_path;
return $config_data;
}

/**
Expand Down
34 changes: 34 additions & 0 deletions integrations/jetpack.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Integration: Jetpack.
*/
namespace Automattic\VIP\Integrations;

class JetpackIntegration extends Integration {
protected string $version = '';

public function is_loaded(): bool {
return class_exists( 'Jetpack' );
}

public function configure(): void {
if ( isset( $this->get_env_config()['version'] ) ) {
$this->version = $this->get_env_config()['version'];
} elseif ( defined( 'VIP_JETPACK_PINNED_VERSION' ) ) {
$this->version = constant( 'VIP_JETPACK_PINNED_VERSION' );
} else {
$this->version = vip_default_jetpack_version();
}
}

public function load(): void {
if ( $this->is_loaded() ) {
return;
}

// Pass through to the old code for now which will respect all existing constants
if ( ! defined( 'WP_INSTALLING' ) ) {
vip_jetpack_load();
}
}
}
2 changes: 1 addition & 1 deletion search/search-dev-tools/build/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions search/search-dev-tools/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vip-integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@
require_once __DIR__ . '/integrations/vip-governance.php';
require_once __DIR__ . '/integrations/enterprise-search.php';

if ( file_exists( __DIR__ . '/integrations/jetpack.php' ) ) {
require_once __DIR__ . '/integrations/jetpack.php';
}

// Register VIP integrations here.
IntegrationsSingleton::instance()->register( new BlockDataApiIntegration( 'block-data-api' ) );
IntegrationsSingleton::instance()->register( new ParselyIntegration( 'parsely' ) );
IntegrationsSingleton::instance()->register( new VipGovernanceIntegration( 'vip-governance' ) );
IntegrationsSingleton::instance()->register( new EnterpriseSearchIntegration( 'enterprise-search' ) );

if ( class_exists( __NAMESPACE__ . '\\JetpackIntegration' ) ) {
IntegrationsSingleton::instance()->register( new JetpackIntegration( 'jetpack' ) );
}
// @codeCoverageIgnoreEnd

/**
Expand Down

0 comments on commit 2477bfa

Please sign in to comment.