Skip to content

Commit

Permalink
Merge branch 'add/governance-plugin' of github.com:Automattic/vip-go-…
Browse files Browse the repository at this point in the history
…mu-plugins into add/governance-plugin
  • Loading branch information
ingeniumed committed Sep 29, 2023
2 parents a76a4ad + 75e0835 commit d88d711
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 61 deletions.
6 changes: 3 additions & 3 deletions 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 search/elasticpress-next
8 changes: 8 additions & 0 deletions search/includes/classes/class-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ class Health {
* Instance of Search class
*
* Useful for overriding (dependency injection) for tests
*
* @var \Automattic\VIP\Search\Search
*/
public $search;

/** @var \ElasticPress\Indexables */
public $indexables;

/** @var \ElasticPress\Elasticsearch */
public $elasticsearch;

public function __construct( \Automattic\VIP\Search\Search $search ) {
$this->search = $search;
$this->indexables = \ElasticPress\Indexables::factory();
Expand Down
6 changes: 6 additions & 0 deletions search/includes/classes/class-healthjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,26 @@ class HealthJob {
* Instance of the Health class
*
* Useful for overriding in tests via dependency injection
*
* @var Health
*/
public $health;

/**
* Instance of Search class
*
* Useful for overriding (dependency injection) for tests
*
* @var \Automattic\VIP\Search\Search
*/
public $search;

/**
* Instance of \ElasticPress\Indexables
*
* Useful for overriding (dependency injection) for tests
*
* @var \ElasticPress\Indexables
*/
public $indexables;

Expand Down
2 changes: 2 additions & 0 deletions search/includes/classes/class-queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class Queue {

/** @var Queue\Schema */
public $schema;
/** @var Indexables */
public $indexables;
/** @var \Automattic\VIP\Logstash\Logger */
public $logger;
/** @var Queue\Cron */
public $cron;
Expand Down
2 changes: 2 additions & 0 deletions search/includes/classes/class-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class Search {
public $concurrency_limiter;
public $time;
public static $stat_sampling_drop_value = 5; // Value to compare >= against rand( 1, 10 ). 5 should result in roughly half being true.
/** @var Cache */
public $cache;

/**
* Maximum number of queries before rate-limiting kicks in.
Expand Down
6 changes: 6 additions & 0 deletions search/includes/classes/class-settingshealthjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,26 @@ class SettingsHealthJob {
* Instance of the Health class
*
* Useful for overriding in tests via dependency injection
*
* @var Health
*/
public $health;

/**
* Instance of Search class
*
* Useful for overriding (dependency injection) for tests
*
* @var \Automattic\VIP\Search\Search
*/
public $search;

/**
* Instance of \ElasticPress\Indexables
*
* Useful for overriding (dependency injection) for tests
*
* @var \ElasticPress\Indexables
*/
public $indexables;

Expand Down
3 changes: 3 additions & 0 deletions search/includes/classes/class-versioningcleanupjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class VersioningCleanupJob {

const SEARCH_ALERT_SLACK_CHAT = '#vip-go-es-alerts';

public $indexables;
public $versioning;

public function __construct( $indexables, $versioning ) {
$this->indexables = $indexables;
$this->versioning = $versioning;
Expand Down
2 changes: 1 addition & 1 deletion search/includes/classes/commands/class-documentcommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function get( $args, $assoc_args ) {
$type = $args[0];
$object_id = $args[1];

$search = \Automattic\VIP\Search\Search::instance();
\Automattic\VIP\Search\Search::instance();

$indexable = \ElasticPress\Indexables::factory()->get( $type );

Expand Down
110 changes: 55 additions & 55 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.

7 changes: 7 additions & 0 deletions tests/files/test-curl-streamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public function tearDown(): void {
}

public function test__init() {
global $wp_version;

$version = preg_replace( '/-.*$/', '', $wp_version );
if ( version_compare( $version, '6.4', '>=' ) ) {
$this->setExpectedDeprecated( 'http_api_transports' );
}

$expected_transport = 'WP_Http_Curl';

$wp_http = new \WP_Http();
Expand Down
3 changes: 2 additions & 1 deletion vip-helpers/vip-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ function wpcom_vip_set_image_quality( $quality, $strip = false ) {

add_filter( 'the_content', function ( $content ) use ( $quality, $strip ) {
if ( false !== strpos( $content, 'files.wordpress.com' ) ) {
$content = preg_replace_callback( '#https?://\w+\.files\.WordPress\.com[^\s"\'>]+#', function ( $matches ) use ( $quality, $strip ) {
// phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText
$content = preg_replace_callback( '#https?://\w+\.files\.wordpress\.com[^\s"\'>]+#', function ( $matches ) use ( $quality, $strip ) {
return wpcom_vip_set_image_quality_for_url( $matches[0], $quality, $strip );
}, $content );
}
Expand Down

0 comments on commit d88d711

Please sign in to comment.