summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt4
-rw-r--r--contrib/search_api_facets/search_api_facets.module5
-rw-r--r--contrib/search_api_page/search_api_page.module5
-rw-r--r--search_api.module8
4 files changed, 19 insertions, 3 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index f645844..e2b2a86 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,8 +1,10 @@
Search API 1.0, dev (xx/xx/xxxx):
---------------------------------
+- #1161532 by drunken monkey: Fixed discerning between delete and revert in
+ hook_*_delete().
Search API 1.0, Beta 10 (06/20/2011):
-------------------------------------
+-------------------------------------
API changes:
- #1068342 by drunken monkey: Added a 'fields to run on' option for processors.
diff --git a/contrib/search_api_facets/search_api_facets.module b/contrib/search_api_facets/search_api_facets.module
index 2fe056f..c0f7f91 100644
--- a/contrib/search_api_facets/search_api_facets.module
+++ b/contrib/search_api_facets/search_api_facets.module
@@ -756,6 +756,11 @@ function search_api_facets_search_api_index_update(SearchApiIndex $index) {
* Implements hook_search_api_index_delete().
*/
function search_api_facets_search_api_index_delete(SearchApiIndex $index) {
+ // Only react on real delete, not revert.
+ if ($index->status & ENTITY_IN_CODE) {
+ return;
+ }
+
db_delete('search_api_facet')
->condition('index_id', $index->machine_name)
->execute();
diff --git a/contrib/search_api_page/search_api_page.module b/contrib/search_api_page/search_api_page.module
index 7e6ab1b..2564072 100644
--- a/contrib/search_api_page/search_api_page.module
+++ b/contrib/search_api_page/search_api_page.module
@@ -202,6 +202,11 @@ function search_api_page_search_api_index_update(SearchApiIndex $index) {
* Implements hook_search_api_index_delete().
*/
function search_api_page_search_api_index_delete(SearchApiIndex $index) {
+ // Only react on real delete, not revert.
+ if ($index->status & ENTITY_IN_CODE) {
+ return;
+ }
+
foreach (search_api_page_load_multiple(FALSE, array('index_id' => $index->machine_name, 'enabled' => 1)) as $page) {
search_api_page_delete($page->id);
}
diff --git a/search_api.module b/search_api.module
index e590c7c..5ca8922 100644
--- a/search_api.module
+++ b/search_api.module
@@ -449,8 +449,12 @@ function search_api_search_api_server_update(SearchApiServer $server) {
function search_api_search_api_server_delete(SearchApiServer $server) {
$server->preDelete();
- foreach (search_api_index_load_multiple(FALSE, array('server' => $server->machine_name)) as $index) {
- $index->update(array('server' => NULL, 'enabled' => FALSE));
+
+ // Only react on real delete, not revert.
+ if ($server->status & ENTITY_IN_CODE == 0) {
+ foreach (search_api_index_load_multiple(FALSE, array('server' => $server->machine_name)) as $index) {
+ $index->update(array('server' => NULL, 'enabled' => FALSE));
+ }
}
$tasks = variable_get('search_api_tasks', array());