Skip to content

Commit

Permalink
Merge pull request #5916 from Automattic/staging
Browse files Browse the repository at this point in the history
Production release: v20241008.0
  • Loading branch information
WPprodigy authored Oct 8, 2024
2 parents 1564c8e + afe662e commit cb86d1d
Show file tree
Hide file tree
Showing 36 changed files with 1,346 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .github/actions/prepare-source/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ runs:
using: composite
steps:
- name: Check out mu-plugins-ext
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
repository: 'Automattic/vip-go-mu-plugins-ext'
path: 'vip-go-mu-plugins-ext'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/changelog-summary-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
egress-policy: audit

- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Retrieve tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Setup PHP
uses: shivammathur/setup-php@2.30.5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-summary-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Setup PHP
uses: shivammathur/setup-php@2.30.5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
MYSQL_DATABASE: wordpress_test
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
submodules: recursive

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
- javascript
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Initialize CodeQL
uses: github/codeql-action/init@v3.26.8
uses: github/codeql-action/init@v3.26.10
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.26.8
uses: github/codeql-action/analyze@v3.26.10
4 changes: 2 additions & 2 deletions .github/workflows/core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ jobs:
echo "PHP_FPM_GID=$(id -g)" >> "${GITHUB_ENV}"
- name: Checkout WordPress
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
repository: wordpress/wordpress-develop
path: wordpress
ref: ${{ steps.version.outputs.latest }}

- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
submodules: recursive
path: wordpress/src/wp-content/mu-plugins
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
MYSQL_DATABASE: wordpress_test
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
github.com:443
- name: Check out the source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Review dependencies
uses: actions/dependency-review-action@v4.3.4
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ jobs:
contents: write
steps:
- name: Check out the source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
submodules: recursive
path: ${{ env.SOURCE_REPO_PATH }}

- name: Check out Automattic/vip-go-mu-plugins-ext
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
repository: Automattic/vip-go-mu-plugins-ext
path: ${{ env.EXT_REPO_PATH }}

- name: Check out Automattic/vip-go-mu-plugins-built
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
repository: Automattic/vip-go-mu-plugins-built
path: ${{ env.TARGET_REPO_PATH }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
wordpress.org:443

- name: Check out repository code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
submodules: true

Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
egress-policy: audit

- name: Check out repository code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Setup Node
uses: actions/setup-node@v4.0.4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Set up PHP
uses: shivammathur/setup-php@2.30.5
Expand All @@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0

- name: Setup Node
uses: actions/setup-node@v4.0.4
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/parsely.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,10 @@ jobs:
# Oldest version of the parsely plugin
- { wp: latest, parsely: '3.5', mode: 'filter_enabled', php: '8.1' }
- { wp: latest, parsely: '3.5', mode: 'filter_disabled', php: '8.1' }
- { wp: latest, parsely: '3.5', mode: 'option_enabled', php: '8.1' }
- { wp: latest, parsely: '3.5', mode: 'option_disabled', php: '8.1' }
- { wp: latest, parsely: '3.5', mode: 'filter_and_option_enabled', php: '8.1' }
- { wp: latest, parsely: '3.5', mode: 'filter_and_option_disabled', php: '8.1' }

# Latest version of the parsely plugin
- { wp: latest, mode: 'filter_enabled', php: '8.1' }
- { wp: latest, mode: 'filter_disabled', php: '8.1' }
- { wp: latest, mode: 'option_enabled', php: '8.1' }
- { wp: latest, mode: 'option_disabled', php: '8.1' }
- { wp: latest, mode: 'filter_and_option_enabled', php: '8.1' }
- { wp: latest, mode: 'filter_and_option_disabled', php: '8.1' }
services:
mysql:
image: mysql:8
Expand All @@ -50,7 +42,7 @@ jobs:
MYSQL_DATABASE: wordpress_test
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/search-dev-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
contents: write
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
token: ${{ secrets.WPCOM_VIP_BOT_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/search-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.0
with:
submodules: recursive

Expand Down
25 changes: 25 additions & 0 deletions 000-vip-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,31 @@
require_once __DIR__ . '/vip-helpers/class-user-cleanup.php';
require_once __DIR__ . '/vip-helpers/class-wpcomvip-restrictions.php';

// Load the Telemetry files
// TODO: switch to plain require_once like the above once the telemetry is fully deployed (all files are present)
$require_telemetry_files = [
__DIR__ . '/telemetry/class-telemetry-system.php',
__DIR__ . '/telemetry/class-tracks.php',
__DIR__ . '/telemetry/class-telemetry-client.php',
__DIR__ . '/telemetry/class-telemetry-event-queue.php',
__DIR__ . '/telemetry/class-telemetry-event.php',
__DIR__ . '/telemetry/tracks/class-tracks-event-dto.php',
__DIR__ . '/telemetry/tracks/class-tracks-event.php',
__DIR__ . '/telemetry/tracks/class-tracks-client.php',
];

// If there is a missing file, the loop will break and the telemetry files will not be loaded at all
do {
foreach ( $require_telemetry_files as $file ) {
if ( ! file_exists( $file ) ) {
break;
}
}
foreach ( $require_telemetry_files as $file ) {
require_once $file;
}
} while ( false );

add_action( 'init', [ WPComVIP_Restrictions::class, 'instance' ] );

//enabled on selected sites for now
Expand Down
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.

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.

18 changes: 9 additions & 9 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.

2 changes: 1 addition & 1 deletion shared-plugins/two-factor/class-two-factor-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Two_Factor_Core {
* @since 0.1-dev
*/
public static function add_hooks( $compat ) {
add_action( 'plugins_loaded', array( __CLASS__, 'load_textdomain' ) );
add_action( 'init', array( __CLASS__, 'load_textdomain' ) );
add_action( 'init', array( __CLASS__, 'get_providers' ) );
add_action( 'wp_login', array( __CLASS__, 'wp_login' ), 10, 2 );
add_filter( 'wp_login_errors', array( __CLASS__, 'maybe_show_reset_password_notice' ) );
Expand Down
67 changes: 67 additions & 0 deletions telemetry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# VIP Telemetry Library

## Tracks

Tracks is an event tracking tool used to understand user behaviour within Automattic. This library provides a way for plugins to interact with the Tracks system and start recording events.

### How to use

Example:

```php
use Automattic\VIP\Telemetry\Tracks;

function track_post_status( $new_status, $old_status, $post ) {
$tracks = new Tracks( 'myplugin_' );

$tracks->record_event( 'post_status_changed', [
'new_status' => $new_status,
'old_status' => $old_status,
'post_id' => $post->ID,
] );
}
add_action( 'transition_post_status', 'track_post_status', 10, 3 );
```

The example above is the most basic way to use this Tracks library. The client plugin would need a function to hook into the WordPress action they want to track and that function has to instantiate and call the `record_event` method from the `Tracks` class. This can be abstracted further to reduce code duplication by wrapping the functions in a class for example:

```php
namespace MyPlugin\Telemetry;

use Automattic\VIP\Telemetry\Tracks;

class MyPluginTracker {
protected $tracks;

public function __construct() {
$this->tracks = new Tracks( 'myplugin_' );
}

public function register_events() {
add_action( 'transition_post_status', [ $this, 'track_post_status' ], 10, 3 );
}

public function track_post_status( $new_status, $old_status, $post ) {
$this->tracks->record_event( 'post_status_changed', [
'new_status' => $new_status,
'old_status' => $old_status,
'post' => (array) $post,
] );
}
}
```

With the class above, you can then initiate event tracking in the main plugin file with these lines:

```php
$tracker = new MyPluginTracker();
$tracker->register_events();
```

If necessary to provide global properties to all events, you can pass an array of properties to the `Tracks` constructor:

```php
$this->tracks = new Tracks( 'myplugin_', [
'plugin_version' => '1.2.3',
] );
```
Loading

0 comments on commit cb86d1d

Please sign in to comment.