Skip to content

Commit

Permalink
Merge pull request #595 from pantheon-systems/release-2.5.0
Browse files Browse the repository at this point in the history
Release 2.5.0
  • Loading branch information
pwtyler authored Jul 12, 2023
2 parents fd8ed9e + d436009 commit e04d9b8
Show file tree
Hide file tree
Showing 17 changed files with 203 additions and 89 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,8 @@ jobs:

- name: Install dependencies
run: composer install

- name: "Run Tests"
run: |
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 latest
composer phpunit
rm -rf $WP_TESTS_DIR $WP_CORE_DIR
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 nightly true
WP_MULTISITE=1 composer phpunit
run: bash bin/phpunit-test.sh

test-behat:
needs: test-phpunit
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ vendor/
assets/css/*.css
assets/css/*.css.map
assets/js/*.js
composer.lock
composer.lock
.envrc
18 changes: 11 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
## Changelog ##

## 2.4.5 (April 9, 2023) ##
### 2.5.0 ###
* Updates CONTRIBUTING.md [[#585](https://github.com/pantheon-systems/solr-power/pull/585)] [[#594](https://github.com/pantheon-systems/solr-power/pull/594)]
* Fixes typo in var which caused undefined notice [[#582](https://github.com/pantheon-systems/solr-power/pull/582)]
* Update Composer dependencies [[#576](https://github.com/pantheon-systems/solr-power/pull/576)] [[#574](https://github.com/pantheon-systems/solr-power/pull/583)] [[#573](https://github.com/pantheon-systems/solr-power/pull/584)]
* Updates security policy [[#589](https://github.com/pantheon-systems/solr-power/pull/589)]
* Disable auto-commit by default. [[#591](https://github.com/pantheon-systems/solr-power/pull/591)]

### 2.4.5 (April 9, 2023) ###
* Fixes missing vendor/ directory in previous release [[#580](https://github.com/pantheon-systems/solr-power/pull/580)]

## 2.4.4 (April 7, 2023) ##
### 2.4.4 (April 7, 2023) ###
* Update Composer dependencies [[#576](https://github.com/pantheon-systems/solr-power/pull/576)] [[#574](https://github.com/pantheon-systems/solr-power/pull/574)] [[#573](https://github.com/pantheon-systems/solr-power/pull/573)]
* Fix failing tests [[#577](https://github.com/pantheon-systems/solr-power/pull/577)]
* Update tested up to version

## 2.4.3 (January 19, 2022) ##
* Include schema.xml in release distribution [[#568](https://github.com/pantheon-systems/solr-power/pull/568)]

## 2.4.2 (December 2, 2022) ##
### 2.4.2 (December 2, 2022) ###
* Re-add changelog heading to readme.txt [[#564](https://github.com/pantheon-systems/solr-power/pull/564)]

## 2.4.1 (December 1, 2022) ##
### 2.4.1 (December 1, 2022) ###
* Fixes the WordPress `readme.txt` [[#562](https://github.com/pantheon-systems/solr-power/pull/562/)]

## 2.4.0 (November 30, 2022) ##
* Adds Github Actions for building tag and deploying to wp.org. Add CONTRIBUTING.md. [[#551](https://github.com/pantheon-systems/solr-power/issues/551)]
* Added SOLRPOWER_DISABLE_AUTOCOMMIT to disable autocommitting of posts, moved CHANGELOG to it's own file, added `$post->score` value to parsed search results [[#559](https://github.com/pantheon-systems/solr-power/pull/559)]

## 2.3.3 (September 28, 2022) ##
* Fixes issue where options could not be saved [[#541](https://github.com/pantheon-systems/solr-power/issues/541)]
* Enforces network activation requirement for WordPress multisite [[#538](https://github.com/pantheon-systems/solr-power/issues/538)]

Expand Down
38 changes: 28 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ Since 2.3.3 the default branch is `main`. Please make sure you are working again

## Workflow

The `develop` branch is the development branch which means it contains the next version to be released. `main` contains the corresponding stable development version. Always work on the `develop` branch and open up PRs against `develop`.
Development and releases are structured around two branches, `develop` and `main`. The `develop` branch is the source and destination for feature branches.

We prefer to squash commits (i.e. avoid merge PRs) from a feature branch into `develop` when merging, and to include the PR # in the commit message. PRs to `develop` should also include any relevent updates to the changelog in readme.txt. For example, if a feature constitutes a minor or major version bump, that version update should be discussed and made as part of approving and merging the feature into `develop`.

`develop` should be stable and usable, though possibly a few commits ahead of the public release on wp.org.

The `main` branch matches the latest stable release deployed to [wp.org](wp.org).

## Testing

Expand All @@ -23,12 +29,24 @@ Note that dependencies are installed via Composer and the `vendor` directory is

## Release Process

1. Starting from `develop`, cut a release branch named `release_X.Y.Z` containing your changes.
1. Update plugin version in `package.json`, `README.md`, `readme.txt`, and `solr-power.php`.
1. Update the Changelog with the latest changes.
1. Create a PR against the `main` branch.
1. After all tests pass and you have received approval from a CODEOWNER (including resolving any merge conflicts), merge the PR into `main`.
1. [Check the _Build and Tag_ action](https://github.com/pantheon-systems/solr-power/actions/workflows/build-tag.yml): a new tag named with the version number should've been created. It should contain all the built assets.
1. Create a [new release](https://github.com/pantheon-systems/solr-power/releases/new), naming the release with the new version number, and targeting the tag created in the previous step. Paste the release changelog from `CHANGELOG.md` into the body of the release and include a link to the closed issues if applicable.
1. Wait for the [_Release solr-power plugin to wp.org_ action](https://github.com/pantheon-systems/solr-power/actions/workflows/wordpress-plugin-deploy.yml) to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
1. Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/solr-power/. This may take a few minutes.
1. From `develop`, checkout a new branch `release_X.Y.Z`.
1. Make a release commit:
* Drop the `-dev` from the version number in `package.json`, `README.md`, `readme.txt`, CHANGELOG.md, and `solr-power.php`. For `readme.txt`, the version number must be updated both at the top of the document as well as the changelog.
* Add the date to the `** X.Y.X **` heading in the changelogs in README.md, readme.txt, and any other appropriate location.
* Commit these changes with the message `Release X.Y.Z`
* Push the release branch up.
1. Open a Pull Request to merge `release_X.Y.Z` into `main`. Your PR should consist of all commits to `develop` since the last release, and one commit to update the version number. The PR name should also be `Release X.Y.Z`.
1. After all tests pass and you have received approval from a [CODEOWNER](./CODEOWNERS), merge the PR into `main`. "merge" is preferred in this case, not rebase. _Never_ squash to `main`.
1. Pull `main` locally, create a new tag (based on version number from previous steps), and push up. The tag should _only_ be the version number. It _should not_ be prefixed `v` (i.e. `X.Y.Z`, not `vX.Y.X`).
1. Confirm that the necessary assets are present in the newly created tag, and test on a WP install if desired.
1. Create a [new release](https://github.com/pantheon-systems/solr-power/releases/new) using the tag created in the previous steps, naming the release with the new version number, and targeting the tag created in the previous step. Paste the release changelog from the `Changelog` section of [the readme](readme.txt) into the body of the release, including the links to the closed issues if applicable.
1. Wait for the [_Release solr-power plugin to wp.org_ action](https://github.com/pantheon-systems/solr-power/actions/workflows/wordpress-plugin-deploy.yml) to finish deploying to the WordPress.org plugin repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
1. Check WordPress.org: Ensure that the changes are live on [the plugin repository](https://wordpress.org/plugins/solr-power/). This may take a few minutes.
1. Following the release, prepare the next dev version with the following steps:
* `git checkout develop`
* `git rebase main`
* Update the version number in all locations, incrementing the version by one patch version, and add the `-dev` flag (e.g. after releasing `1.2.3`, the new verison will be `1.2.4-dev`)
* Add new `** X.Y.X-dev **` headings to the changelogs
* `git add -A .`
* `git commit -m "Prepare X.Y.X-dev"`
* `git push origin develop`
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Requires at least:** 4.6
**Requires PHP:** 7.1
**Tested up to:** 6.2
**Stable tag:** 2.4.5
**Stable tag:** 2.5.0
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -204,17 +204,24 @@ Add the following to your `functions.php` file.

## Explicit Commit vs Autocommit ##

Once solr has sent the data to the solr server, solr must COMMIT the data to the index and adjust the index and
relevancy ratings accordingly before that data can appear in search results. By default, Solr Search for WordPress does this when it sends every post. It may be necessary on occasion to disable this behavior (e.g. when importing a lot of posts via CSV). To do this, you need add the following code to your index.php in the root of your site install:
Once solr has sent the data to the solr server, solr must COMMIT the data to the index and adjust the index and relevancy ratings accordingly before that data can appear in search results.

By default, Solr Search for WordPress has auto-commit disabled. The index is committed when the uncommitted item is two minutes old, or the cron runs. By default, the cron runs on the Pantheon platform every hour.

When autocommit is enabled, Solr Search for WordPress commits data when it sends every post. When running on Pantheon, we recommend leaving autocommit disabled to aid overall site performance.

To enable autocommit, add the following to `wp-config.php` or an mu-plugin.

```php
define( 'SOLRPOWER_DISABLE_AUTOCOMMIT', true );
define( 'SOLRPOWER_DISABLE_AUTOCOMMIT', false );
```

When this variable is defined, Solr Search for WordPress will not commit the index until the uncommitted item is two minutes old or the cron runs. By default, the cron runs on the Pantheon platform every hour.

To force-commit data when this variable is defined outside of a normal cron run, from the command line, you can run the command below or simply force a cron-run.
To force-commit data outside of a normal cron run, from the command line, you can run the command below or simply force a cron-run.

```bash
wp solr commit
```

## Security Policy
### Reporting Security Bugs
Please report security bugs found in the Solr Power plugin's source code through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/solr-power). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.
10 changes: 10 additions & 0 deletions bin/phpunit-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

DIRNAME=$(dirname "$0")
bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest
composer test
rm -rf $WP_TESTS_DIR $WP_CORE_DIR

bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest true
WP_MULTISITE=1 composer test
16 changes: 12 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"support": {
"issues": "https://github.com/pantheon-systems/solr-power/issues"
"issues": "https://github.com/pantheon-systems/solr-power/issues"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -32,7 +32,7 @@
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"phpunit/phpunit": "^6 || ^7",
"phpcompatibility/php-compatibility": "^9.3",
"yoast/phpunit-polyfills": "^1.0"
"yoast/phpunit-polyfills": "^2.0"
},
"scripts": {
"lint": [
Expand All @@ -45,11 +45,19 @@
"phpcs": "vendor/bin/phpcs",
"phpcbf": "vendor/bin/phpcbf",
"phpunit": "vendor/bin/phpunit",
"test": "@phpunit"
"phpunit-shouldcommit": [
"vendor/bin/phpunit --group should-commit --filter testShouldNotCommitWhenConstNull",
"vendor/bin/phpunit --group should-commit --filter testShouldNotCommitWhenConstTrue",
"vendor/bin/phpunit --group should-commit --filter testShouldCommitWhenConstFalse"
],
"test": [
"@phpunit-shouldcommit",
"@phpunit"
]
},
"autoload": {
"classmap": [
"includes"
]
}
}
}
28 changes: 14 additions & 14 deletions composer.lock

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

17 changes: 14 additions & 3 deletions includes/class-solrpower-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -734,16 +734,27 @@ function copy_config_to_all_blogs() {
* when the plugin posts data to Solr, but your Solr instance will need
* to have a cron job enabled that does a hard commit on a regular basis.
*
* To disable commiting to Solr, add the following to your wp-config.php
*
* To enable commiting to Solr, add the following to your wp-config.php
*
* <code>
* define( 'SOLRPOWER_DISABLE_AUTOCOMMIT', true );
* define( 'SOLRPOWER_DISABLE_AUTOCOMMIT', false );
* </code>
*
* As of 2.5.0, the default behavior is to not auto-commit.
* Yes, this function could be more concise, but the double-negative logic
* can be confusing so making the logic as explicit as possible.
*
* @see https://cwiki.apache.org/confluence/display/solr/UpdateXmlMessages#UpdateXmlMessages-%22commit%22and%22optimize%22
* @return bool Whether to commit immediately when writing site data to Solr.
*/
function should_commit() {
return ! ( defined( 'SOLRPOWER_DISABLE_AUTOCOMMIT' ) && SOLRPOWER_DISABLE_AUTOCOMMIT );
// Auto-commit is explicitly enabled by not disabling it 🤮.
if ( defined( 'SOLRPOWER_DISABLE_AUTOCOMMIT' ) && ! SOLRPOWER_DISABLE_AUTOCOMMIT ) {
return true;
}

// Do not autocommit, as cron will take care of it.
return false;
}
}
Loading

0 comments on commit e04d9b8

Please sign in to comment.