Skip to content

Commit

Permalink
Merge branch 'develop' into feature/1528-add-playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
tharsheblows committed Jul 31, 2024
2 parents 65d555c + f243cac commit a1c8287
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand All @@ -32,7 +32,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles( 'composer.lock' ) }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-to-wp-org.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand All @@ -42,7 +42,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles( 'composer.lock' ) }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
16 changes: 13 additions & 3 deletions classes/class-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,22 @@ public function build_record( $item, $columns ) {
switch ( $column_name ) {
case 'date':
$created = gmdate( 'Y-m-d H:i:s', strtotime( $record->created ) );
$row_out[ $column_name ] = get_date_from_gmt( $created, 'Y/m/d h:i:s A' );
$row_out[ $column_name ] = get_date_from_gmt( $created, 'Y/m/d h:i:s A T' );
break;

case 'summary':
$row_out[ $column_name ] = $record->summary;
break;

case 'user_id':
case 'user':
$user = new Author( (int) $record->user_id, (array) $record->user_meta );
$row_out[ $column_name ] = $user->get_display_name();
break;

case 'user_id':
$row_out[ $column_name ] = $record->user_id;
break;

case 'connector':
$row_out[ $column_name ] = $record->connector;
break;
Expand All @@ -131,6 +135,10 @@ public function build_record( $item, $columns ) {
$row_out[ $column_name ] = $record->context;
break;

case 'object_id':
$row_out[ $column_name ] = $record->object_id;
break;

case 'action':
$row_out[ $column_name ] = $record->{$column_name};
break;
Expand Down Expand Up @@ -167,9 +175,11 @@ public function expand_columns( $columns ) {
$new_columns = array(
'date' => $columns['date'],
'summary' => $columns['summary'],
'user_id' => $columns['user_id'],
'user' => $columns['user_id'],
'user_id' => __( 'User ID', 'stream' ),
'connector' => __( 'Connector', 'stream' ),
'context' => $columns['context'],
'object_id' => __( 'Object ID', 'stream' ),
'action' => $columns['action'],
'ip' => $columns['ip'],
);
Expand Down
2 changes: 1 addition & 1 deletion classes/class-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function column_default( $item, $column_name ) {
);
$out = $this->column_link( $date_string, 'date', get_date_from_gmt( $created, 'Y/m/d' ) );
$out .= '<br />';
$out .= get_date_from_gmt( $created, 'h:i:s A' );
$out .= get_date_from_gmt( $created, 'h:i:s A T' );
break;

case 'summary':
Expand Down
2 changes: 1 addition & 1 deletion classes/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Plugin {
*
* @const string
*/
const VERSION = '4.0.0';
const VERSION = '4.0.1';

/**
* WP-CLI command
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"wp-coding-standards/wpcs": "^3.1",
"wp-phpunit/wp-phpunit": "^6.6",
"wpackagist-plugin/advanced-custom-fields": "6.3.4",
"wpackagist-plugin/classic-editor": "1.6.4",
"wpackagist-plugin/easy-digital-downloads": "3.3.1",
"wpackagist-plugin/jetpack": "13.6",
"wpackagist-plugin/user-switching": "1.8.0",
Expand Down
20 changes: 19 additions & 1 deletion composer.lock

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

6 changes: 6 additions & 0 deletions connectors/class-connector-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,16 @@ public function registered_post_type( $post_type, $args ) {
* @param \WP_Post $post Post object.
*/
public function callback_transition_post_status( $new_status, $old_status, $post ) {

if ( in_array( $post->post_type, $this->get_excluded_post_types(), true ) ) {
return;
}

// We don't want the meta box update request, just the post update.
if ( ! empty( wp_stream_filter_input( INPUT_GET, 'meta-box-loader' ) ) ) {
return;
}

$start_statuses = array( 'auto-draft', 'inherit', 'new' );
if ( in_array( $new_status, $start_statuses, true ) ) {
return;
Expand Down
4 changes: 4 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ In order to set up Step Debugging in PhpStorm, follow the [official guide](https

We use a [MailHog](https://github.com/mailhog/MailHog) container to capture all emails sent by the WordPress container, available at [stream.wpenv.net:8025](https://stream.wpenv.net:8025).

### phpMyAdmin

[phpMyAdmin ](https://www.phpmyadmin.net/) is available at [stream.wpenv.net:8080](http://stream.wpenv.net:8080/).

### Scripts and Commands

We use npm as the canonical task runner for the project. The following commands are available:
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ services:
image: mariadb:11.4.2
volumes:
- db_data:/var/lib/mysql
ports:
- "3306:3306"
restart: always
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password

phpmyadmin:
image: phpmyadmin:5.2.1
ports:
- "8080:80"
depends_on:
- mysql
environment:
PMA_HOST: mysql
PMA_USER: root
PMA_PASSWORD: password

wordpress:
image: ghcr.io/xwp/stream-wordpress:${WORDPRESS_IMAGE_VERSION:-latest}
build:
Expand Down
12 changes: 9 additions & 3 deletions exporters/class-exporter-csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,18 @@ public function output_file( $data, $columns ) {
header( 'Content-Disposition: attachment; filename="stream.csv"' );
}

$output = join( ',', array_values( $columns ) ) . "\n";
ob_start();

$csv = fopen( 'php://output', 'w' );
fputcsv( $csv, array_values( $columns ) );

foreach ( $data as $row ) {
$output .= join( ',', $row ) . "\n";
fputcsv( $csv, $row );
}
fclose( $csv ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose

echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

echo $output; // @codingStandardsIgnoreLine text-only output
if ( ! defined( 'WP_STREAM_TESTS' ) || ( defined( 'WP_STREAM_TESTS' ) && ! WP_STREAM_TESTS ) ) {
exit;
}
Expand Down
35 changes: 34 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: xwp
Tags: wp stream, stream, activity, logs, track
Requires at least: 4.6
Tested up to: 6.6
Stable tag: 4.0.0
Stable tag: 4.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -134,6 +134,39 @@ Use only `$_SERVER['REMOTE_ADDR']` as the client IP address for event logs witho

== Changelog ==

= 4.0.1 - July 30, 2024 =

**Bug fixes**

- Fix PHP Type error in CLI (in [#1475](https://github.com/xwp/stream/pull/1475)) props [@Soean](https://github.com/Soean)
- Fix Uncaught ValueError in Gravity Forms and WordPress SEO connectors (in [#1508](https://github.com/xwp/stream/pull/1508)) props [@krokodok](https://github.com/krokodok)
- Fix dynamic callback method detection for custom connectors (in [#1469](https://github.com/xwp/stream/pull/1469)) props [@shadyvb](https://github.com/shadyvb)
- Fix PHP warning in PHP 8 by adjusting exclude rules filtering to avoid passing null to `strlen()` (in [#1513](https://github.com/xwp/stream/pull/1513)) props [@ocean90](https://github.com/ocean90)
- Fix adding multiple columns to the stream table using filters only displays the last column correctly (in [#1519](https://github.com/xwp/stream/pull/1519)) props [@thefrosty](https://github.com/thefrosty)
- Fix offset warning in Slack alert when there is no custom logo (in [#1522](https://github.com/xwp/stream/pull/1522)) props [@benerd](https://github.com/benerd)
- Fix BuddyPress Connector, check for BuddyPress dependencies before using (in [#1517](https://github.com/xwp/stream/pull/1517)) props [@dd32](https://github.com/dd32)
- Fix [Security] Update `select2` to `4.0.13` (in [#1495](https://github.com/xwp/stream/pull/1495))

**Development**

- Update local development environment to use Docker (in [#1423](https://github.com/xwp/stream/pull/1423))
- Update `wp-coding-standards/wpcs` and fix all linting issues
- Require PHP ≥ 7.0 and WordPress ≥ 4.6
- Allow switching between PHP 7.4 and PHP 8.2
- Document Connectors (in [#1518](https://github.com/xwp/stream/pull/1518))
- Update dependencies
- `eslint` to `^8.57.0` (in [#1480](https://github.com/xwp/stream/pull/1480))
- `@babel/traverse` from `7.20.10` to `7.23.2` (in [#1463](https://github.com/xwp/stream/pull/1463))
- `braces` from `3.0.2` to `3.0.3` (in [#1487](https://github.com/xwp/stream/pull/1487))
- `composer/composer` from `2.2.21` to `2.2.24` (in [#1488](https://github.com/xwp/stream/pull/1488))
- `@wordpress/eslint-plugin` to `v19` (in [#1452](https://github.com/xwp/stream/pull/1452))
- `@wordpress/eslint-plugin` to `^19.2.0` (in [#1490](https://github.com/xwp/stream/pull/1490))

**Deprecations**

- Deprecate PHP 5.6 (in [#1499](https://github.com/xwp/stream/issues/1499))
- Deprecate `wp_stream_register_column_defaults` filter (in [#1519](https://github.com/xwp/stream/pull/1519))

= 4.0.0 - January 9, 2024 =

- Fix: Use only `$_SERVER['REMOTE_ADDR']` as the reliable client IP address for event logs. This might cause incorrectly reported event log IP addresses on environments where PHP is behind a proxy server or CDN. Use the `wp_stream_client_ip_address` filter to set the correct client IP address (see `readme.txt` for instructions) or configure the hosting environment to report the correct IP address in `$_SERVER['REMOTE_ADDR']` (issue [#1456](https://github.com/xwp/stream/issues/1456), props [@calvinalkan](https://github.com/calvinalkan)).
Expand Down
2 changes: 1 addition & 1 deletion stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Stream
* Plugin URI: https://xwp.co/work/stream/
* Description: Stream tracks logged-in user activity so you can monitor every change made on your WordPress site in beautifully organized detail. All activity is organized by context, action and IP address for easy filtering. Developers can extend Stream with custom connectors to log any kind of action.
* Version: 4.0.0
* Version: 4.0.1
* Author: XWP
* Author URI: https://xwp.co
* License: GPLv2+
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/test-class-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function test_render_download() {
$output = ob_get_clean();

$this->assertNotEmpty( $output );
$this->assertStringStartsWith( 'Date,Summary,User,Connector,Context,Action,IP Address', $output );
$this->assertStringStartsWith( 'Date,Summary,User,"User ID",Connector,Context,"Object ID",Action,"IP Address"', $output );

unset( $_GET['action'] );
}
Expand Down
5 changes: 1 addition & 4 deletions ui/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,11 @@

.toplevel_page_wp_stream .column-date {
width: 120px;
white-space: nowrap;
}

.toplevel_page_wp_stream .column-date .timeago {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
padding-bottom: 2px;
}

.toplevel_page_wp_stream .column-user_id {
Expand Down

0 comments on commit a1c8287

Please sign in to comment.