From 4bd3167dfee95aa10cc43080c9e8e589430e0a0e Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Tue, 17 Oct 2023 17:50:46 -0400 Subject: [PATCH 1/8] Prepare 1.4.1-dev --- README.md | 4 +++- readme.txt | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 99853b4..68aaa85 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Tags:** comments, sessions **Requires at least:** 4.7 **Tested up to:** 6.3 -**Stable tag:** 1.4.0 +**Stable tag:** 1.4.1-dev **Requires PHP:** 5.4 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -94,6 +94,8 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis ## Changelog ## +### 1.4.1-dev ### + ### 1.4.0 (October 17, 2023) ### * Adds new CLI command to add a Primary Column (id) to the `pantheon_sessions` table for users who do not have one. [[#265](https://github.com/pantheon-systems/wp-native-php-sessions/pull/265)] * Adds alert to dashboard for users who need to run the new command. diff --git a/readme.txt b/readme.txt index 1e8a043..c0af215 100644 --- a/readme.txt +++ b/readme.txt @@ -93,6 +93,8 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis == Changelog == += 1.4.1-dev = + = 1.4.0 = * Adds new CLI command to add a Primary Column (id) to the `pantheon_sessions` table for users who do not have one. [[#265](https://github.com/pantheon-systems/wp-native-php-sessions/pull/265)] * Adds alert to dashboard for users who need to run the command. From a35d5dd24ee015db77c8970f5f0364116924db71 Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Thu, 19 Oct 2023 11:16:43 -0400 Subject: [PATCH 2/8] [BUGS-6987]: Changes base_prefix to prefix to support multisite. --- pantheon-sessions.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pantheon-sessions.php b/pantheon-sessions.php index 149b13a..ded3b2f 100644 --- a/pantheon-sessions.php +++ b/pantheon-sessions.php @@ -267,8 +267,8 @@ public static function force_first_load() { */ public static function check_native_primary_keys() { global $wpdb; - $table_name = $wpdb->base_prefix . 'pantheon_sessions'; - $old_table = $wpdb->base_prefix . 'bak_pantheon_sessions'; + $table_name = $wpdb->prefix . 'pantheon_sessions'; + $old_table = $wpdb->prefix . 'bak_pantheon_sessions'; $query = "SHOW KEYS FROM {$table_name} WHERE key_name = 'PRIMARY';"; $key_existence = $wpdb->get_results( $query ); @@ -310,8 +310,8 @@ public static function check_native_primary_keys() { public function add_index() { global $wpdb; $unprefixed_table = 'pantheon_sessions'; - $table = $wpdb->base_prefix . $unprefixed_table; - $temp_clone_table = $wpdb->base_prefix . 'sessions_temp_clone'; + $table = $wpdb->prefix . $unprefixed_table; + $temp_clone_table = $wpdb->prefix . 'sessions_temp_clone'; // If the command has been run multiple times and there is already a // temp_clone table, drop it. @@ -371,7 +371,7 @@ public function add_index() { // Hot swap the old table and the new table, deleting a previous old // table if necessary. - $old_table = $wpdb->base_prefix . 'bak_' . $unprefixed_table; + $old_table = $wpdb->prefix . 'bak_' . $unprefixed_table; $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $old_table ) ); if ( $wpdb->get_var( $query ) == $old_table ) { @@ -392,7 +392,7 @@ public function add_index() { */ public function primary_key_finalize() { global $wpdb; - $table = $wpdb->base_prefix . 'bak_pantheon_sessions'; + $table = $wpdb->prefix . 'bak_pantheon_sessions'; $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table ) ); @@ -413,9 +413,9 @@ public function primary_key_finalize() { */ public function primary_key_revert() { global $wpdb; - $old_clone_table = $wpdb->base_prefix . 'bak_pantheon_sessions'; - $temp_clone_table = $wpdb->base_prefix . 'temp_pantheon_sessions'; - $table = $wpdb->base_prefix . 'pantheon_sessions'; + $old_clone_table = $wpdb->prefix . 'bak_pantheon_sessions'; + $temp_clone_table = $wpdb->prefix . 'temp_pantheon_sessions'; + $table = $wpdb->prefix . 'pantheon_sessions'; // If there is no old table to roll back to, error. $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $old_clone_table ) ); From 5ccb9d4b7e8fde3dbcb63d8194dc2819b415dc1d Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Thu, 19 Oct 2023 11:18:34 -0400 Subject: [PATCH 3/8] [BUGS-6987]: Adds trailing spaces for linting. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 68aaa85..b268ee9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Tags:** comments, sessions **Requires at least:** 4.7 **Tested up to:** 6.3 -**Stable tag:** 1.4.1-dev +**Stable tag:** 1.4.1-dev **Requires PHP:** 5.4 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html From f1ec9595a94bc6944388673749d21a250cd780b6 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 19 Oct 2023 15:50:10 -0600 Subject: [PATCH 4/8] [CMSP-743] Update the notice language and make it dismissable (#271) * define the wp-cli command varied on pantheon env * update the notice * vary the finalize/revert commands based on pantheon env * add a custom directory installer and use it for wptrt/admin-notices we want this library to be part of the plugin * use pantheon-systems/wpunit-helpers * delete the scripts managed by wpunit-helpers * add a script to get the wptrt loader file from github & add it * get rid of the trt notices stuff couldn't get it working, was able to use an admin ajax way of doing it * add a notice dismissal script * hide the notice if dismissed * remove composer/installers, too don't need that either * linting fixes * update changelog * update readme with notes for running the command on multisite * remove lint.yml that got merged in by accident --- .github/workflows/lint.yml | 24 ---- .gitignore | 4 + README.md | 17 +++ assets/js/notices.js | 11 ++ bin/install-local-tests.sh | 61 ---------- bin/install-wp-tests.sh | 151 ----------------------- bin/phpunit-test.sh | 18 --- composer.json | 7 +- composer.lock | 244 ++++++++++++++++++++++--------------- pantheon-sessions.php | 78 ++++++++---- readme.txt | 23 +++- 11 files changed, 259 insertions(+), 379 deletions(-) delete mode 100644 .github/workflows/lint.yml create mode 100644 assets/js/notices.js delete mode 100644 bin/install-local-tests.sh delete mode 100755 bin/install-wp-tests.sh delete mode 100644 bin/phpunit-test.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 66d11af..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Lint and Test -on: push - -jobs: - lint: - runs-on: ubuntu-latest - name: Lint - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ~/vendor - key: test-lint-dependencies-{{ checksum "composer.json" }} - restore-keys: test-lint-dependencies-{{ checksum "composer.json" }} - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - - name: Install dependencies - run: composer install -n --prefer-dist - - name: Run PHP Lint - run: composer phpcs diff --git a/.gitignore b/.gitignore index 302abb2..95ce030 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ Thumbs.db wp-cli.local.yml node_modules/ vendor/ +# Managed by wpunit-helpers +bin/install-local-tests.sh +bin/install-wp-tests.sh +bin/phpunit-test.sh diff --git a/README.md b/README.md index b268ee9..891ccdb 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,21 @@ 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); +then + wp pantheon session add-index +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. + + ## Contributing ## See [CONTRIBUTING.md](https://github.com/pantheon-systems/wp-native-php-sessions/blob/main/CONTRIBUTING.md) for information on contributing. @@ -95,6 +110,8 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis ## Changelog ## ### 1.4.1-dev ### +* 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)] ### 1.4.0 (October 17, 2023) ### * Adds new CLI command to add a Primary Column (id) to the `pantheon_sessions` table for users who do not have one. [[#265](https://github.com/pantheon-systems/wp-native-php-sessions/pull/265)] diff --git a/assets/js/notices.js b/assets/js/notices.js new file mode 100644 index 0000000..f880014 --- /dev/null +++ b/assets/js/notices.js @@ -0,0 +1,11 @@ +jQuery(document).ready(function($) { + $(document).on('click', '.notice-dismiss', function() { + $.ajax({ + url: ajaxurl, + type: 'POST', + data: { + action: 'dismiss_notice' + } + }); + }); +}); diff --git a/bin/install-local-tests.sh b/bin/install-local-tests.sh deleted file mode 100644 index c1f8cc5..0000000 --- a/bin/install-local-tests.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -set -e - -# Initialize variables with default values -TMPDIR="/tmp" -DB_NAME="wordpress_test" -DB_USER="root" -DB_PASS="" -DB_HOST="127.0.0.1" -WP_VERSION="latest" -SKIP_DB="" - -# Display usage information -usage() { - echo "Usage:" - echo "./install-local-tests.sh [--dbname=wordpress_test] [--dbuser=root] [--dbpass=''] [--dbhost=127.0.0.1] [--wpversion=latest] [--no-db]" -} - -# Parse command-line arguments -for i in "$@" -do -case $i in - --dbname=*) - DB_NAME="${i#*=}" - shift - ;; - --dbuser=*) - DB_USER="${i#*=}" - shift - ;; - --dbpass=*) - DB_PASS="${i#*=}" - shift - ;; - --dbhost=*) - DB_HOST="${i#*=}" - shift - ;; - --wpversion=*) - WP_VERSION="${i#*=}" - shift - ;; - --no-db) - SKIP_DB="true" - shift - ;; - *) - # unknown option - usage - exit 1 - ;; -esac -done - -# Run install-wp-tests.sh -echo "Installing local tests into ${TMPDIR}" -bash "$(dirname "$0")/install-wp-tests.sh" "$DB_NAME" "$DB_USER" "$DB_PASS" "$DB_HOST" "$WP_VERSION" "$SKIP_DB" - -# Run PHPUnit -echo "Running PHPUnit" -composer phpunit diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh deleted file mode 100755 index 675dd97..0000000 --- a/bin/install-wp-tests.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env bash - -if [ $# -lt 3 ]; then - echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" - exit 1 -fi - -DB_NAME=$1 -DB_USER=$2 -DB_PASS=$3 -DB_HOST=${4-localhost} -WP_VERSION=${5-latest} -SKIP_DB_CREATE=${6-false} - -TMPDIR=${TMPDIR-/tmp} -WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} -WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} - -download() { - if [ `which curl` ]; then - curl -s "$1" > "$2"; - elif [ `which wget` ]; then - wget -nv -O "$2" "$1" - fi -} - -if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then - WP_TESTS_TAG="branches/$WP_VERSION" -elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then - if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then - # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x - WP_TESTS_TAG="tags/${WP_VERSION%??}" - else - WP_TESTS_TAG="tags/$WP_VERSION" - fi -elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then - WP_TESTS_TAG="trunk" -else - # http serves a single offer, whereas https serves multiple. we only want one - download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json - grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json - LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') - if [[ -z "$LATEST_VERSION" ]]; then - echo "Latest WordPress version could not be found" - exit 1 - fi - WP_TESTS_TAG="tags/$LATEST_VERSION" -fi - -set -e - -install_wp() { - - if [ -d $WP_CORE_DIR ]; then - return; - fi - - mkdir -p $WP_CORE_DIR - - if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then - mkdir -p $TMPDIR/wordpress-nightly - download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip - unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/ - mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR - else - if [ $WP_VERSION == 'latest' ]; then - local ARCHIVE_NAME='latest' - elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then - # https serves multiple offers, whereas http serves single. - download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json - if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then - # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x - LATEST_VERSION=${WP_VERSION%??} - else - # otherwise, scan the releases and get the most up to date minor version of the major release - local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` - LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) - fi - if [[ -z "$LATEST_VERSION" ]]; then - local ARCHIVE_NAME="wordpress-$WP_VERSION" - else - local ARCHIVE_NAME="wordpress-$LATEST_VERSION" - fi - else - local ARCHIVE_NAME="wordpress-$WP_VERSION" - fi - download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz - tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR - fi - - download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php -} - -install_test_suite() { - # portable in-place argument for both GNU sed and Mac OSX sed - if [[ $(uname -s) == 'Darwin' ]]; then - local ioption='-i .bak' - else - local ioption='-i' - fi - - # set up testing suite if it doesn't yet exist - if [ ! -d $WP_TESTS_DIR ]; then - # set up testing suite - mkdir -p $WP_TESTS_DIR - svn co --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes - svn co --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data - fi - - if [ ! -f wp-tests-config.php ]; then - download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php - # remove all forward slashes in the end - WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") - sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php - fi - -} - -install_db() { - - if [ ${SKIP_DB_CREATE} = "true" ]; then - return 0 - fi - - # parse DB_HOST for port or socket references - local PARTS=(${DB_HOST//\:/ }) - local DB_HOSTNAME=${PARTS[0]}; - local DB_SOCK_OR_PORT=${PARTS[1]}; - local EXTRA="" - - if ! [ -z $DB_HOSTNAME ] ; then - if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then - EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" - elif ! [ -z $DB_SOCK_OR_PORT ] ; then - EXTRA=" --socket=$DB_SOCK_OR_PORT" - elif ! [ -z $DB_HOSTNAME ] ; then - EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" - fi - fi - - # create database - mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA -} - -install_wp -install_test_suite -install_db diff --git a/bin/phpunit-test.sh b/bin/phpunit-test.sh deleted file mode 100644 index 450c3a8..0000000 --- a/bin/phpunit-test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -DIRNAME=$(dirname "$0") - -bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest -echo "Running PHPUnit on Single Site" -composer phpunit -rm -rf "$WP_TESTS_DIR" "$WP_CORE_DIR" - -bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 nightly true -echo "Running PHPUnit on Single Site (Nightly WordPress)" -composer phpunit - -bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest true -echo "Running PHPUnit on Multisite" -WP_MULTISITE=1 composer phpunit diff --git a/composer.json b/composer.json index 8083ba8..4634a7c 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "require-dev": { "pantheon-systems/pantheon-wordpress-upstream-tests": "dev-master", "pantheon-systems/pantheon-wp-coding-standards": "^2.0", + "pantheon-systems/wpunit-helpers": "^1.0", "phpunit/phpunit": "^9", "yoast/phpunit-polyfills": "^2.0" }, @@ -34,7 +35,9 @@ }, "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - } + "dealerdirect/phpcodesniffer-composer-installer": true, + "pantheon-systems/wpunit-helpers": true + }, + "sort-packages": true } } diff --git a/composer.lock b/composer.lock index 97b6141..31381ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b40b554af1a7b400e1dd4bff4afb982e", + "content-hash": "a92957659a2954cb30276b6a855aad5d", "packages": [], "packages-dev": [ { @@ -589,30 +589,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -639,7 +639,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -655,7 +655,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "fabpot/goutte", @@ -719,16 +719,16 @@ }, { "name": "fig-r/psr2r-sniffer", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/php-fig-rectified/psr2r-sniffer.git", - "reference": "53ca1ecd62b0dc2ab8ea48635f583cb361c5e8f2" + "reference": "c950b88ed7ad8ae115e11896bbe36d5896aa4f36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig-rectified/psr2r-sniffer/zipball/53ca1ecd62b0dc2ab8ea48635f583cb361c5e8f2", - "reference": "53ca1ecd62b0dc2ab8ea48635f583cb361c5e8f2", + "url": "https://api.github.com/repos/php-fig-rectified/psr2r-sniffer/zipball/c950b88ed7ad8ae115e11896bbe36d5896aa4f36", + "reference": "c950b88ed7ad8ae115e11896bbe36d5896aa4f36", "shasum": "" }, "require": { @@ -769,9 +769,9 @@ ], "support": { "issues": "https://github.com/php-fig-rectified/psr2r-sniffer/issues", - "source": "https://github.com/php-fig-rectified/psr2r-sniffer/tree/1.5.0" + "source": "https://github.com/php-fig-rectified/psr2r-sniffer/tree/1.5.1" }, - "time": "2023-01-01T15:31:05+00:00" + "time": "2023-09-23T19:16:19+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1260,6 +1260,52 @@ "description": "PHPCS Rulesets for WordPress projects on Pantheon.", "time": "2023-09-12T17:25:08+00:00" }, + { + "name": "pantheon-systems/wpunit-helpers", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/pantheon-systems/wpunit-helpers.git", + "reference": "683c9eb83a76c5229a40eef2ec1b19162f162a50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pantheon-systems/wpunit-helpers/zipball/683c9eb83a76c5229a40eef2ec1b19162f162a50", + "reference": "683c9eb83a76c5229a40eef2ec1b19162f162a50", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0" + }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "composer-plugin", + "extra": { + "class": "Pantheon\\WPUnitHelpers\\Plugin" + }, + "autoload": { + "psr-4": { + "Pantheon\\WPUnitHelpers\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pantheon", + "email": "noreply@pantheon.io" + } + ], + "description": "Unified scripts for installing and running automated WP Unit Tests.", + "support": { + "issues": "https://github.com/pantheon-systems/wpunit-helpers/issues", + "source": "https://github.com/pantheon-systems/wpunit-helpers/tree/v1.0.1" + }, + "time": "2023-10-12T20:08:14+00:00" + }, { "name": "phar-io/manifest", "version": "2.0.3", @@ -1547,16 +1593,16 @@ }, { "name": "phpcsstandards/phpcsextra", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "98bcdbacbda14b1db85f710b1853125726795bbc" + "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/98bcdbacbda14b1db85f710b1853125726795bbc", - "reference": "98bcdbacbda14b1db85f710b1853125726795bbc", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/746c3190ba8eb2f212087c947ba75f4f5b9a58d5", + "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5", "shasum": "" }, "require": { @@ -1606,7 +1652,7 @@ "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", "source": "https://github.com/PHPCSStandards/PHPCSExtra" }, - "time": "2023-08-26T04:46:45+00:00" + "time": "2023-09-20T22:06:18+00:00" }, { "name": "phpcsstandards/phpcsutils", @@ -1683,16 +1729,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.0", + "version": "1.24.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6" + "reference": "bcad8d995980440892759db0c32acae7c8e79442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/3510b0a6274cc42f7219367cb3abfc123ffa09d6", - "reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", + "reference": "bcad8d995980440892759db0c32acae7c8e79442", "shasum": "" }, "require": { @@ -1724,22 +1770,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" }, - "time": "2023-09-07T20:46:32+00:00" + "time": "2023-09-26T12:28:12+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.28", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", - "reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { @@ -1796,7 +1842,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.28" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, "funding": [ { @@ -1804,7 +1850,7 @@ "type": "github" } ], - "time": "2023-09-12T14:36:20+00:00" + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2049,16 +2095,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.12", + "version": "9.6.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a122c2ebd469b751d774aa0f613dc0d67697653f" + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a122c2ebd469b751d774aa0f613dc0d67697653f", - "reference": "a122c2ebd469b751d774aa0f613dc0d67697653f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "shasum": "" }, "require": { @@ -2132,7 +2178,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.12" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" }, "funding": [ { @@ -2148,7 +2194,7 @@ "type": "tidelift" } ], - "time": "2023-09-12T14:39:31+00:00" + "time": "2023-09-19T05:39:22+00:00" }, { "name": "psr/container", @@ -3369,32 +3415,32 @@ }, { "name": "slevomat/coding-standard", - "version": "8.13.4", + "version": "8.14.1", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "4b2af2fb17773656d02fbfb5d18024ebd19fe322" + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/4b2af2fb17773656d02fbfb5d18024ebd19fe322", - "reference": "4b2af2fb17773656d02fbfb5d18024ebd19fe322", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.23.0", + "phpstan/phpdoc-parser": "^1.23.1", "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.26", - "phpstan/phpstan-deprecation-rules": "1.1.3", - "phpstan/phpstan-phpunit": "1.3.13", + "phpstan/phpstan": "1.10.37", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-phpunit": "1.3.14", "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "7.5.20|8.5.21|9.6.8|10.2.6" + "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" }, "type": "phpcodesniffer-standard", "extra": { @@ -3418,7 +3464,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.13.4" + "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" }, "funding": [ { @@ -3430,7 +3476,7 @@ "type": "tidelift" } ], - "time": "2023-07-25T10:28:55+00:00" + "time": "2023-10-08T07:28:08+00:00" }, { "name": "spryker/code-sniffer", @@ -3950,25 +3996,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.2", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3997,7 +4043,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -4013,7 +4059,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/dom-crawler", @@ -4176,29 +4222,26 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.0.2", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", - "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -4235,7 +4278,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" }, "funding": [ { @@ -4251,7 +4294,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/filesystem", @@ -5136,32 +5179,33 @@ }, { "name": "symfony/string", - "version": "v6.0.19", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" + "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", + "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339", + "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -5201,7 +5245,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.19" + "source": "https://github.com/symfony/string/tree/v6.3.5" }, "funding": [ { @@ -5217,7 +5261,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:36:10+00:00" + "time": "2023-09-18T10:38:32+00:00" }, { "name": "symfony/translation", @@ -5388,20 +5432,21 @@ }, { "name": "symfony/yaml", - "version": "v6.0.19", + "version": "v6.3.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "deec3a812a0305a50db8ae689b183f43d915c884" + "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/deec3a812a0305a50db8ae689b183f43d915c884", - "reference": "deec3a812a0305a50db8ae689b183f43d915c884", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e23292e8c07c85b971b44c1c4b87af52133e2add", + "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -5410,9 +5455,6 @@ "require-dev": { "symfony/console": "^5.4|^6.0" }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, "bin": [ "Resources/bin/yaml-lint" ], @@ -5442,7 +5484,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.0.19" + "source": "https://github.com/symfony/yaml/tree/v6.3.3" }, "funding": [ { @@ -5458,7 +5500,7 @@ "type": "tidelift" } ], - "time": "2023-01-11T11:50:03+00:00" + "time": "2023-07-31T07:08:24+00:00" }, { "name": "theseer/tokenizer", @@ -5512,16 +5554,16 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "bb792cb331472b82c5d7f28fb9b8ec2d20f68826" + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/bb792cb331472b82c5d7f28fb9b8ec2d20f68826", - "reference": "bb792cb331472b82c5d7f28fb9b8ec2d20f68826", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", "shasum": "" }, "require": { @@ -5568,7 +5610,13 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2023-08-21T14:28:38+00:00" + "funding": [ + { + "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "type": "custom" + } + ], + "time": "2023-09-14T07:06:09+00:00" }, { "name": "yoast/phpunit-polyfills", @@ -5640,5 +5688,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/pantheon-sessions.php b/pantheon-sessions.php index ded3b2f..2889169 100644 --- a/pantheon-sessions.php +++ b/pantheon-sessions.php @@ -1,7 +1,7 @@ prefix . 'pantheon_sessions'; - $old_table = $wpdb->prefix . 'bak_pantheon_sessions'; - $query = "SHOW KEYS FROM {$table_name} WHERE key_name = 'PRIMARY';"; - + $old_table = $wpdb->prefix . 'bak_pantheon_sessions'; + $query = "SHOW KEYS FROM {$table_name} WHERE key_name = 'PRIMARY';"; + $is_pantheon = isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ? true : false; + $wp_cli_cmd = $is_pantheon ? 'terminus wp <site>.<env> --' : 'wp'; + $cli_add_index = $wp_cli_cmd . 'pantheon session add-index'; $key_existence = $wpdb->get_results( $query ); + $user_id = get_current_user_id(); + $dismissed = get_user_meta( $user_id, 'notice_dismissed', true ); if ( empty( $key_existence ) ) { - // If the key doesn't exist, recommend remediation. - ?> -
-

- wp pantheon session add-index and verify that the process completes successfully and that this message goes away to resolve this issue on your live environment.', 'wp-native-php-sessions' ) ); + // TODO: Remove this conditional for multisite. See https://getpantheon.atlassian.net/browse/CMSP-744. + if ( is_multisite() || ! $dismissed ) { + // If the key doesn't exist, recommend remediation. ?> -

-
- +

+ +

+

+ $cli_add_index" ) ); + ?> +

+ + prepare( 'SHOW TABLES LIKE %s', @@ -291,14 +323,18 @@ public static function check_native_primary_keys() { // Check for table existence and delete if present. if ( $wpdb->get_var( $query ) == $old_table ) { + $cli_key_finalize = $wp_cli_cmd . 'pantheon session primary-key-finalize'; + $cli_key_revert = $wp_cli_cmd . 'pantheon session primary-key-revert'; + // If an old table exists but has not been removed, suggest doing so. ?>

- wp pantheon session primary-key-finalize to clean up old data, or run wp pantheon session primary-key-revert if there were issues.', 'wp-native-php-sessions' ) ); - ?> -

+ $cli_key_finalize", "$cli_key_revert" ) ); + ?> +

query( $query ); $current_results = $results + ( $batch_size * $i ); diff --git a/readme.txt b/readme.txt index c0af215..18bb718 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: getpantheon, outlandish josh, mpvanwinkle77, danielbachhuber, andr Tags: comments, sessions Requires at least: 4.7 Tested up to: 6.3 -Stable tag: 1.4.0 +Stable tag: 1.4.1-dev Requires PHP: 5.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -43,18 +43,30 @@ To override this use the `pantheon_session_expiration` filter before the WordPre == CLI Commands == -= `wp pantheon session add-index` = +**`wp pantheon session add-index`** Added in 1.4.0. This command should be run if your installation of the plugin occurred before the addition of the primary ID key to the session table in version 1.2.2. You will be automatically notified when you visit any admin page if this is the case. If there's no message, your version is good to go. Note that this command is non-destructive, a new table will be created and the existing one preserved in a backup state until you have verified that the upgrade is functioning as expected. -= `wp pantheon session primary-key-finalize` = +**`wp pantheon session primary-key-finalize`** Added in 1.4.0. If you have run the `add-index` command and have verified that the new table is functioning correctly, running the `primary-key-finalize` command will perform a database cleanup and remove the backup table. -= `wp pantheon session primary-key-revert` = +**`wp pantheon session primary-key-revert`** 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: + + for site in $(wp site list --field=url); + then + wp pantheon session add-index + 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. + == Contributing == See [CONTRIBUTING.md](https://github.com/pantheon-systems/wp-native-php-sessions/blob/main/CONTRIBUTING.md) for information on contributing. @@ -94,6 +106,9 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis == Changelog == = 1.4.1-dev = +* 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)] + = 1.4.0 = * Adds new CLI command to add a Primary Column (id) to the `pantheon_sessions` table for users who do not have one. [[#265](https://github.com/pantheon-systems/wp-native-php-sessions/pull/265)] From 20cf497699a35b682be5f66aa366b1d6639ef992 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 19 Oct 2023 15:52:57 -0600 Subject: [PATCH 5/8] Release 1.4.1 --- README.md | 4 ++-- pantheon-sessions.php | 4 ++-- readme.txt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 891ccdb..938bb8a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Tags:** comments, sessions **Requires at least:** 4.7 **Tested up to:** 6.3 -**Stable tag:** 1.4.1-dev +**Stable tag:** 1.4.1 **Requires PHP:** 5.4 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -109,7 +109,7 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis ## Changelog ## -### 1.4.1-dev ### +### 1.4.1 ### * 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)] diff --git a/pantheon-sessions.php b/pantheon-sessions.php index 2889169..4631af1 100644 --- a/pantheon-sessions.php +++ b/pantheon-sessions.php @@ -1,7 +1,7 @@ Date: Thu, 19 Oct 2023 16:09:57 -0600 Subject: [PATCH 6/8] add --url=$site in bash examples --- README.md | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 891ccdb..ba82348 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ However, you can script this process in bash by getting a list of sites and loop ```bash for site in $(wp site list --field=url); then - wp pantheon session add-index + wp pantheon session add-index --url=$site done ``` diff --git a/readme.txt b/readme.txt index 18bb718..1d84970 100644 --- a/readme.txt +++ b/readme.txt @@ -62,7 +62,7 @@ However, you can script this process in bash by getting a list of sites and loop for site in $(wp site list --field=url); then - wp pantheon session add-index + 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. From 7004e3d2208952fc832bf60d03ee97223bbfec31 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 19 Oct 2023 16:23:26 -0600 Subject: [PATCH 7/8] Update bash (#273) * add --url=$site in bash examples * Update README.md * Update readme.txt --------- Co-authored-by: Phil Tyler --- README.md | 5 ++--- readme.txt | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 891ccdb..12c0b70 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,8 @@ As of 1.4.1 the `add-index`, `primary-key-add` and `primary-key-revert` commands 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); -then - wp pantheon session add-index +for site in $(wp site list --field=url); do + wp pantheon session add-index --url=$site done ``` diff --git a/readme.txt b/readme.txt index 18bb718..5775532 100644 --- a/readme.txt +++ b/readme.txt @@ -60,9 +60,8 @@ As of 1.4.1 the `add-index`, `primary-key-add` and `primary-key-revert` commands However, you can script this process in bash by getting a list of sites and looping over them: - for site in $(wp site list --field=url); - then - wp pantheon session add-index + 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. From b27a206960a9fb0ed61b598259cd3e9e532e790a Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Mon, 23 Oct 2023 12:49:05 -0600 Subject: [PATCH 8/8] add release date --- README.md | 2 +- readme.txt | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 26224d3..a1bc7c4 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis ## Changelog ## -### 1.4.1 ### +### 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)] diff --git a/readme.txt b/readme.txt index 1175a8a..a1f3c88 100644 --- a/readme.txt +++ b/readme.txt @@ -43,15 +43,15 @@ To override this use the `pantheon_session_expiration` filter before the WordPre == CLI Commands == -**`wp pantheon session add-index`** +**wp pantheon session add-index** Added in 1.4.0. This command should be run if your installation of the plugin occurred before the addition of the primary ID key to the session table in version 1.2.2. You will be automatically notified when you visit any admin page if this is the case. If there's no message, your version is good to go. Note that this command is non-destructive, a new table will be created and the existing one preserved in a backup state until you have verified that the upgrade is functioning as expected. -**`wp pantheon session primary-key-finalize`** +**wp pantheon session primary-key-finalize** Added in 1.4.0. If you have run the `add-index` command and have verified that the new table is functioning correctly, running the `primary-key-finalize` command will perform a database cleanup and remove the backup table. -**`wp pantheon session primary-key-revert`** +**wp pantheon session primary-key-revert** 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. @@ -104,17 +104,15 @@ Adds a WP-CLI command to add an index to the sessions table if one does not exis == Changelog == -= 1.4.1 = += 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)] -= 1.4.0 = += 1.4.0 (October 17, 2023) = * Adds new CLI command to add a Primary Column (id) to the `pantheon_sessions` table for users who do not have one. [[#265](https://github.com/pantheon-systems/wp-native-php-sessions/pull/265)] * Adds alert to dashboard for users who need to run the command. * 8.3 compatibility and code quality updates - -= 1.3.7-dev = * Updates Pantheon WP Coding Standards to 2.0 [[#264](https://github.com/pantheon-systems/wp-native-php-sessions/pull/264)] = 1.3.6 (June 1, 2023) =