Skip to content

Commit

Permalink
fix: mess of naming plugin constants
Browse files Browse the repository at this point in the history
Using "ROTARACT_CLUB_FINDER_*" in preference of "ROTARACT_CLUBFINDER_*"
is consistent with the naming convention of WordPress.
(-> `ROTARACT_CLUB_FINDER_VERSION`)
  • Loading branch information
bbenno committed Aug 10, 2024
1 parent a00ae04 commit 4a7f9b8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog], a

=== Changed

* A new named constant has been created with the name ROTARACT_MEILISEARCH_SEARCHINDEX. This must be defined in wp-config.php. This allows to change the search index for Meilisearch quickly and easily
* The named constant ROTARACT_MEILISEARCH_API_KEY has been renamed to ROTARACT_MEILISEARCH_CLUBFINDER_API_KEY. The reason for this is that each Wordpress plugin should have its own API key.
* The 'limit' attribute has been added to the Meilisearch Fiter. This can be used to specify the number of data records found. The limit is currently set to 25.
* A new named constant has been created with the name `ROTARACT_CLUB_FINDER_MEILISEARCH_SEARCHINDEX`. This must be defined in wp-config.php. This allows to change the search index for Meilisearch quickly and easily.
* The named constant `ROTARACT_MEILISEARCH_API_KEY` has been renamed to `ROTARACT_CLUB_FINDER_MEILISEARCH_KEY`. The reason for this is that each WordPress plugin should have its own API key.
* The named constant `ROTARACT_MEILISEARCH_URL` has been renamed to `ROTARACT_CLUB_FINDER_MEILISEARCH_URL`. The reason for this is that each WordPress plugin should have the option to use its own Meilisearch instance..
* The 'limit' attribute has been added to the Meilisearch filter. This can be used to specify the number of data records found. The limit is currently set to 25.

== {compare}/v4.0.0\...main[Unreleased]

Expand Down
14 changes: 10 additions & 4 deletions MIGRATION.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@

== Migrate from version 4.x to 5

* Rename `ROTARACT_MEILISEARCH_API_KEY` to `ROTARACT_MEILISEARCH_CLUBFINDER_API_KEY` in your `wp-config.php`.
* Rename `ROTARACT_MEILISEARCH_API_KEY` to `ROTARACT_CLUB_FINDER_MEILISEARCH_KEY` in your `wp-config.php`.
+
.wp-config.php
[source,diff]
-define( 'ROTARACT_MEILISEARCH_API_KEY', '...' );
+define( 'ROTARACT_MEILISEARCH_CLUBFINDER_API_KEY', '...' );
* Set the newly introduced `ROTARACT_MEILISEARCH_SEARCHINDEX` in your `wp-config.php` to the name of the Meilisearch Index containing club information.
+define( 'ROTARACT_CLUB_FINDER_MEILISEARCH_KEY', '...' );
* Rename `ROTARACT_MEILISEARCH_URL` to `ROTARACT_CLUB_FINDER_MEILISEARCH_URL` in your `wp-config.php`.
+
.wp-config.php
[source,diff]
+define( 'ROTARACT_MEILISEARCH_SEARCHINDEX', 'Club_public' );
-define( 'ROTARACT_MEILISEARCH_URL', '...' );
+define( 'ROTARACT_CLUB_FINDER_MEILISEARCH_URL', '...' );
* Set the newly introduced `ROTARACT_CLUB_FINDER_MEILISEARCH_SEARCHINDEX` in your `wp-config.php` to the name of the Meilisearch Index containing club information.
+
.wp-config.php
[source,diff]
+define( 'ROTARACT_CLUB_FINDER_MEILISEARCH_SEARCHINDEX', '...' );
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ IMPORTANT: The plugin's latest version is already installed at https://hosting.r
.snippet of `wp-config.php`
[source, php]
----
define( 'ROTARACT_MEILISEARCH_URL', 'https://search.rotaract.de' );
define( 'ROTARACT_MEILISEARCH_CLUBFINDER_API_KEY', '<your-meiliseach-api-key>' );
define( 'ROTARACT_MEILISEARCH_SEARCHINDEX', 'Club_public');
define( 'ROTARACT_CLUB_FINDER_MEILISEARCH_URL', 'https://meilisearch.rotaract.de' );
define( 'ROTARACT_CLUB_FINDER_MEILISEARCH_KEY', '<your-meiliseach-api-key>' );
define( 'ROTARACT_CLUB_FINDER_MEILISEARCH_SEARCHINDEX', 'Club');
----
* The Meilisearch API key is required to have `search` permission on index `Club`
. Set OpenCage API key in your `wp-config.php`, used to convert geocode to geopoint data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class Rotaract_Club_Finder_Meilisearch_Caller {
*/
public function __construct() {
if (
defined( 'ROTARACT_CLUBFINDER_MEILISEARCH_KEY' ) &&
defined( 'ROTARACT_CLUBFINDER_MEILISEARCH_URL' ) &&
defined( 'ROTARACT_CLUBFINDER_MEILISEARCH_SEARCHINDEX' )
defined( 'ROTARACT_CLUB_FINDER_MEILISEARCH_KEY' ) &&
defined( 'ROTARACT_CLUB_FINDER_MEILISEARCH_URL' ) &&
defined( 'ROTARACT_CLUB_FINDER_MEILISEARCH_SEARCHINDEX' )
) {
$this->client = new Client( ROTARACT_CLUBFINDER_MEILISEARCH_URL, ROTARACT_MEILISEARCH_CLUBFINDER_KEY );
$this->client = new Client( ROTARACT_CLUB_FINDER_MEILISEARCH_URL, ROTARACT_CLUB_FINDER_MEILISEARCH_KEY );
}
}

Expand Down Expand Up @@ -73,7 +73,7 @@ private function meili_request( array $filter ) {
if ( ! $this->isset_client() ) {
return array();
}
return $this->client->index( ROTARACT_CLUBFINDER_MEILISEARCH_SEARCHINDEX )->search( '', $filter )->getHits();
return $this->client->index( ROTARACT_CLUB_FINDER_MEILISEARCH_SEARCHINDEX )->search( '', $filter )->getHits();
}

/**
Expand Down

0 comments on commit 4a7f9b8

Please sign in to comment.