update drupal
This commit is contained in:
@@ -22,3 +22,14 @@ function search_post_update_block_page(&$sandbox = NULL) {
|
||||
return $block->getPluginId() === 'search_form_block';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark everything for reindexing after diacritics removal rule change.
|
||||
*/
|
||||
function search_post_update_reindex_after_diacritics_rule_change() {
|
||||
$search_page_repository = \Drupal::service('search.search_page_repository');
|
||||
foreach ($search_page_repository->getIndexableSearchPages() as $entity) {
|
||||
$entity->getPlugin()->markForReindex();
|
||||
}
|
||||
return t("Content has been marked for re-indexing for all active search pages. Searching will continue to work, but new content won't be indexed until all existing content has been re-indexed.");
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ class SearchQuery extends SelectExtender {
|
||||
// search expression. So, use string replacement to change this to a
|
||||
// calculated query expression, counting the number of occurrences so
|
||||
// in the execute() method we can add arguments.
|
||||
while (($pos = strpos($score, 'i.relevance')) !== FALSE) {
|
||||
while (strpos($score, 'i.relevance') !== FALSE) {
|
||||
$pieces = explode('i.relevance', $score, 2);
|
||||
$score = implode('((ROUND(:normalization_' . $this->relevance_count . ', 4)) * i.score * t.count)', $pieces);
|
||||
$this->relevance_count++;
|
||||
|
||||
@@ -100,7 +100,11 @@ class SearchNodeUpdateAndDeletionTest extends BrowserTestBase {
|
||||
|
||||
// Get the node info from the search index tables.
|
||||
$connection = Database::getConnection();
|
||||
$search_index_dataset = $connection->query("SELECT sid FROM {search_index} WHERE type = 'node_search' AND word = :word", [':word' => 'dragons'])
|
||||
$search_index_dataset = $connection->select('search_index', 'si')
|
||||
->fields('si', ['sid'])
|
||||
->condition('type', 'node_search')
|
||||
->condition('word', 'dragons')
|
||||
->execute()
|
||||
->fetchField();
|
||||
$this->assertNotEqual($search_index_dataset, FALSE, t('Node info found on the search_index'));
|
||||
|
||||
@@ -108,7 +112,11 @@ class SearchNodeUpdateAndDeletionTest extends BrowserTestBase {
|
||||
$node->delete();
|
||||
|
||||
// Check if the node info is gone from the search table.
|
||||
$search_index_dataset = $connection->query("SELECT sid FROM {search_index} WHERE type = 'node_search' AND word = :word", [':word' => 'dragons'])
|
||||
$search_index_dataset = $connection->select('search_index', 'si')
|
||||
->fields('si', ['sid'])
|
||||
->condition('type', 'node_search')
|
||||
->condition('word', 'dragons')
|
||||
->execute()
|
||||
->fetchField();
|
||||
$this->assertFalse($search_index_dataset, t('Node info successfully removed from search_index'));
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class SearchPageTextTest extends BrowserTestBase {
|
||||
public function testSearchLabelXSS() {
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer search']));
|
||||
|
||||
$keys['label'] = '<script>alert("Dont Panic");</script>';
|
||||
$keys['label'] = '<script>alert("Don\'t Panic");</script>';
|
||||
$this->drupalPostForm('admin/config/search/pages/manage/node_search', $keys, t('Save search page'));
|
||||
|
||||
$this->drupalLogin($this->searchingUser);
|
||||
|
||||
Reference in New Issue
Block a user