Skip to content

Commit 5028988

Browse files
authored
Merge pull request #1237 from cloudinary/uat
3.3.6
2 parents a321e83 + 7815f80 commit 5028988

58 files changed

Lines changed: 2664 additions & 1304 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/dependabot.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
target-branch: develop
8+
- package-ecosystem: npm
9+
directory: /
10+
schedule:
11+
interval: weekly
12+
target-branch: develop
13+
groups:
14+
wordpress:
15+
patterns:
16+
- "@wordpress/*"

‎.github/workflows/build-docs.yml‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: Build Docs
22

33
on:
4-
push:
5-
branches:
6-
- master
74
release:
8-
types: [published]
5+
types: [released]
96
workflow_dispatch:
107

118
permissions:

‎.github/workflows/deploy-to-wp-org.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ jobs:
113113
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
114114
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
115115

116+
# Makes the zip downloadable from the run's Artifacts panel regardless of trigger, so
117+
# manual/dry-run dispatches can be inspected without publishing a release.
118+
- name: Upload build artifact
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: ${{ env.PLUGIN_VERSION }}.zip
122+
path: ${{ steps.deploy.outputs.zip-path }}
123+
retention-days: 7
124+
116125
- name: Upload release asset
117126
if: github.event_name == 'release'
118127
uses: softprops/action-gh-release@v2

‎.version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.5
1+
3.3.6
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/**
3+
* Analytics egress capture — local/e2e dev helper mu-plugin.
4+
*
5+
* Intercepts outgoing requests to any Cloudinary analytics-api.cloudinary.com
6+
* endpoint — the custom-events collector AND the older deactivation-reason
7+
* collector, both on the same host — and appends each payload as a JSONL
8+
* entry to a log file, so e2e tests and manual QA can assert on emitted
9+
* events. The request is fully preempted with a synthetic response: earlier
10+
* versions of this mu-plugin only logged the payload and let the request
11+
* proceed, which meant every local/CI test run was quietly leaking synthetic
12+
* events (and deactivation "feedback") into the real production collector.
13+
*
14+
* @package Cloudinary
15+
*/
16+
17+
defined( 'ABSPATH' ) || exit;
18+
19+
/**
20+
* Returns the path to the capture log file.
21+
*
22+
* @return string
23+
*/
24+
function cld_analytics_capture_log_path() {
25+
$upload = wp_upload_dir();
26+
27+
return $upload['basedir'] . '/analytics-capture.log';
28+
}
29+
30+
add_filter( 'pre_http_request', 'cld_analytics_capture_intercept', 10, 3 );
31+
32+
/**
33+
* Logs outgoing analytics/deactivation-reason requests and preempts them
34+
* with a synthetic success response, so nothing actually reaches the real
35+
* collector during local dev or CI runs.
36+
*
37+
* @param false|array|WP_Error $preempt Whether to preempt the request.
38+
* @param array $parsed_args Parsed request arguments.
39+
* @param string $url The request URL.
40+
*
41+
* @return false|array|WP_Error
42+
*/
43+
function cld_analytics_capture_intercept( $preempt, $parsed_args, $url ) {
44+
if ( false === strpos( $url, 'analytics-api.cloudinary.com' ) ) {
45+
return $preempt;
46+
}
47+
48+
$body = isset( $parsed_args['body'] ) ? $parsed_args['body'] : '';
49+
$decoded = json_decode( $body, true );
50+
51+
file_put_contents( // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents, WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
52+
cld_analytics_capture_log_path(),
53+
wp_json_encode( null !== $decoded ? $decoded : $body ) . "\n",
54+
FILE_APPEND | LOCK_EX
55+
);
56+
57+
return array(
58+
'headers' => array(),
59+
'body' => '',
60+
'response' => array(
61+
'code' => 200,
62+
'message' => 'OK',
63+
),
64+
'cookies' => array(),
65+
'filename' => null,
66+
);
67+
}
68+
69+
/**
70+
* Prints the captured analytics events, one JSON object per line.
71+
*
72+
* ## OPTIONS
73+
*
74+
* [--clear]
75+
* : Empty the log after printing it.
76+
*
77+
* @param array $args Positional arguments.
78+
* @param array $assoc_args Associative arguments.
79+
*/
80+
function cld_analytics_capture_wpcli_command( $args, $assoc_args ) {
81+
$log_file = cld_analytics_capture_log_path();
82+
83+
if ( file_exists( $log_file ) ) {
84+
WP_CLI::line( file_get_contents( $log_file ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents, WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown
85+
}
86+
87+
if ( isset( $assoc_args['clear'] ) ) {
88+
file_put_contents( $log_file, '' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents, WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
89+
}
90+
}
91+
92+
if ( defined( 'WP_CLI' ) && WP_CLI ) {
93+
WP_CLI::add_command( 'cloudinary analytics-events', 'cld_analytics_capture_wpcli_command' );
94+
}

‎css/gallery-rtl.css‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎css/gallery.css‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎js/block-editor.asset.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '558667256f0d3fc475cd');
1+
<?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '58afb0a9ee7fa6faecd7');

‎js/block-editor.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎js/cloudinary.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)