Project:Views Fast Search
Version:5.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Provides a hook_uninstall which:
* Deletes all variables for search rankings (apart from standard node search rankings)
* Deletes variable search_index_unique

AttachmentSize
views_fastsearch_uninstall.patch860 bytes

Comments

#1

Thanks! (This was part of a (GHOP Task).

I think you're missing a variable_del('search_node_links').

Also, I'd explicitly name the rankings to skip, because if you rely on views_fastsearch_search_ranking(), it's possible that you'll miss one or two of them if they were disabled (but not uninstalled). So instead of calling views_fastsearch_search_ranking, just use array('....', '....', '...') for all the values to remove. Then you might try to figure out some php array function that will give you all values that are in one array and not in another. Just a suggestion. What do you think?

#2

Status:needs review» needs work

#3

I can't find any mention of search_node_links in the module:

E:\Drupal>"C:\Program Files\TortoiseCVS\cvs.exe" -d :pserver:anonymous:anonymous
@cvs.drupal.org:/cvs/drupal-contrib -q checkout -r DRUPAL-5--2 -P contributions/
modules/views_fastsearch
U contributions/modules/views_fastsearch/README.txt
U contributions/modules/views_fastsearch/views_fastsearch.info
U contributions/modules/views_fastsearch/views_fastsearch.install
U contributions/modules/views_fastsearch/views_fastsearch.module

E:\Drupal>cd contributions\modules\views_fastsearch

E:\Drupal\contributions\modules\views_fastsearch>grep search_node_links *.*

E:\Drupal\contributions\modules\views_fastsearch>

array_diff would be the perfect function to use in this situation, however the PHP manual states that it was broken in PHP 4.0.4, so as long as Drupal supports PHP4, it is not desirable to use it. Using an explicit list is a better idea, so changed to use it.

AttachmentSize
views_fastsearch_uninstall_2.patch 1.09 KB

#4

Status:needs work» needs review

#5

Hmm, it looks like I've been accidentally developing on the DRUPAL-5 branch instead of the DRUPAL-5--2 branch. I'll need to fix this tomorrow. But, please check out the DRUPAL-5 branch and you'll see the missing variable.

Did you spend any time trying to get the following lines to two lines, using a php array function?

    $standard_rankings = array('node_rank_relevance', 'node_rank_recent', 'node_rank_comments', 'node_rank_views');
    foreach ($standard_rankings as $rank => $values) {
      unset($ranking[$rank]);
    }

I think that one of the array_diff functions might do it.

#6

I don't think the array_diff functions are applicable:
array_diff_assoc: Works on key/value pairs, whereas we want keys
array_diff_key: Requires PHP >= 5.1.0RC1
array_diff_uassoc: Requires PHP 5
array_diff_ukey: Requires PHP >= 5.1.0RC1
array_diff: Works on values, whereas we want keys

AttachmentSize
views_fastsearch_uninstall_3.patch 1.11 KB

#7

Then again, you could do:

<?php
    $standard_rankings
= array('node_rank_relevance', 'node_rank_recent', 'node_rank_comments', 'node_rank_views');
   
$ranking = array_diff(array_keys($ranking), $standard_rankings);

    foreach (
$ranking as $rank) {
     
variable_del($rank);
    }
?>

#8

Yes that's ideal

#9

Ok, using that :)

AttachmentSize
views_fastsearch_uninstall_4.patch 1.09 KB

#10

changed

<?php
+    // ignore the standard node_rankings
?>

to
<?php
+    // Ignore the standard node_rankings
?>
AttachmentSize
views_fastsearch_uninstall_4b.patch 1.09 KB

#11

Status:needs review» reviewed & tested by the community

Good to go!

#12

Status:reviewed & tested by the community» fixed

This is already committed.

#13

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

nobody click here