function search_by_page_reset_blank in Search by Page 8
Same name and namespace in other branches
- 6 search_by_page.module \search_by_page_reset_blank()
- 7 search_by_page.module \search_by_page_reset_blank()
Resets pages that have no words in search index, so they'll be reindexed.
Page callback for the 'admin/config/search/search_by_page/resetblank' path.
1 string reference to 'search_by_page_reset_blank'
- search_by_page_menu in ./
search_by_page.module - Implements hook_menu().
File
- ./
search_by_page.module, line 1386 - Main module file for Drupal module Search by Page.
Code
function search_by_page_reset_blank() {
$sel = \Drupal::database()
->select('search_index', 'si')
->fields('si')
->condition('type', 'search_by_page');
$query = \Drupal::database()
->select('search_by_page_path', 'sp');
$query
->addField('sp', 'pid');
$query
->leftJoin($sel, 'sisp', 'sisp.sid = sp.pid');
$query
->isNull('sisp.word');
$result = $query
->execute()
->fetchAll();
$count = 0;
foreach ($result as $item) {
_search_by_page_update_last_time($item->pid);
$count++;
}
\Drupal::messenger()
->addMessage(t('Blank pages have been reset to index at next cron run (%num)', [
'%num' => $count,
]));
$response = new \Symfony\Component\HttpFoundation\RedirectResponse('admin/config/search/search_by_page');
$response
->send();
}