Skip to content

Commit

Permalink
Merge pull request #280 from pantheon-systems/release_1.4.2
Browse files Browse the repository at this point in the history
Release 1.4.2
  • Loading branch information
jazzsequence authored Nov 8, 2023
2 parents e482b03 + 99a8cde commit 5cd922e
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 76 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** comments, sessions
**Requires at least:** 4.7
**Tested up to:** 6.3
**Stable tag:** 1.4.1
**Stable tag:** 1.4.2
**Requires PHP:** 5.4
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -57,17 +57,7 @@ Added in 1.4.0. If you have run the `add-index` command and have verified that t
Added in 1.4.0. If you have run the `add-index` command and something unexpected has occurred, just run the `primary-key-revert` command and the backup table will immediately be returned to being the active table.

### WordPress Multisite
As of 1.4.1 the `add-index`, `primary-key-add` and `primary-key-revert` commands only apply to a single site. This means that to run on a WordPress multisite, for sites beyond the main site, you would need to pass the `--url=` flag for each subsite.

However, you can script this process in bash by getting a list of sites and looping over them:

```bash
for site in $(wp site list --field=url); do
wp pantheon session add-index --url=$site
done
```

This can be applied to any of the other commands as needed to do them all in one go. We will be updating the command to iterate over all the sites in a multisite in a forthcoming release.
As of 1.4.2 the `add-index`, `primary-key-add` and `primary-key-revert` commands are fully multisite compatible.


## Contributing ##
Expand Down Expand Up @@ -108,6 +98,11 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis

## Changelog ##

### 1.4.2 (November 8, 2023) ###
* Fixed an issue with the `pantheon session add-index` PHP warning. [[#276](https://github.com/pantheon-systems/wp-native-php-sessions/pull/276/files)]
* Fixed a syntax issue with the suggested WP CLI commands [[#278](https://github.com/pantheon-systems/wp-native-php-sessions/pull/278)]
* Made `wp pantheon session add-index`, `wp pantheon session primary-key-finalize`, and `wp pantheon session primary-key-revert` fully multisite compatible. [[#275](https://github.com/pantheon-systems/wp-native-php-sessions/pull/275)]

### 1.4.1 (October 23, 2023) ###
* Fixed an issue with the `pantheon session add-index` command not working properly on WP multisite [[#270](https://github.com/pantheon-systems/wp-native-php-sessions/pull/270)]
* Made the notice added in 1.4.0 dismissable (stores in user meta) & hides for multisite (an update is coming to iterate through all sites on a network) [[#271](https://github.com/pantheon-systems/wp-native-php-sessions/pull/271)]
Expand Down
19 changes: 11 additions & 8 deletions inc/class-cli-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,32 @@ public function delete( $args, $assoc_args ) {
*
* @subcommand add-index
*/
public function add_index( $args, $assoc_arc ) {
public function add_index( $args, $assoc_args ) {
$pantheon_session = new \Pantheon_Sessions();
$pantheon_session->add_index();
$resume_point = isset( $assoc_args['start_point'] ) ? $assoc_args['start_point'] : 0;
$pantheon_session->add_index( $resume_point );
}

/**
* Finalizes the creation of a primary key by deleting the old data.
*
* @subcommand primary-key-finalize
*/
public function primary_key_finalize() {
$pan_session = new \Pantheon_Sessions();
$pan_session->primary_key_finalize();
public function primary_key_finalize( $args, $assoc_args ) {
$pantheon_session = new \Pantheon_Sessions();
$resume_point = isset( $assoc_args['start_point'] ) ? $assoc_args['start_point'] : 0;
$pantheon_session->primary_key_finalize( $resume_point );
}

/**
* Reverts addition of primary key.
*
* @subcommand primary-key-revert
*/
public function primary_key_revert() {
$pan_session = new \Pantheon_Sessions();
$pan_session->primary_key_revert();
public function primary_key_revert( $args, $assoc_args ) {
$pantheon_session = new \Pantheon_Sessions();
$resume_point = isset( $assoc_args['start_point'] ) ? $assoc_args['start_point'] : 0;
$pantheon_session->primary_key_revert( $resume_point );
}
}

Expand Down
Loading

0 comments on commit 5cd922e

Please sign in to comment.