| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 | 
							- <?php
 
- /**
 
-  * @file
 
-  * Install, update, and uninstall functions for the custom search module.
 
-  */
 
- /**
 
-  * Implements hook_install().
 
-  */
 
- function custom_search_install() {
 
-   db_update('system')
 
-     ->fields(array('weight' => 100))
 
-     ->condition('name', 'custom_search')
 
-     ->execute();
 
- }
 
- /**
 
-  * Implements hook_uninstall().
 
-  */
 
- function custom_search_uninstall() {
 
-   db_delete('variable')
 
-     ->condition('name', 'custom_search_%', 'LIKE')
 
-     ->execute();
 
- }
 
- /**
 
-  * Implements hook_enable().
 
-  */
 
- function custom_search_enable() {
 
-   drupal_set_message(t('Custom Search enabled. Don\'t forget to <a href="@link">set permissions</a>.', array('@link' => url('admin/people/permissions', array('fragment' => 'module-custom_search')))));
 
- }
 
- /**
 
-  * Increases the module weight.
 
-  */
 
- function custom_search_update_7100() {
 
-   db_update('system')
 
-     ->fields(array('weight' => 100))
 
-     ->condition('name', 'custom_search')
 
-     ->execute();
 
-   return t("Module's weight increased.");
 
- }
 
- /**
 
-  * New sub-modules notice.
 
-  */
 
- function custom_search_update_7101() {
 
-   return t('Custom Search has been divided in multiple modules. Please re-enable the sub-modules you need.');
 
- }
 
- /**
 
-  * Custom search paths upgrade.
 
-  */
 
- function custom_search_update_7102() {
 
-   if (variable_get('custom_search_path', '') != '') {
 
-     variable_set('custom_search_paths', variable_get('custom_search_path', '') . '|Custom path');
 
-   }
 
-   variable_del('custom_search_path');
 
-   return t('Custom search paths upgraded.');
 
- }
 
- /**
 
-  * Changes in the advanced search form settings.
 
-  */
 
- function custom_search_update_7103() {
 
-   if (variable_get('custom_search_results_advanced_override', FALSE)) {
 
-     variable_set('custom_search_advanced_or_display', variable_get('custom_search_criteria_or_display', FALSE));
 
-     variable_set('custom_search_advanced_phrase_display', variable_get('custom_search_criteria_phrase_display', FALSE));
 
-     variable_set('custom_search_advanced_negative_display', variable_get('custom_search_criteria_negative_display', FALSE));
 
-     $types = array_keys(array_filter(variable_get('custom_search_node_types', array())));
 
-     if (count($types)) {
 
-       $names = array_keys(node_type_get_names());
 
-       foreach ($names as $name) {
 
-         if (!in_array($name, $types)) {
 
-           variable_set('custom_search_advanced_type_' . $name . '_display', FALSE);
 
-         }
 
-       }
 
-     }
 
-     if (module_exists('taxonomy')) {
 
-       $vocabularies = taxonomy_get_vocabularies();
 
-       foreach ($vocabularies as $voc) {
 
-         if (variable_get('custom_search_voc' . $voc->vid . '_selector', 'disabled') == 'disabled') {
 
-           variable_set('custom_search_advanced_voc' . $voc->vid . '_display', FALSE);
 
-         }
 
-       }
 
-     }
 
-   }
 
-   variable_del('custom_search_results_advanced_override');
 
-   return t('Advanced search form settings changed.');
 
- }
 
- /**
 
-  * Store vids - machine names association.
 
-  */
 
- function custom_search_update_7104() {
 
-   if (module_exists('taxonomy')) {
 
-     $vocabularies = taxonomy_get_vocabularies();
 
-     $machine_names = array();
 
-     foreach ($vocabularies as $voc) {
 
-       $machine_names[$voc->machine_name] = $voc->vid;
 
-     }
 
-     // This will be needed for those upgrading to Drupal 8 or Backdrop.
 
-     variable_set('custom_search_taxonomy_machine_names', $machine_names);
 
-   }
 
- }
 
 
  |