Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosescri committed May 18, 2020
2 parents 7fb1284 + 48fa61f commit fdaee69
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 22 deletions.
4 changes: 2 additions & 2 deletions doofinder/doofinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Doofinder
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Version: 0.3.3
* Version: 0.3.4
* Author: Doofinder
* Description: Integrate Doofinder Search in your WordPress website.
*
Expand All @@ -30,7 +30,7 @@ class Doofinder_For_WordPress {
*
* @var string
*/
public static $version = '0.3.3';
public static $version = '0.3.4';

/**
* The only instance of Doofinder_For_WordPress
Expand Down
56 changes: 39 additions & 17 deletions doofinder/includes/class-index-interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,46 @@ private function are_api_keys_present() {
* Generate the HTML of the indexing page.
*/
private function render_html_subpage() {
$status = $this->indexing_data->get( 'status' );

?>

<div class="wrap">
<h1><?php _e( 'Index Posts', 'doofinder_for_wp' ); ?></h1>

<?php

// If multilanguage is active, but there is no active language selected.
if ( $this->is_language_selected() && $this->are_api_keys_present() ) {
// We have the multilanguage plugin, but no language is selected.
if ( ! $this->is_language_selected() ) {
$this->render_html_select_language();

// API keys are not present.
} else if ( ! $this->are_api_keys_present() ) {
$this->render_html_missing_api_keys();

// Generally it should not be possible that we are in
// the middle of processing if keys are invalid, but some
// people have experienced that. Probably because of some
// DB shenanigans? In any case, if the index is being
// processed and we have no API keys that's probably and error
// so we should reset the processing.
if ( $status === 'processing' ) {
$this->indexing_data->set( 'status', 'new' );
$this->indexing_data->save();

$this->render_html_indexing_reset();
}

// Settings are ok, we have API keys, etc.
// We can render the indexing interface.
} else {
$this->render_html_wp_debug_warning();
$this->render_html_processing_status();
$this->render_html_progress_bar();
$this->render_html_progress_bar_status();
$this->render_html_indexing_messages();
$this->render_html_indexing_error();
$this->render_html_index_button();
} else {
$this->render_html_settings_error();
}

?>
Expand All @@ -233,19 +255,6 @@ private function render_html_subpage() {
<?php
}

/**
* Ask user to select a language.
*/
private function render_html_settings_error() {
if ( ! $this->is_language_selected() ) {
$this->render_html_select_language();

return;
}

$this->render_html_missing_api_keys();
}

/**
* Render error notifying the user that they should select
* a language first.
Expand Down Expand Up @@ -273,6 +282,19 @@ private function render_html_missing_api_keys() {
<?php
}

/**
* Render a warning that we have just reset the indexing.
*/
private function render_html_indexing_reset() {
?>

<div class="notice notice-warning">
<p><?php _e( 'Indexing was in progress despite errors in configuration. Indexing has been reset.', 'doofinder_for_wp' ); ?></p>
</div>

<?php
}

/**
* Because if WP_DEBUG is turned on we'll logging to local file instead of sending
* to the API, let's display the warning so the user knows what's going on.
Expand Down
7 changes: 5 additions & 2 deletions doofinder/readme.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
=== Doofinder ===
Contributors: doofinder, chopchoporg
Tags: search, autocomplete
Version: 0.3.3
Version: 0.3.4
Requires at least: 4.1
Tested up to: 5.2.3
Tested up to: 5.4.1
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -112,6 +112,9 @@ Just send your questions to <mailto:[email protected]> and we will try to an

== Changelog ==

= 0.3.4 =
- Reset if processing is in progress and there are errors in configuration.

= 0.3.3 =
- Prevent deleting all types from Doofinder when indexing, delete only those managed by the module.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "doofinder-wordpress",
"version": "0.3.3",
"version": "0.3.4",
"description": "Integrate Doofinder in your WordPress site with (almost) no effort.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit fdaee69

Please sign in to comment.